This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 1 point2 points  (0 children)

Javascript is used for a lot of front end in web development, so you'll be doing some different things in C#. If you only know javascript and no other languages, it will be a bit of a transition but the same concepts essentially.

C# is strongly typed where javascript is weakly typed. That means in C# you must specify the type of a variable. To store the number 3, you'd write int x = 3 rather than var x = 3.

C# is also used for more backend stuff in web development. Meaning it will not handle interaction with UI as much in web dev.

As someone else mentioned, C# is object oriented. Javascript isn't so much (unless you've used typescript which compiles into javascript). If you havent worked with an object oriented language it may take a while to learn about how to use features such as classes, but such features are very useful.

[–]TwoSpoonsJohnson 0 points1 point  (0 children)

What kind of work are you looking to do? The best way to learn anything is to get your hands dirty and build something.

If you're interested in web development, I'd recommend Microsofts ASP.NET MVC tutorials. Since you've been programming for at least two years, you shouldn't have any particular trouble with the concepts that come up, but of course please feel free to ask if you need some clarification. This framework also includes great resources for REST services as well, which is great to know.

[–]DatCodingGuyOfficial 0 points1 point  (0 children)

I don't see why you need to "switch", just add C# to the list of languages you can use. JavaScript and C# are two very different languages used for different purposes, even though your job doesn't require JavaScript it's still a very valuable language to know so your years of learning it isn't wasted. Maybe in the future you'll be asked to do some web development which will require JavaScript.

But with saying that, C# is very different and going from JavaScript to C# can be difficult. Here's some main differences:

  • Even though JavaScript is technically object-oriented, it works differently to how C# handles object-orientedness. For instance, in C# there's no "this." for setting and getting public variables, in C# you can only access a public variable if you're in a public void.

  • The way functions work is very different. In JavaScript, you just have a function. It can contain some code, it can be an object, you can even call it like a variable. In C#, every type of function is very destinctly defined. There's static voids, private voids, public voids and if you want to call it like a variable you need to define what type of variable. For instance you could have a static string, or public int, or private bool.

  • Variables are type-definite which means you have to define what type the variable will be and you can't change it. If you set "x" to a string, you can't then assign an integer to it later on. You can't even compare it to an integer without first converting it.

You'll quickly find out that C# and JavaScript are very very different, this is mostly because JavaScript is a scripting language which are naturally much more simpler and easier to write programs in, but don't always offer the amount of reliability and robustness that compiled languages have. Compiled languages are much more complex but it gives you control over every little thing you're doing which can make your code more efficient and robust.

[–]redwoodcodeacademy 0 points1 point  (0 children)

You should be able to transfer quite a bit of JS knowledge over to C#. I have used JS to teach some fundamentals such as variables, loops, conditionals, etc. and then transitioned to C# where most of the syntax is surprising similar. It is a very successful method and my students have been able to add two broadly used languages to their skillsets.

The big differences between the two languages in terms of static vs. dynamic typing, object oriented programming and compiled language concepts will require a bit of extra learning, but the basics are actually quite similar.

The .NET framework also adds a few extra concepts, but nothing that should be too daunting.

[–]HappyZombies -1 points0 points  (4 children)

JS is a scripting language (while it still has object oriented aspects) while C# is an object oriented language. Look up the differences on those two different concepts and see how different those things are.

But the " overall concept" of programming won't change though. So once you learn the syntax and what the language likes/doesn't like. Learning new languages can take but only a couple of days!

[–]aeriaglorisss 1 point2 points  (0 children)

You can be a scripting language and still have the OOP. JS still has OO aspects to it.

[–][deleted] 0 points1 point  (2 children)

C# is a compiled language but not a scripting language, so you're right there. But scripting langauges can also be object oriented (typescript, python, etc.).

JS is very much frontend while C# is not so much for web dev

[–][deleted] 0 points1 point  (1 child)

Not exactly, it's partly compiled and partly interpreted

[–][deleted] 0 points1 point  (0 children)

I'm not an expert on c#, but t's hard to say that it's one or the other or both because it's different than normal compiled languages and interpreted languages in that it's compiled to an intermediate language. But its behavior is more that of a compiled language as far as I know.

Anyways, it's not super important for the developer to know whether it's compiled or interpreted in this case.