by armchairhacker · 4y ago · 0 comments
Don't know how to setup node.js? Google should lead you to `npm init` or a starter. Getting some weird syntax error? Google it. Once you learn the basics, want to do X? Google it and determine a) how to do X, or b) if X can't be done / is bad practice.
Just by diving head-first into whatever you're trying to accomplish (or a toy project if you just want to learn), eventually you'll start to get the hand of syntax, libraries, and general programming style. But read articles every once in a while on best practices so you aren't learning the "wrong" way to do things.
The big drawback is that there are a lot of Google results that are outdated, novice, or flat-out wrong. You have to really learn how to do research on the internet. But this is a skill you should learn because you can apply it to anything. My general advice: consult official docs whenever possible; Stack Overflow is reliable but check the answer's comments to see if it's outdated; use Reddit to compare X vs. Y; try to avoid long wordy articles on bloated sites, generally the better the writer = the better the article and more likely it's accurate.
Sometimes you have to engage with someone else to solve a problem, but there are hundreds of people willing to do just that at literally any given time of day.
For context, I use javascript & basic html css to make simple apps for my own use. apps.bydav.in
One "patience" problem I have is that problems are usually much more complex than they appear. Node is giving you some random dependency error? It's because you need to install X. But to install X you need to install Y. But to install Y you need to install Z. But Z requires some specific node version. But that specific node version will break A, and to not break A you need to install B which requires you to disable your Mac's SIP so that it can work with X. If I sniff that I problem will lead me to a hole like this I get so annoyed that I start avoiding that specific platform as much as I can.
Software is so fragmented nowadays that even setting up something simple requires you to handle tons of difference pieces for no good reason. Monopoly aside, this is one reason I like Apple having full control of iOS development.
I recently discovered Vite (with pnpm) and so far I haven't had any annoying JS/npm/engine issues, so that would be my recommendation. Generally to setup something I either a) run `<build-tool> init`, b) "create new project" in IntelliJ, or c) clone a medium-sized project on GitHub, then remove the code and leave the configuration files.
For the parent: Java is completely different to JavaScript - the similarity is an accident of marketing and an original vision of the Web (in which most code was written in Java not JavaScript.)
If I pick up something new and just try to piece things together using a sample project or whatever, I tend to think in ways from the most familiar language I work in.
Also without familiarity, you can’t judge if the sample you picked is super opinionated or does things in a weird way.
Javascript traditionally had NO good language guides, and this one looks pretty like the one you should read in advance. Other resources are either more library reference-like, very situative or for unclear standard, not exhaustive, or just stupid and wrong. I’ve read a language guide A to Z for every PL I used in my life (a bunch), and can say by skimming through few rough/key topics that it is definitely a good one. No offense, but my advice is to not apply your advice when there is a good guide. You’ll save both your own time and the one’s who will come after.
nowadays I usually refer to MDN docs and one of the guides like above when guidance is needed.
In my experience, this is a terrible advice. However, many of my students follow this advice over my protests and only a handful of them actually learn anything at the end of a long masters program.
a) "I learn what I need to accomplish this task". This is observed as question/answer and only the simplest version of the answer is needed. So something like "how do I create a variable x and assign 10 into it. All he's looking for is x = 10
b) The second kind wants to understand the nuance of what's happening, so they can apply that nuance to future code. They are looking for an answer, but the are interested in the working that leads to the answer. So in the above example they want x = 10 var x = 10 let x = 10 options{x:10}
and so on. They digest when to use one and when to use another, and they delight in using the correct form in the correct place.
In my experience (a) programmers will get through tasks quickly, but with shallow understanding. They will eventually have all the tools, but lack the ability to see the big picture. They struggle to read other people's code.
On the other hand (b) programmers learn much more slowly, they take a lot of time to accomplish tasks because they are being distracted by their curiosity. But after that investment they easily outstrip their peers in productivity, and more importantly can do things that an (a) type programmer can never do.
What I've come to accept though is that giving a (b) answer to an (a) questioner just leaves them confused. They asked about assignment, and a discussion of scope just leaves them befuddled (since they don't know what scope is anyway). Which can be frustrating to the answerer who is a type (b).
Type (a) should not be doing a Masters program in the first place, so I feel your pain in that regard. Google is great when you're out in the world, but it's a terrible way to "big picture" learn.
I've [1] adopted the approach of meeting the student where they are answering their question, then trying to take them one step further. I try to encourage good habits, and at the same time ceasely mock bad habits (in a gentle, running-joke, kind of way.)
That said I also demonstrate the use of Google in answering a bunch of questions, for which the internet is overflowing with answers. Google is a fantastic resource and there's a lot of great stuff out there.
[1] I am not an academic, and my "students" are not in school. They are typically professionals, trained in another discipline, who were around when computers started, and there was no software so they had to write their own. They have 40 odd years of programming experience, but usually with zero formal training. Seeing individuals in this age-group make breakthroughs though is immensely rewarding.
The most important thing impatient programmers need to learn is TO NOT BE IMPATIENT, not how to learn a programming language in X minutes.
Learning patience will help you in all aspects of life.
Do you really want to share the road with somebody who learned to drive in 5 minutes, and doesn't have the patience not to speed, tailgate, run stop signs, red lights, and pass you on the right by driving on the sidewalk?
More "real" advice: Read LOTS of other people's code.
Need to use a library? Then first read the documentation, then read the source code, so you actually understand what it can do, how it does it, that it's not magic, what its limitations are, how to use it, and if you actually need it.
I've been working on learning and reading the D3 data visualization library for several years, bit by bit. It's a wonderful library, there's a whole lot to it, the code is brilliant and expertly written, and I've learned a LOT about JavaScript programming in general by reading different parts of it again and again.
Mike Bostock: 10 Years of Open-Source Visualization: Did I learn anything from D3.js? Let’s see…
https://observablehq.com/@mbostock/10-years-of-open-source-v...
>In honor of D3 1.0’s tin anniversary, I thought I’d reflect on lessons learned. This isn’t intended to be too comprehensive or serious — just a handful of observations as I look ahead to the next ten years. But I hope a nugget or two will interest you, too.
HN discussion:
That's the opposite of thread OP's advice. If you need to use a library and you're impatient, find the closest example to what you want to do and then hack away at it until it does what you want.
>But read articles every once in a while on best practices so you aren't learning the "wrong" way to do things.
>The big drawback is that there are a lot of Google results that are outdated, novice, or flat-out wrong.
>My general advice: consult official docs whenever possible
After you read the official docs, and decide you actually want to use a library for something that's not trivial, one-off, or throw-away, it will benefit you to actually read the source code itself, which is by definition not out-of-date and incomplete, like so many of the articles about the library you can find by googling and reading stack overflow.
In my book, hacking away at using a library until it does what you want involves reading the source code in the developer tools by setting breakpoints and browsing the call stack, function definitions, local variables, and data structures, while the code is alive and running.
Once you've done that, it's a lot more interesting and easier to then read the entire source code on github front to back, to learn the library well, because you will have a lot more context about how it's actually used and fits together, its dynamic runtime behavior, and the shape and texture of its objects and data structures.
And the most important advice, in my opinion, is to expect to write a LOT of garbage code that you replace almost immediately. It’s not like pouring concrete. You’re not wasting your time or code. It’s a learning process and once you’ve written it, you’ve absorbed all the good and bad lessons from it.
I struggled a lot with paralysis where I refused to even begin a project until I could see the “right way” to get to the finish line. But now I just do a tiny little bit of design (for toys and personal projects) and then dive in.
There’s no better way to deeply understand why a certain concept is important than doing it wrong and suffering the consequences.
For someone who knows the J's basics , I mean
But my recommendation is Firebase or Supabase. These tools were basically designed for this type of webapp. I know a team of junior devs who created a production-app in a few weeks with Firebase. Firebase handles authentication, the database REST endpoint, and various other common webapp functionality, so that stuff is seriously achievable in hours. In Supabase "signup", "login", "login with provider", "send reset email" are all single JS functions.
It would take 5 or 10 minutes (npm install taking up the majority of that time)
Other languages have some of that sprawl, but none quite to the same level, and none with the same pace of change.
If you learn like me, my advice would be to have a list of potential candidate projects to learn from and move on to the next one when the tool and dependency hell proves too much.
The third project I went with went much better, though it was still difficult to learn things (even if they are working) as every project seems to choose different build/deploy tools.
So maybe you're right. Perhaps everything is terrible everywhere.
I used to keep a paper copy of “JavaScript pocket reference” on me, and pull it out on the train, or just sitting around at night, to help get the concepts.
Go ogling it leads to being told to use os package managers, which do the wrong thing
So nothing will replace the experience of pain when learning.