Comparing asp to asp.net

Oh the Joy of .net and object orientation in general:

 

Compare the old asp way.   Just functions with single return values:

 

                                              

if rules("isafirstname",firstname) = true and rules("isasurname",wholename(0)) = true then

     transmute =("L-CAPNAMEINIT{_}"&propercase(firstname)& " " & propercase(wholename(0)))

elseif rules("isafirstname",firstname) = true then

     transmute =("L-CAPFIRSTNAMEINIT{_}"&propercase(firstname))

end if

 

So I would wind up stuffing a load of data into the return string and then reassembling it in the calling function.

 

First go on Tuples today.  Seems to me a sort-of “quick fire” multi-return type where you don’t want to go the whole hog of returning a struct.

 

Dim foundRows = boysnames.Select("name = '" & Replace(username, "'", "''") & "'")

 

If foundRows.Length >= 1 Then

   Return New Tuple(Of Boolean, String, String)(True, foundRows.CopyToDataTable.Rows(0).Item("friendlyname").ToString, "Found in Boy's Names Table")

End If

 

Return New Tuple(Of Boolean, String, String)(False, "", "")

 

How cool is that?

 

If there are any old farts like me still debating wether to go for .net and object orientation in general.  The answer has to be “do it now!”.

 

Comments

Popular posts from this blog

How do you fix a roll of aluminium foil once it's started spiralling?

Why does Premiere Pro "Sequence from clip" on MP4 and then "Match Sequence" result in a massive AVI file?

Introducing PDR: A Bold Proposal for Fairer Representation