C
C#2mo ago
Faker

Is it appropriate to compare programming languages while learning a new one?

Is it appropriate to compare a programming language to another programming language while learning one? Say for example, in my case, I'm learning C# but I know a bit of java. I noticed that the syntax is almost similar and so in my head, for every thing I try to compare C# with java, is that correct to do so?
4 Replies
AlkalineLemon
AlkalineLemon2mo ago
Yes, it's useful to think about what would be the C# equivalent of a programming construct you already know(from an another language). For example, creating an instance of a class will have a different syntax in C# and Java but it's pretty much the same thing. Although sometimes there are differences too For example, C# arrays are quite different from C/C++ arrays
Anchy
Anchy2mo ago
It's fine, but it's important you do not assume what works in Java works the same in C#. For example, you can create getter and setter methods in Java to get and set private fields from your object, but in C# we have properties for getting and setting fields from a public space. Java also has very strict rules on exception handling known as checked exceptions which are evaluated at compile time. C# does not do this and expects you handle your exceptions properly at runtime. These are a couple differences you might make assumptions on and get incorrect. Also I would heavily recommend reading the Microsoft docs for anything C# / .NET related because they are fantastic.
Faker
FakerOP2mo ago
Yep, noted, thanks guys
wildREA
wildREA2mo ago
You can learn multiple languages and some will be similar, but they are all used differently. Either in situations or generally as a whole other platform. (Fx. web applications and software.) You could technically use, as an example, like Python in a software, but it's situational in that case. At least I haven't used Python over C#.

Did you find this page helpful?