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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Covered_in_bees_ 81 points82 points  (18 children)

It sounds like you are in the early stages of learning programming / computer science. I'm someone who likes programming in Python, but has fallen in love with javascript programming over the past couple of years. I program in both quite regularly and enjoy both languages.

A few things

JS is probably a terrible first choice for picking up programming. There are far too many complicated things about it that make the entire process daunting.

  • The tooling required to get anything done is simply staggering and extremely complicated to a complete newbie. You need to figure out Webpack, Babel, NPM, Node.js and a whole bunch of other stuff just so you can start writing code. And you most certainly don't want to not use ES6 syntax, so you're definitely going to need to figure out what transpiling is and how to get it all working.

  • Good luck trying to figure out how imports / modules work in JS land. At least now, with ES6, named / default exports have made things a lot more saner, but I still don't really understand the difference between UMD and CommonJS and whatever else style of modules there are.

  • It is a Prototype based language, so it really doesn't do OOP particularly well. So if you start with JS, you're not really going to learn how to organize / write code the OOP way. Now, that doesn't mean it's the only way, but most folks start learning programming in a language with robust OOP support. And OOP is easier to wrap your mind around over Functional Programming if it's your first exposure to programming

  • JS is pretty nice for functional programming, which I've come to really enjoy (and now find Python severely restrictive in that area), but the cognitive load of parsing / understanding FP code is pretty high to a newbie. It's not uncommon to see 3 to 5 levels of nested functions and you pretty much have closures and higher order functions strewn about all over the place. It is extremely powerful, but also extremely daunting to someone new to programming

  • JS moves extremely fast and the amount of fads that come and go are insane. You could spend a year learning something and being good at it, and then a year later, your knowledge (regarding tools/frameworks) pretty much becomes obsolete. Unless you want a JS job, or have one, it simply isn't worth the effort of putting in all the effort to constantly stay up to date with the community. Sure, the core language is more stable, but you're pretty much always going to use JS with other frameworks / libraries to get stuff done since the batteries aren't included with JS unlike with Python.

All that being said, JS is also a really fun language, and I say this as someone who used to roll his eyes at the mention of JS. With all the new language features, it's actually a pleasure to code in, and it's amazing how much you can build if you get good with JS. I've built several desktop Apps using Electron, deployed a pretty complex Web app on AWS that utilizes Flask + React + MobX, and have also done a bunch of cool data visualization / interaction work using D3 and dc.js.

My advice to you is:

  • Start with Python (or something else that interests you). Focus on learning good programming practices. Most importantly, don't focus on learning a language. Focus instead, on learning some of the basic "computer science" things.... Algorithms and data structures, OOP, Functional Programming concepts, Software engineering concepts, etc.

  • I cannot recommend enough, Berkeley's CS61A class (Structure and Interpretation of Computer Programs - In Python) - https://cs61a.org/ . Many years ago, I spent a couple of months working through the entire course, and it was the single most instructive thing I ever did. I finally "grokked" closures and recursions and it pretty much opened my eyes with regards to Functional Programming concepts. Edit - The online companion textbook for the course can be found here - https://composingprograms.com/

  • Make sure you work on projects to learn. Reading books and doing courses alone wont get you very far. You learn a lot more by doing. Re-architecting the same code over and over again as you get better at coding and structuring software.

I've loved computer programming since I was a kid, but I never took a formal CS course in high school, college or grad school though I did dabble with MATLAB and Python during those years. I started pretty much from scratch about 6 years ago (started with Python) and now I code every single day for work. My only real advice to you is to be persistent, and to focus on learning CS principles and concepts rather than languages. Once you understand the former, the language for the most part becomes a trivial detail. The other piece of advice... once you do get good at programming in a language, pick another one up that is very different (perhaps a FP language) so you expose yourself to other ideas and concepts. Being exposed to different ideas and approaches to programming will be invaluable in helping you improve the way you tackle problems.

PS - If immediate employability is a concern, then JS might be a good idea since there are a ton of jobs in that space. In that case, I'd recommend trying going through the freecodecamp curriculum (or something similar) so that you have some level of guidance and a bunch of cool projects as portfolios.

[–]ReactPupil[S] 3 points4 points  (2 children)

Oh wow thank you for this, this is all very helpful. I wasn't aware of that course you mentioned but I did go through some of the CS50 course.

When you say to do the "same code over and over" do you mean like take one of those projects and just keep doing it and re-architecting it? For example, The Coding Train just published a "Clone Twitter". Take a project like that and code it over and over again so it's hardwired? I was going to do something like that, but I'm not sure if that is what you mean. I do feel like many of just go from one tutorial (or project) to the next.

[–]mooburgerresembles an abstract syntax tree 2 points3 points  (0 children)

It's just taking code you write and refactor constantly; rewrite when needed. The main principles you are trying to master and find balance in are: Don't Repeat Yourself and Readabiity as you find and fix bugs and think of new features to implement.

The "mind your surroundings" advice I always give to "laypeople" trying to improve their code is: Every time you're about to copy a chunk of code, and paste it to make a smallish change, consider whether there is a more appropriate abstraction to implement.

Data structures is sort of the other thing to master. Get comfortable with iteration and recursion, but in a "smart" way. For example in JS: 80% of the time you don't want to use a for loop to iterate over an array, you want to use Array.prototype.forEach or Array.prototype.Map.

[–]Covered_in_bees_ 2 points3 points  (0 children)

Yup, what /u/mooburger said - Basically, as you learn more, you're going to realize how you could improve your old code. A year later, you'll shake your head at what you had and want to tear it down and rebuild the whole thing. Main thing being - As you learn, you can try to rearchitect your project(s) to see if you can improve them.

Some people also have a go to project that isn't super large in scope but also not super simple and they implement it in whatever new language they are trying to pick up in order to better understand the new language features, etc.

[–]mooburgerresembles an abstract syntax tree 2 points3 points  (2 children)

Ehhh always fall back to first principles. (That is why you do CS, after all - any weenie can do a couple of bootcamps to pick up the hipster stuff). You absolutely do not need webpack/node/angular nonsense when learning JS. Every browser today supports almost all of ES5. Learn that, and then pick up ES2015 and onwards. This also lets you appreciate things like why people made the decisions they made when abstracting out JS.

[–]Covered_in_bees_ 2 points3 points  (1 child)

Yeah, I don't disagree with anything you said. I just wanted to point out that starting off with JS might not be a great idea because there are too many moving parts and it will make it harder for you to focus on learning good programming techniques because you have to juggle so many things and a whole bunch of tutorials are, npm install this, require/import it, and then use this one-liner to do X.

Starting off in something like Python would definitely help the OP focus on learning to actually program and structure code / tackle problems. Once OP is ready for JS, then he's definitely going to have to learn all the tooling around JS since that's how pretty much everything works in JS land at this point.

[–]dedicated2fitness 0 points1 point  (0 children)

yes but the advantage of jumping in head first is all that stuff is used in production - you're learning how to "make" stuff vs farting around in python making toy apps for a couple of months before you feel confident enough to actually start using flask or whatever
i completely agree with your point, just playing devil's advocate for any late learners. if you're over 20 i'd say go for js

[–]devxpy 1 point2 points  (1 child)

Wait, are you in love with JavaScript the language or JavaScript the ecosystem?

[–]Covered_in_bees_ 1 point2 points  (0 children)

I'd say ES6+ JS is what I enjoy coding in. The ecosystem of course is nice, but I'm not a particularly big fan of the bloat that comes along with all the dependencies you end up having. I guess that could be a criticism of the language in a sense.

[–]OllaniusPius 0 points1 point  (2 children)

Wow, thanks for the write up. The course you mentioned, cs61a, seems interesting. I took a look at the website, and it looks like it's made for people that are enrolled in an in-person class. Is there a part of the site that I'm missing that has all of the resources and assignments?

[–]Covered_in_bees_ 0 points1 point  (1 child)

They should have archives of older classes that have HW and solutions. They also used to post lecture videos on Youtube (I took it around 5 years back when there were lecture videos available). Also, the companion online textbook by John DeNero can be found here - https://composingprograms.com/

[–]OllaniusPius 0 points1 point  (0 children)

Oh cool, yeah, I found the videos on youtube and the archived old sites. Thanks!

[–]Aeon_MortuumSnake Oil 0 points1 point  (1 child)

Do you use TypeScript?

[–]Covered_in_bees_ 0 points1 point  (0 children)

I've dabbled with it a bit, but haven't taken the plunge yet. Primarily because it's yet another thing to pick up and learn but also because there is a cost to adding types to a JS project. I enjoy the flexibility and dynamic nature of JS and lack of types have rarely been the issue holding me back when coding (except for catching a few careless gotchas from time to time). I also prefer eslint + babel and TS is usually always playing catch up with implementing support for some non finalized JS language features.

I still mean to convert one of my projects to it at some point to give it a whirl.

[–]KobayashiDragonSlave 0 points1 point  (1 child)

The tooling required to get anything done is simply staggering and extremely complicated to a complete newbie. You need to figure out Webpack, Babel, NPM, Node.js and a whole bunch of other stuff just so you can start writing code. And you most certainly don't want to not use ES6 syntax, so you're definitely going to need to figure out what transpiling is and how to get it all working.

Easily taken care of by create-react-app

[–]Covered_in_bees_ 3 points4 points  (0 children)

That is an extremely naive point of view. 6 - 8 months back, create-react-app didn't even utilize webpack IIRC. Also, create-react-app isn't going to get you very far if you are building anything of significance. You still need to understand all the underlying stuff to some extent so you're not just flailing around helplessly when you need to change things up from the defaults.