Python or C# As a First Language?

Let me put my cards on the table. I think that Python is a terrible language and is a poor place to start your coding — but I use it…

Python or C# As a First Language?

Let me put my cards on the table. I think that Python is a terrible language and is a poor place to start your coding — but I use it extensively in my work, and I probably use it more than any other programming language. So, when I teach cryptography, it is often Python I turn to. And, when it comes to jobs, Python is by far the most popular programming language for demand [here]:

So, why do I think it is poor programming language? Well, mainly because it differs in so many ways from a properly structured language. For me, I just can’t remember how to do a loop in Python, and I have to “Google it” every time. And, the usage of tabs (and spaces) to structure code and having no semi-colon just leaves me cold. I also don’t like the way it creates classes and in how it can easily break. And, the “pip install” command is not the most reliable in integrating libraries, especially where it wants to recompile C code from stratch. And, finally, it is relatively slow compared with compiled programming languages.

It’s not C!

Of course, this is mainly because my first serious programming language was C, and so I am drawn to languages that are C-like, such as Golang. I have no problems remembering how to do loops and creating variables, and I fully understand how strings, arrays and pointers are used. But, for Python, there are many unknowns, as it hides a good deal of the complexity of code from the user.

So, is Python a good langauge to start with? I have two answers:

  • Yes, as it is mainly a scripted language, it is great for getting things up and running without any complex environments to setup, and in getting hooking kids into coding.
  • No. It hides so much away from the user, and doesn’t really teach the core principles of integrating code. As a first language it does not build a solid foundation that will allow someone to easy move onto other languages.

Overall, I don’t think it is a good programming language to learn how to code, but it is good for learning how to use code (and thus for teaching the principles of maths, cryptography or IoT).

Why C# for a beginner?

To me, if I taught coding, I would teach students C# and .NET, and use Visual Code to help them along the way. All of these can be run on whatever operating system that the students want to learn on. Overall, Visual Code has grown up over the years, and guides programmers through the development process, and teaches them how to produce good code.

One of the great things about using C# is that it integrates directly with the .NET framework, and which is backwardly compatiable with its version. And, so you know exactly which functions are supported with the given .NET version you are using. But, one of the great things about using .NET is that you can script with PowerShell, and which uses the same classes as C# does. This make it easy to convert from a scripted code to compiled code, and vice-versa. And the install of .NET is as simple as you you, and where you do not have the complexities of installing the Java runtime environment (Yuk!).

Conclusions

And, so, my recommendation is to get your kids into Python, and then show them C#, and get them to learn there. We need to stop switching people of coding, and get them seeing that producing code is a natural part of our work.

So, if you’re interested, here’s some C#:

https://asecuritysite.com/csharp

and PowerShell:

https://asecuritysite.com/powershell/