Where all began!
I started learning to code in 2012 where I wanted to be able to develop my ideas in visual programming. The path for me was a little bit challenging more than the others because as a big step I figured out to shift my partiality from being an environmental design analyzer to go beyond just digital data. I found my way in computational design focusing on free-form structures, material geometry, and shape optimization processes I could have an arcade from physical to digital world by creating things that had been coming to my mind since. So, it began then.
Which programming language should I choose?
While I was trying to learn to code, there were lots of options to go for it. The main question for everyone might be where should I commence and what are my first steps? The answer is not that easy but, related to what we want to do, how we want to do, in what platform we want to have it, and by how much accuracy we need the results, the programming language you need to start with might be different. Although, lots of technologists say the best choice for beginners is python. I do believe in that quotation and did it too which I discuss here. But if I want to give you a hit about choosing the right language for you, according to the questions above, C type languages are great in calculation speed and not to get off a chart of programming structures (I am an architect, not a programmer so I did chose C# to have the feature mentioned and learning the rules and elements well). Java is a great choice for those who want to have the ability to work on different platforms. MATLAB Simulink is a reliable choice for engineers and scientific projects. Finally, python is amazingly simple, and for data science, has almost no opponent to compete within this field. Generally speaking, I am presenting what I faced to, obviously, it is recommended to have full considerations on other languages. But, in comparison to the items named above, python is the most common one which by the way has been selected by even professional programmers to work with, where instead of coding elements, you will experience simplicity besides a developable environment in a very abstract way. Each of these languages has benefits and downsides. More details for comparing different languages can be found here in simpli-learn!
All we need from coding is to have open access to our tools’ API and use the functions, methods, and classes as its fundamental library however we want. This can be enclosed by the developers of specific libraries and packages which we can be applied toward our methods and classes. These specific functions from any factors by any expertise we have or looking for have been set to do some specific tasks. APIs could take us up and running with the algorithm has been defined for solving our explicit problem. The ideal way is to have application features besides open-source workflows to develop it. Grasshopper3D fetches the same way and we could use python, C# either VB for developing our definite components. Let’s get a step forward to know how it works within apps by open-source API.
If you chose to start coding with python which is a series of reasons to do so, you have to know Grasshopper itself smoothly. This means you should know different variables, components, functions, and more importantly to know how to work with data structures. You can check the series of components from the “Set” tab known as DataTree. As I mentioned before, python is very smooth to learn and abstract in coding style. Before starting anything, you have to train your mind by python basics to be prepared for how to think python-wise. Python basics could be accessible by lots of resources but if you are a beginner, I suggest learning it on SoloLearn as an amazingly fluent and user-friend application on both mobile and web platforms, or participating in online courses on edX or Coursera. There are lots of extraordinary courses from the best universities there and you need to just adhere to the curriculum and schedule you might find desirable.
Python in Grasshopper3D is being used from the GHPython component where it’s using IronPython 2.7 for developing the environment by using Python. I am going to leave GHPython behind to discuss it in detail as s specific post but, if we want to have a comparison with other options, we could have for using RhinoAPI, it’s time to have this evaluation within the interface. The idea of challenging which language works better and what are their differences has been conventional for me by Long Nguyen in his amazing workshops at ITKE ICD. He had used different programming languages with the same function as components to check out their performance under low and high loads of data. Here is one simplified example of such revealing.
Python against C# in Gh
As we discussed before, C languages are beneficial according to a higher range of calculation speed and also learning the basics and elements of coding. These features can be assessed by the way we defined here. Both components analyze a curve and divide it by the amount of number slider defines as an input. Considering the time both components show on the profiler, shows that the C# component works better in speed and loading the command on the curve. The more we set the slider higher, the more differences the python component gets to do the same procedure in the dividing curve. Just in case, use the files below and test the components for the high and low range of dividing segments. The calculation rate does not just happen in Grasshopper but, it’s true in other platforms where we use Python in the contest to other languages. I don’t blame it because mainly python deducted a huge amount of coding lines and make coding simple to learn for many people. It just should be placed well where we need it which I will open this subject in future lines here. In other words, nothing is comparing to python right now if you are designing your application prototype functionally no matter what platform you are using. This is the biggest advantage of using python.
Python in data science, AI and ML
As long as our project is related to data science and machine learning algorithm, the number one choice would be python no string attached. The most common language among programmers’ choices within this field is Python in recent years while we also have some amazing other options like R. Python works prodigious in Machine Learning Algorithms. Everyone in the field of data science experiences python as one of the most common programming languages. The article from IEEE about how developers have used python each year profoundly shows that it is going to get off charts by the statistics of researchers per project using different languages.
Python has a lot of libraries, developers can use. While there are built-in functions besides these series of libraries, we can match and mix almost every data type and data set together. This is just exactly what I am looking for. Ease of access to learning materials, authorized by high qualified universities and IT leaders like IBM, Google &…, also covering scientific fields widely are the most extraordinary labels we can attach to python. It is object-oriented which means you can call objects through functions and classes by attributes and properties and code through procedures. Imagine we are working with data related to some objects as their labels, object-oriented programming (OOP) could use specific functions within the ones with those labels by getting to know them. Python also is open source and free and taking action in it is asynchronous. This feature is like an ability to compile line by line where we simply can find our syntax errors immediately without any need to run the whole algorithm (program). Last but not least is python can be used as a cross-platform language. We can have it almost everywhere from the web to desktop applications and also embedded systems like IoTs (Internet of Things).