timdams
New member
- Joined
- Dec 23, 2021
- Messages
- 1
- Programming Experience
- 10+
With the arrival of toplevel statements in C# 9 and Visual Studio 2022, the default console projects basically start out with an empty Program.cs file. Gone are the , for beginners, strange things likes class Program, namespace, endless curly braces, etc.
From the perspective of “luring” potential future C# developers into the language, toplevel statements are an interesting choice (one we’ve also seen in for example Python).
From the perspective of teaching C# however, I have some reservations, and I was wondering what other peoples insights in to this are.
Allow me to elaborate some of the upcoming pitfalls and problems I now see approaching:
a) How do other teachers and professionals feel about this concept
b) How do people look at toplevel statements, in conjunction with the new console application template.
c) Am I simply a 40year old C# dinosaur who should suck it up and embrace every new thingy C# throw at us (the difference with before was that new features always could be ignored more easily) ?
Wishing you a happy new year!
From the perspective of “luring” potential future C# developers into the language, toplevel statements are an interesting choice (one we’ve also seen in for example Python).
From the perspective of teaching C# however, I have some reservations, and I was wondering what other peoples insights in to this are.
Allow me to elaborate some of the upcoming pitfalls and problems I now see approaching:
- Existing body of knowledge is suddenly outdated: 99% of all online solutions and projects are based on C# code that never had toplevel statements for more than 20 years now. For a beginner, simple looking for simple information, they will almost always immediately be confronted with non toplevel statements code examples. Thousands of good books, tutorials and videos have been made throughout the years, all teaching C# with console projects in the ‘old ways’.
- Toplevel statements simply push a barrier a bit further down the road: in then end, beginners will have to learn to work with methods, and next up classes (note: I first teach structured programming (variables, decisions, methods) and then continue into object oriented programming (classes, interfaces, and the likes)). Leaving out the main(){} code and class program{} code at the start gives beginners the idea that C# is easy from the getgo, the moment however they then discover methods, let alone oop, they will (I’m afraid)
- A) start writing local methods and not really grasping the core concept of why methods can be so powerful.
- B) start screaming about the sudden appearance of all the things toplevel statements left out.
- Console application template in VS is fundamentally changed: Again, I understand why toplevel statements exist. But I frankly don’t understand that the default console application solutions now start with this new concept at its core. In my opinion Microsoft/VS should leave console application templates as they are, and simply create a new type template, called for example “Rapid console application prototype”. Basically, the new VS2022 console application template makes my previous two points more in your face and force everyone (using/teaching with console applications) to embrace toplevel statement, whether you want to or not.
a) How do other teachers and professionals feel about this concept
b) How do people look at toplevel statements, in conjunction with the new console application template.
c) Am I simply a 40year old C# dinosaur who should suck it up and embrace every new thingy C# throw at us (the difference with before was that new features always could be ignored more easily) ?
Wishing you a happy new year!