C# learning doubt

The inbuilt script editors are not really helpful for beginners. I think it is much easier to really learn C# and RhinoCommon if you use Visual Studio.

Scripting is also programming, the difference is that the code does not have to be compiled. It will be interpreted right after loading. But that does not make much difference with your approach.

2 Likes

I’m more confused now hahaha

thank you, helpful!

One approach, (to getting started with any language), might be to make a simple definition in GH, then try to reproduce it in a code component of your choice.

3 Likes

Very good advice. I started my GH journey by replicating the Addition component. :slight_smile:

// Rolf

I agree that this is perhaps accurate for the C# script editor, however the GHPython one is really highly beginner friendly IMO (then there is the whole issue of starting out with rhinoscriptsyntax instead of RhinoCommon directly, but that’s a different concern).

Long time since I used it… Had this thread in mind: Get selected Geometry with ObjectTable

I find that a primary reason why Python lends itself so well for on-the-fly programming on the canvas is that one doesn’t really need breakpoints, debuggers etc. As the language itself comes with a range of functions intended for introspection etc., such as print(), type(), help(), dir(), inspect(). Not that lower level languages doesn’t, but it’s just a heck of lot faster/simpler when one doesn’t have to cast to string and jump through hoops. Also (and this is important), the GHPython editor has a console out window where all these functions print to. That, plus F5 for run, has been crucial for a good/fast development feedback loop in my experience.

2 Likes

Yes, I also like Python and appreciate to have it in Rhino. But for extended developments I cannot really recommend it. The inbuilt editors are one reason, but there are also other weak points in python which can be a pain. And this is my current situation while working with python on very complex projects. Therefore I simply want to encourage the thread starter to learn C#

Agreed, but also perhaps…

and

…aren’t really super appropriate for beginners. But again, that fully depends on the intention and requirements of the beginner (in this case, do I want to develop compiled Grasshopper plugins, or simply script on the canvas?). Just getting Visual Studio installed might break the spirit of any newcomer.

Rhino Plugins, Grasshopper Assemblies, Videogames and Unity stuff I consider serious developments.

Sure, as would I…

…again.

I know this topic has long gone off-track, but when it comes to the Python vs C# for a beginner debate, I can’t see a reason to come down strongly on one side or another. If they’re up for C#, so be it; if they find Python less intimidating that’s okay too. Once you learn one language and understand its advantages/disadvantages, you begin to understand why you might want to pick up another. It’s not like we’re talking about deciding between SML and C#…
Looking further down the road: of course it’s probably true that a jump from C# to Python (or java, or many other languages…) is easier than the other way around. But is that really a big deal?

2 Likes

I think, the personal opinion also highly depends on which language someone has more experience in and this person has learned at first.

I usually claim my C# is better than my Python, but that might change soon for me.

Two drawbacks for both languages:

In my opinion C# totally exaggerates the concept of Object-Oriented-Programming. As soon as you read a class like “FoobarServiceProvider” you really get my point. If someone decides to learn C# from this thread, don’t listen to much to C# software architects, unless you are planing to write a complex business app.

What bothers me most on Python, is that its dynamic nature introduces a bunch of additional weirdo errors. Really pay attention on debugging.
And that virtual environment and compiling thing, and why on earths did they changed the syntax so much from Python 2 to Python 3???

Programming is solving Problems, but the more more problems you solve the more problems you get. That’s actually quite annoying sometimes…

if you have a problem, and you decide to solve it by programming, then you have two problems.
… and after 20 tries at fixing the problem you don’t know if the 21st will work, or the 40th, or …

2 Likes

Yes I think Guido van Rossum (Python’s creator) has said it was a mistake to change so much in one go. The good news is that, 10 years later, nearly 90 % of Python developers now use Python 3 !

I use Python on three different platforms and all are still using 2.7, including Rhino. Its not a big deal, but since I recently started doing some coding with Django, it really becomes annoying to get used to the newer syntax. And very often I don’t see real improvement, to be honest. I quite often like the older one.
Besides this, often code snippets just work for 2.7 or just for 3.5+. Well I guess the problem is just that niche coding is always limiting. I guess I’m not part of the 90% mainstream coder then :frowning: :wink:

1 Like

Not just newcomers.

3 Likes

I’ve been coding with both 2.7 and 3.5+ for the last 3 years and got pretty used to switching between the two. I really like f-strings and the easier use of generators in modern Python but I’m happy enough without them. I really miss numpy, pandas, etc with IronPython though and that problem will increase as Python 2 goes end of life and all the new toys only support 3.5 or newer…

Agreed. I don’t remember who brought it up (about using VS as a beginner) but of course there are simpler alternative ways to get started with C#, if you are on the level of need to learn the basic concepts of programming, for example this:

https://try.dot.net/ :slight_smile:

// Rolf

2 Likes

Of course it is not a good idea for auto didactic beginners to start with VS but it should be possible in a well guided workshop. Long Nguyen is doing C# workshops and there are recordings available: https://www.youtube.com/playlist?list=PLapoQ_9M-ujfYGOsZProIXPGx-HRfjJ9C

It may be very tough for a beginner to follow and understand everything of such a 3 days workshop. I think it is really matter for weeks, if not months… but if someone decides to go that way it may be an endless journey. Nobody said it will be easy.