I always describe programming the same way to everyone who asks: it’s like teaching the dumbest person you can imagine the step by step on how to walk. Computers will follow you without fault; if you tell them to run themselves into the ground, they will try and find a way to damn well do so. You have to be careful in what you say, and how you say it. Be specific enough to understand, but concise enough to be efficient.
It’s hard, it’s tedious, but it is possible.
This was the challenge when I first learned C; taking a task that seems easy to do, breaking it down into its most basic pieces, and then reassembling those pieces into a set of instructions that a computer can understand. It took a different type of thinking than I was normally used to and through the course of a semester (plus a little more), I learned enough to call myself adequate. Not good, not great, just adequate. Now I find myself trying to learn how to program in Javascript, a language that is similar to what I’m used to, but just different enough to warrant a couple of days worth to actually figure it out.
So, how did I do?
Remember how I said that programming was like trying to teach the dumbest person you know how to walk? That’s how I felt about C, and Javascript isn’t all that much different except the person isn’t as dumb this time around.
I’m amazed at how “vague” you can be, at least compared to C. The fact that you don’t have to specify (directly) the type of variable that you want to create was a revelation for me. I probably took a good 20 minutes trying to figure out how to cast the variable before I realized that you only needed the three magic letters: v
-a
-r
(although, I’m told that using var
is bad programming and I should really be using let
instead).
Besides that, the actual coding and logic of Javascript is pretty much the same as C (and C++): while and for loops work the same, if and else statements are identical, switch statements are just like how I remembered them to be. Overall I felt at home trying to write my functions and I almost forgot that I was programming in Javascript instead of C.
That is until I actually tried to run the thing.
I googled this phrase a lot more than I’d like to admit. It took me a long time to figure out what I had to do in order to run the program I just wrote. I just didn’t get it, all the sources were telling me the same thing, that I didn’t have to compile anything, no a.out to worry about, just call the function in the editor and run the program.
No way, that’s crazy. What’s the REAL way to do it?
Nope, that’s really how you do it. Just pull up the console and run the program, which was a huge shock to me. How can this code run without compiling? This is crazy, everything seems upside down, cats and dogs living together…mass hysteria!
Though, I think this situation just shines a light on how different C/C++ and Javascript really are. One is a lower level language, very close to the hardware of the computer, and the other is a higher level language, built on higher levels of abstraction and more dynamic. I’m learning more about computer hardware and architecture, and this distinction is very interesting to think about now that I get to see the different approaches to each language firsthand.
I was taught C/C++ at the University of Hawaii’s College of Engineering, and am currently learning Javascript with the school’s Information and Computer Science Department, and I feel that each have their own way of teaching that kind of reflects both languages. In one instance I was taught very classically, with lots of theory about how the language interacts with the hardware, and even hand compiling the code myself in order to see what information got stored in the physical hardware and where. The other is an ongoing process and filled with quick challenges and feels more modern and fluid. Maybe this is because having background in another language makes learning new ones easier, but even with that in mind, everything seems so fast passed and in a totally different environment than I’m used to. One isn’t necessarily better than the other, it’s just different.
As for which language I like better? It’s really hard to say, both have their applications and approach computing in different ways, even if it doesn’t seem like it does. Either way, both provide valuable insight into the world of computing, considering their different approaches, and to me that’s a good thing.
Learn more languages, heck learn all of them! The more we learn the better we can become at actually producing great software so that we can finally teach the dumb things were trying to talk to how to walk.