X# or C#?

This forum is meant for anything you would like to share with other visitors
User avatar
wriedmann
Posts: 3655
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# or C#?

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4584
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

X# or C#?

Post 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.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Terry
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

X# or C#?

Post by Terry »

Hi Dick
I have attached a short pdf which may help to reconcile our views.

Terry
Attachments
Net Approach.pdf
(172.04 KiB) Downloaded 28 times
ic2
Posts: 1804
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

X# or C#?

Post 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
Terry
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

X# or C#?

Post by Terry »

Thanks Dick ::)
Post Reply