Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return 2 values from a function
Message
From
17/10/2008 09:55:43
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
16/10/2008 18:00:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01355203
Message ID:
01355581
Views:
34
>>I disagree with that fact.
>
>Didn't I say we would argue forever:) You see Hugo got yours completely wrong despite your good programming practice. Maybe it was bad then.
>Cetin

I think Hugo got his code exactly right as it couldn't have returned anything but False so why bother with all the extra code. But his example wasn't meant to be reality I suppose. I am not taking a side in this debate as I don't know if I have one. I suspect for every good programming practice there are times to break them. I also suspect many programming practices are based on someones preference when they decided to publish it as a good programming practice. With the code below, I happen to think this is easier to read and I do it all the time because it is easier to see right off that I am not going to try to deal with non data or other values useless to the method. I would never put a bunch of returns throughout my code however if the returns were based on a value determined within my method. For me it just gets too hard to follow a few months down the road. But if you can, than what's wrong with it. Just an another viewpoint.
Tim
public int DoSomethingToThisData(DataSet dsSomeData)
{
     if (dsSomeData == null)
          return -1
     
     // A bunch of code here to do the intentions of the method
}
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform