xsharp.eu • X# or C#? - Page 4
Page 4 of 4

X# or C#?

Posted: Tue Oct 20, 2020 4:06 am
by wriedmann
Hi Chris,
for that where I need to work with SubStr() in VO, I'm not interested if the string is shorter than my requested length, or even is null.
Using the .NET method, either I have to check all conditions before I execute the method, or I have to deal with exceptions in every line.
In VO, normally I encapsulate an entire method in a begin/end sequence and have my globally defined errorblock doing the work, whereas in X# I have to deal with exceptions at every level.
Let me explain better: often I have code that is executed from both a Windows service and a GUI application. When there something fails, the errorblock of the calling program is called - regardless if an errorbox has to be popped up or an email has to been sent.
In .NET I have to define an interface that has at least a "ProcessException()" method, and when an error is occurring in the common code, I have to execute that code. IMHO this is much more and, even worse, much more complicated code.
Slowly I'm learning in how many places I have to deal with exceptions - and throwing exceptions slows down the program.
But since we are all programmers, we are nearly to lawyers (ask 5 lawyers about a legal question and you will receive at least 7 different answers) - so I don't expect you will agree.
Generally I have to say that I like it working with the .NET Framework - but the exception handling is the thing I absolutely don't like.
Wolfgang

X# or C#?

Posted: Tue Oct 20, 2020 7:03 am
by Chris
Hi Wolfgang,

Oh, I misunderstood you, I thought you were talking about the TRY...CATCH block requiring a lot of code itself. Yeah, I agree about Substring() and similar methods, I also prefer VO's way which is more forgiving. Fortunately it is easy to overcome this, by defining methods that work the way we want them to. Regarding the global error handler, I have mixed opinions, I see both advantages and disadvantages the way VO does it. But it is certainly a very powerful feature of VO.

X# or C#?

Posted: Tue Oct 20, 2020 3:02 pm
by TerryB1
Hi Dick
I have attached a short pdf which may help to reconcile our views.

Terry

X# or C#?

Posted: Tue Oct 20, 2020 9:08 pm
by ic2
Hello Terry,
Terry wrote: I have attached a short pdf which may help to reconcile our views.
Thanks for the reconciliation. I am impressed with your ability to create those flowcharts with all aspects of the problem having their place.

I assume the chance that you left one out by error is close to 0 ;)

Dick

X# or C#?

Posted: Thu Oct 22, 2020 8:30 am
by TerryB1
Thanks Dick ::)