DEV Community

NicolaiGorden
NicolaiGorden

Posted on

Flatiron Phase 3 Blogpost - Learning new languages, and syntax simplicity.

Despite knowing for a while now that object-oriented coding languages share a lot of similarities, I had been afraid of learning new ones. Before I learned JavaScript and Ruby for the Flatiron School, I had spent a month trying to learn C#, as it's a very useful language to know if you want to get into game development. As I'm writing this, I still know very little about C#; nothing really ended up sticking. For a while now, I've wondered why that was. Of course it was easier for me to learn Javascript because I was doing a guided course for it, but I feel like even without that boon, the language is just more accessible to a beginner (this doesn't mean I think it's THE BEST language, I don't have enough context to say such a thing). After learning Javascript, I was pretty anxious about learning Ruby. My prior experience with C# made me scared that the knowledge I had wasn't going to carry over. In my head, all I could remember was being incredibly confused while watching tutorials on Youtube. Well, turns out pretty much all of the things I had learned from Javascript still apply to Ruby, with some slight variations on rules. The only thing that really took a lot of brainpower for me, was learning new syntax.
I'm very early in my coding career, so I'm not exactly qualified to explain to others what good teaching practice is when it comes to coding. Regardless, I think it's imperative (at least, for someone like me) to learn with a language that has descriptive, easy syntax. I now have the experience of learning a language for the first time, and learning a language with some general coding experience under my belt, and those two learning experiences are incredibly different. In my opinion, the first language you learn should make it easy for you to learn coding fundamentals without overcomplicating things. Throwing terrifying words like "public static void" at a beginner can be deceptively overwhelming, even if you tell them to "ignore it for now". Let's look at what a function declaration looks like in a few different languages.
Here's a very simple function/method written in C#, Javascript, and Ruby (C# experts please forgive me if there's a cleaner way of doing this, I wrote it after looking at W3schools for about 4 minutes). It does the same thing in all languages; takes in a string as an argument and prints that string to the console.

Image description

Alright, so this is C#, and (pretending I have absolutely zero clue what I'm looking at) I've got to be honest, even with a little bit of experience this code snippet is a little much compared to what I'm used to. I still don't know exactly what "static" and "void" are doing, but with more knowledge I can actually make some educated guesses now. Maybe static means this is immutable? Or maybe it's some kind of pointer to...something. Could be totally off the mark. Also not sure why we're putting this in a program class. Still, I can tell this is a method/function based on the fact that we're clearly defining "PrintMessage", which takes in an argument. Then we call that function in the second block of code, re-enforcing that this is definitely probably a function. Maybe. I can only come to these conclusions now because of my experience so far.

Image description

Image description
Let's take a look at Javascript and Ruby at the same time, since these two functions look very similar. The difference I want to focus on here, is that in Javascript, we define a function using the word 'function'. Amazing. Unceremonious, but very helpful to a beginner, whereas in Ruby, we use def. As someone with at least a little bit of experience, this is pretty cool! That's only because, however, I know what a function looks like regardless of the keyword. I can tell it's a function simply due to it's contents and the fact that it takes in parameters as arguments. Despite Ruby's visual simplicity, I'd still probably start someone off with a language like Javascript, even if it's just to introduce some basic coding concepts. This all seems pretty minor at the end of the day, but I do really think it's important to consider what context you have as a learning coder, and how best to learn based on that context. I've focused a lot on just functions/methods today but I want to clarify that I do think this extends to other parts of these programming languages. In Ruby we define constants by giving them uppercase names, but in Javascript we literally use the word Const. It's helpful for beginners to have labels before building the ability to recognize coding patterns that don't have those labels.

Top comments (0)