Grasshopper

algorithmic modeling for Rhino

I tend more to learnig Python, because many other 3d apps use it already and VB beside from grashopper seems only being usefull for microsoft office - correct me, if i´m wrong.

Does the python component have or will it in the future have the same functionallity as the VB component? Is it OK to focus on python? Or will I miss something?

By the way I have very a rudimentare understandig in both languages (a little bit more in python). But I´m always a beginner in programming and it´s confusing to learn two languages at the same time. 

Would be nice to get an answer!

Greetings

Views: 12742

Replies to This Discussion

I think that C# should be something to consider as well.  C-style languages are everywhere, from php to Java.  The syntax, although it has a slightly steeper learning curve, is going to be the most useful when looking at other languages, regardless of whether they're C-style or not.

From the .Net perspective, C# is most likely your best bet as well.  All the features of .Net are designed predominately with C# in mind, so they wind up having a much cleaner, concise syntax.  Also, C# (and VB) embraces a more object oriented approach, which can make moving to other languages/applications/APIs easier to understand.

VB, for me at least, is a kinda clunky language. Its syntax, although fairly easy to pick up, starts to get tedious the more you do with the language (IMHO). VB also doesn't really translate as much as it used too. There are a lot of people that still prefer it as their .Net language of choice, but I think its fair to say that Office is about the last foot hold for VB.  There aren't as many Basic-style languages in use today as there were a while ago.

Python I haven't used as much as VB or C#, so I can say as much about it.  I do like the language when it flows, but it also has its quirks that go along with it.  Remember that the "Python" that we mention here is IronPython, which is a slightly different beast than CPython. There's a lot of correlation going on, but because it trying to recreate a language in a different context, there are Python structures that don't quite correlate to .Net and .Net structures that don't quite correlate to Python.

If you're just starting out, I don't think any language is a bad choice, but certainly pick one and move forward with it.  Once you've got the basics of programming (logic, flow, objects, etc), then you can consider opening things up and learning a new language.  You can always start small by reading some code in another language, or rewrite something you've written in another language.  Knowing multiple languages helps you understand what each language is trying to do and helps seeing the logic through all of the syntax.

For full disclosure, I started programming with VBScript a while back, and have been programming with C# as my main language for a year+. I've done a few other languages along the way, ActionScript and Delphi. I do some python programming here and there, but not a ton.

Also, if you're interested in some language popularity statistics, you can take a look here

Thanks Damien for the elaborate answer. It clarifies lots of my issues too regarding which language to focus on that will be more useful to write components in GH.

I guess the main question remains why do we need to learn any language? for what purpose or use, as each language structured to serve different purpose. The main purpose for us as Gerd put it "Does the python component have or will it in the future have the same functionallity as the VB component?". Or will Python be the prominent language for GH in the future?



Hi all,

nice discussion here.

"Does the python component have or will it in the future have the same functionallity as the VB component?"

To try answering this question: the Python component can already execute any Python code and access the complete RhinoCommon. This means that it already can do everything the Vb.Net and C# components can. Additionally, it can also execute dynamic code, which Vb.Net and C# cannot (here a longer discussion about this) and it can run external Python modules written in Python. Python components can also pass functions from one to the other, which is handy.

In general, I'd always suggest to use the available language with the philosophy and syntax that suits you better. I think I like all these components, as a user.

A disadvantage I see in the Python component right now is that it only works in Rhino 5, and that some strongly typed API are sometimes slightly more difficult to get right. dir() and help() are very handy to overcome this, though. On the other hand, it's much simpler to make automation work -- simpler than in any other language in which I tried.

So there is no "war" in my mind, it's just good to have more tools available.
Finally: the biggest step will most probably be the fact that you are learning your first programming language, rather than which particular instance. To start programming with Python in Rhino 5, there is this, for Vb.Net there is the second part of this (but it uses the older and slightly more difficult SDK).

- Giulio
_______________
giulio@mcneel.com

If you get the impression that the language you choose doesn't matter from my post, then I think you've taken it the wrong way.  The language you choose matters, but possibly not as much as you think. Starting out its important to stick with just one and learn how to program. However, once you've learned how to write the logic and deal with objects (etc), then the language is a medium for expressing that logic. Some languages are easier to use than others, some languages are better suited for one thing rather than another, some languages will have technical requirements that may make them more/less viable for a given solution.

In this situation, you can't go wrong choosing either language VB, C#, or Python.  All will give you a great groundwork for learning to program and all are equally viable for GH/Rhino.  Once you've learned, you can give one of the other languages a try and exercise your brain a bit. It will help you become a better coder.

VB is used I think by most Grasshopper coders, but C# being a close second.

C# is used more often than VB in the worldwide .NET programming community. It also seems Microsoft is much more interested in developing and promoting C#.

VB and C# are very similar though. There's a lot of differences in keywords and notation of course, but these are all very superficial. There are plenty of applications and even loads of websites that will translate VB into fully functioning C# and vice versa.

Python has quite a few different features (and probably lacks others) with respect to VB/C#. I'm not myself any good at Python but what I do know about it makes me think it's a language ideal for mathematicians and scientists who are developing functional programs as opposed to interfaces. This is of course what most people writing code for Grasshopper are doing, so far so good. I wouldn't like having to deal with the idiosyncrasies of python if I were entirely new to programming though. 

Giulio is in charge of the python component so I cannot say what features he's planning to add. I do assume that at some point we'll put his work into the core product and probably unify all scripting components as much as possible. But we haven't yet talked about this let alone agreed on anything.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

To elaborate on stats a little more, let's ask google (this is not a precise stat but might give an idea):

- searching "site:grasshopper3d.com Vb" yields 39'800 results (includes Vb.Net and wrongly VbScript, that cannot be used in Grasshopper)
- searching "site:grasshopper3d.com C#" yields 35'600 results
- searching "site:grasshopper3d.com Python" yields 28'500 results

- Giulio
_______________
giulio@mcneel.com

This seems a good a place as any to ask this question as its along similar lines.

Quick check list before continuing:

  1. Is wife stood over shoulder
  2. Is tongue placed firmly in cheek

I've been married to a brunette for 6 years and I was thinking about having an extra marital affair as a way of learning something new. What I was wondering is should I start seeing a blonde or a red head.

I've heard blondes have more fun but red heads are more libidinous and mischievous. I feel it is beyond me to try and take on two at once and as a result would accelerate the change of my own hair colour (what little remains).

With this is mind, I would be open to all suggestions to choose which one, but only one, to concentrate my efforts on.

Any thoughts?

Blonde, definitely. If nothing else it's easier to colour blond hair so even if you pick wrongly the transition will be less work.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi Tom,

execution speed is important in some cases (mostly live performances) - but one should also consider writing/editing time. Our human time counts after all! In this respect, Python is considered a "glue" language: it can do everything but works best to tie things together and automate. It is an interpreted language. C# and Vb.Net are slightly closer to the machine and are compiled. This is why Python can do its magic, but certainly it comes at some cost. In C# you can also write unsafe code, that can make accessing arrays more efficient but more difficult.

Most users who are new to programming can read Python and Basic languages better than C-family languages. The one that can be read best probably depends on who you ask and who wrote the code in the first place.

Finally, C# and Vb.Net components are running in debug mode. This makes it possible to retrieve the line number in case of error, but slows down tight loops a lot. I would not be surprised if their outcomes in release mode would look a lot different (often between 1.1-7 times faster, depending on what you do).
See more profiling ideas here: http://msdn.microsoft.com/en-us/library/ff647791.aspx

Btw, choosing a programming language is not for life. You can be promiscuous here. :)

- Giulio
_______________
giulio@mcneel.com

You can be promiscuous here. :)


More importantly, where do stand on blondes or red heads? 

Good point --- sorry if I went off topic!

- Giulio
_______________
giulio@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service