At The Door of C# With A Python Backpack
As I dived into C#, I encountered many things that caught my attention because of how different it is from Python. I will write down today some of them, and maybe another day I post a few more.
Since this is just a journal, I will mainly focus on the C# side.
Interpreted Vs Compiled
In a compiled language like C#, the code is translated into machine code before execution. So we “build”, meaning we generate a file that contains our translated code (“.dll” file), and we run the program after that.
Python is often considered an interpreted language because it is executed line by line - the long explanation is a bit more complex though.
Statically Typed Vs Dynamically Typed
In a statically typed language like C#, variable types are checked at compile time. This means we don’t get to run the code if we don’t explicitly declare the data type of each variable - it will fail at compile time.
This changes the way of working to some extent. My perception is that I code slower than with Python, but when I run it I feel more confident that it will run successfully. Also, the code gives me a sense of robustness when using C# - I understand how some people can feel “safer” using this language.
Visual Studio Code Vs Visual Studio
Visual Studio Community, or “Visual Studio”, is the tool of choice for many C# .NET developers, and the natural choice when starting C#. As I come from Python, in the past I worked a lot with Visual Studio Code, or “VSCode”, instead.
I know that one is an IDE, and the other one a text editor. But comparing them is just natural because, in the end, it’s the tool you use to work.
My initial reaction to Visual Studio was surprise at how heavy it is to install. Someone told me that if we install all the required extensions in VSCode it is possible to achieve a similar experience to the one you get in Visual Studio. I am not sure about that, but it is good to take it into account.
The one thing that I am still getting used to is that the Solution Explorer of Visual Studio doesn’t show all the files contained in the folder - if a file is simply copied and pasted into the directory further steps are needed for it to show. Something I do think is cool is seeing in the Explorer all the methods of a class (I imagine that is one of the things that can be achieved in VSCode with an extension).