Convince me not to give up C# and learn Python

This surprises me honestly, I was quite surprised how easy it was to get started. It’s a lot to learn, but there’s a boatload of samples in every available language GitHub - mcneel/rhino-developer-samples: Rhino and Grasshopper developer sample code, there are a few ETO examples in here too.

Totally fair.

I’ve been coding in C# daily for almost 6 years now and I would still agree I find UI libraries in general quite a tough bar to entry, they’re basically like learning an entirely new language

Have you tried it in Rhino 8? I’ve found it to be MUCH nicer with the unified code editors.

Haha …
I struggled with RhinoCommon docs as well at first … and still I’d prefer if they were more complete and clear, but I’m only a programming enthusiast, but by no means a real programmer.
Also I think McNeel has not enough time or people to write better docs, but … yeah, getting started with RhinoCommon is not easy for a simple user/scripter.

Fortunately I only wrote scripts for Rhino for personal use, keeping the user interface as simple as possible.
Only GUI I used is what is available via RhinoCommon, with very few exceptions.
I try to stay away from Microsoft graphics libraries, I find them to be unnecessarily complex, maybe also due to the convoluted, MS-style docs.

But here the problem is the graphics library, not the language …
I used tkinter and WX with Python in the past and had no problem with them.

In Rhino you can do things in RhinoScript, using VBScript, that RhinoCommon cannot do … al least speaking of a few years ago. :wink:
But obviusly in RhinoCommon you can do waaaay more things. :slight_smile:

I never used AutoCAD, but I read that in AC you can insert AutoLISP code directly in the command line.
That’s a feature that I wish Rhino had too.
Also, I think Lisp was a nice choice for Autodesk, I’d like there were a RhinoLISP too … :smile:
( And a Rhino DXF-like format, but that’s another matter )
Lisp is genius.

Back to C# …

Sure, learning C# and RhinoCommon at the same time can be hard.
You might try with Python.
And if you like it, after learning some RhinoCommon by Python, should you decide then to look at C# again, I’m sure that it will be much easier. :slight_smile:

Although learning Python may not be as easy as il looks, but learning one more language is always nice IMO. :grinning:

1 Like

Yes, in 8.

Definitely true, not just for C#.

1 Like

One thing that made me (again) lean a little bit more towards Python: The MIT Comp Science course which is taught with Python.

I find that if I’m doing lots of “mindless” drafting, I’m not as sharp in many areas. As it turns out, if you aren’t mentally engaged during long stretches, parts of your brain do in fact shrink :open_mouth: . I’ve known this for a while (not the physical shrinking but the mental decline) but recently found out it’s true. I try (but don’t) to either take a formal course, or study at least one branch of mathematics each year. So that would be the equivalent of killing two birds with one stone.

Comp Sci using C#? That would be absolutely awesome. But it doesn’t exist (as far as I know). I looked up a couple courses and they were nothing but: “Comp Sci” in the title but just a series of extremely basic lessons.

One big hurdle when I got into learning C# was all the terminology. Even things I already understood. They just throw so many terms around without explaining them. Then spend an hour teaching you how to use an “IF” statement :-S . Maybe the Comp Sci would help with that.

pick your poison

2 Likes

Hehe, I always quite liked this comparison:

8 Likes

The bottom middle picture is comforting as I drive a Honda myself (actually two if you include the motorcycle)… :smile:

2 Likes

Things I miss in Python

  • many APIs in AEC are .NET
  • small number of good graphic libraries
  • small number of good game-engines
  • it’s more challanging to build something bigger with it (although it is possible)
  • it’s more challanging to write something that will be fast with it (although it is possible)

If none of this is the case: I’d stick to Python :slight_smile:

Hahaha …
Pretty rough on Javascript IMO.

Anyway …
:smile:

2 Likes

Hehe, I think it’s at least ten years old, so maybe they went a bit hard. The Java bit stands though :wink:

1 Like

Is there any update on this? Visual Studio for MacOS will soon reach EOL.

You can always use alternative editors. The VS template is not doing much. It implements some interfaces, references Rhinocommon/GH and renames the dll into a .rhp or .gha as a post-build process. But its nothing more than a Net 4.8 (Rh 5-7) or Net 7 (Rh 8) library project.

And that essentially leads to my answer to this thread. Don’t complain about a language. If you do serious software development you will hit the boundary of what you know or what something was designed for, on a daily basis.

You either like it, or coding is nothing for you.

After a while, languages and frameworks become quite replaceable, and therefore it helps to understand what is going on beneath the surface. You can’t know anything, but you can learn the right things!

I teach coding to professionals of other technical domains to prevent them loosing their job. I frequently see people to expect that after two months they will start working productive as a software developer. Often with a mindset of learn things only once.

This is unrealistic, so I find it more important to motivate people and give them the ability to solve problems on their own. The problem is almost always behind the screen. Therefore its important to break your inner arrogance. No beginner is capable in judging about a language, and getting rid of opinions is the first hurdle to master.

1 Like

And that essentially leads to my answer to this thread. Don’t complain about a language.

If a language has strengths or weaknesses, or inherit flaws, it’s definitely worth pointing them out. It helps new learners choose what’s best for them. It’s especially important given all the false information published about coding (to promote books, online courses, etc…).

You either like it, or coding is nothing for you.

Kind of… I made really fast progress in AutoLISP. Floundered in C#. And now I’m making fairly fast progress in Python.

I’m actually convinced that I would have faired better in C++ compared to C#. Lots of the advantages in C# confuse me. I remember spending days trying to figure out what a delegate was, only to realize it was something I’ve been using in AutoLISP for ages. I don’t know what it is but C# documentation and tutorials just don’t jive well with me.

The C# language and their approach to developing it has some inherent flaws (in my opinion but of course but from my perspective they seem objective). They keep adding more and more ways to write the same code, like trying to abbreviate lambda statements like 200 different ways. Suddenly you have hour+ long tutorials to teach something you could learn in Python in 1 minute. I especially don’t get the attempts to abbreviate code given the existence of intellisense and Auto-completion.

What really killed me with C# was the GUI’s, and like above, not willing to leave well-enough alone. They borked WPF pretty bad when they updated it and it was broken in a few ways (broken packages are devastating for beginners). It’s amazing that the drag-and-drop features of WinForms have never been matched with newer GUIs. Either they were that far ahead of their time or something else… They (Microsoft?) overhype some of their packages. Or at least the people promoting them do. When you compare the hype to people’s real opinions it’s quite different. Like Maui for example. But why I’m interested in Maui when my main focus should be Rhino Development is a great question :wink: .

Java is even worse (apparently) so C# has successfully established itself as a real competitive alternative. It has a few very popular packages but they aren’t really something a Rhino plugin developer would ever need.

Given that Rhino 8 has a built-in Python editor I think that for beginners especially that really weights in Python’s favor. One key reason I was so successful with AutoLISP is that I can rapidly load and edit code and debug way fast. A better programmer, whether a natural or just more experienced, might not need that. But it’s a huge help for me, especially when I’m coding after a long day at work and not at 100%.

I’m finding Python documentation to be way better so far. But the shear number of users dictates that will be the case. It took me a few years to gather the ‘best’ resources for C#; by ‘best’ I mean resources that were suitable for my learning level. Some books I bought were good but way over my head. Some were inherently flawed and basically went straight towards the recycle bin. Python has its share of duds, already bought two, but I’ve basically already sourced everything I need to learn. I just need to learn now. But at least I don’t have to worry about learning from bad resources.

Yeah, but I think, at least for us non-professionals, it’s mostly a matter of personal taste and experience. Also of way of thinking, so to speak.
When learning to program we need to grab a few concepts, which may vary depending on the language or languages we choose.
We may find these concepts more or less hard to understand.

Advice from others can help, but I think we also have to check out by ourselves and find what is best for anyoune of us.

Cool !
Glad you like learning Python. :slight_smile:

Hmmm … I generally would be surprised if anyone would find C# harder to learn that C++.
Or Java harder than C++, for that matter …
But … yeah. I think finding good resources for C++ is easier. ( Easier for Java as well, but nothing to do with Rhino )

Out of curiosity, can you use different GUI’s with Python in Rhino compared to what you can use with C# ?

Anyway …
Welcome to Rhino’s Python community !

Well … there are even two of them. Plus those in Grasshopper 1 & 2. :wink:

Hmmm … I generally would be surprised if anyone would find C# harder to learn that C++.
Or Java harder than C++, for that matter

The hardest part for me is figuring out how to use packages. I’m finding that is really where the disconnect starts. C# has all these “shortcuts” and various other features that hide much of the code. But if the learner doesn’t know what that hidden code actually does it becomes a memory game, or a “monkey see monkey do” affair. WinForms is an excellent example where if you delete certain things everything goes to hell. Once you’re more familiar with it you can dig into the automatically generated files and fix things manually. But when you’re beginning you can’t even rename something (I recall that even using VS’s refactoring would still break things).

Now that’s not to say that I wouldn’t struggle with the memory management side of things (I probably would but maybe not). There’s way less “hidden” code and therefore a C++ programmer would know more about what they’re doing compared to someone learning from the typical C# tutorial.

Out of curiosity, can you use different GUI’s with Python in Rhino compared to what you can use with C# ?

It just so happens that Eto forms are better documented in Python than they are in C#, even though they are actually written in C# and the Python version just wraps the C#. As far as using other dialogs, I think that’s a question better left for McNeel. I’m exploring the various GUI’s in Python. Some are broken in similar ways to C# but I seem to be having better luck figuring it out so far.

There are lots of samples of Eto in C# but I generally find it very time consuming to download examples from Github and usually don’t get the information I need anyways. Lots of stuff just doesn’t work (version/deprecation issues, missing dependencies that you have to track down, and many other reasons…). I like a good written tutorial to follow that’s what seems to work best for me.

1 Like

Recently the C# language is changing faster than the projects I work in. I 110% agree that this language offers too many options in doing things. I started with C# 1.0. So probably it was easier back in the days.It seems to become the new C++ ( in terms of complexity). But I do like C# for one particular reason. Code profiling and debugging is extremely powerful. As soon as you do something more advanced, you will value the tooling and the rich standard library. Writing a concurrent app is a pain in Python as well as in C++. For me C# is a good compromise in between a low level language and an interpreted scripting language.

I did WPF / Avalonia MVVM for quite a while and the learning code was steep in the beginning. Even with lots of experience in C#. But in comparison to TKInter QT or similar, you see the benefit as soon as you do something more serious. But personally I would also prefer Python or even Powershell for simple things. Other than that, I personally see more things in common than differences. Differences are more related to the libraries you use.

3 Likes

Avalonia looked very promising.

It’s the true successor to WPF. Not Maui or Eto. It was made by people who really knew the problems of WPF from a practical perspective and you can see this. They patched the most annoying things of WPF. Improved the performance of the DataBindings and they made it truly Cross-Platform. (In an ideal world), it even compiles to Web-Assembly. You can take your WPF markup and with little changes you can reuse it. This is great if you already have legacy application which need to run on Linux.

However, the development process is extremely fast nowadays. If you rely on whole frameworks which are not backed by a large corporation like Microsoft, you are risking a lot from a development perspective. But even if backed, the life-cycles are very short.

E.g. you see that Rhino 8 relies on Net 7. But Net 7 is already obsolete and its support ended 14 days ago. If you think about that someone detects a serious security weakness, you are forced to migrate to a newer NET version. This also means in many companies, IT is already removing NET 7 from PC’s. If your app is not self-contained you have a problem. It happen to me twice that IT forced us to migrate our tooling. But if its too new you get the same problem, because IT does not ship the latest Runtime. And if you think about what NET 8 does better than NET 7, then you begin to wonder why they really rushing development so fast.

In that regard I also love C. It hardly changed and you can say what you want, but its still relevant and just works.

2 Likes

@curtisw - anything new here?