Live data from Hacker News

Advice to a novice programmer

blog.plover.com

31–40 of 158 posts

Re: Advice to a novice programmer

#31

This is great advice, although personally I will continue using vim over vscode. If vscode is a sharp kitchen knife then vim is a katana sword. Novice programmers should probably not start with vim.

I still don't really understand what Vim users see in it. They always seem to claim that you can edit faster... and sure you can if you're comparing with Notepad++. But modern editors have multiple cursors and tons of useful editing tools that let you be easily as fast with much less pain.

can you go a full 8 hour work day without touching the mouse?

edit: can you easily pipe the entire file through grep or awk, or insert the contents of the output of curl or jq?

Re: Advice to a novice programmer

#32

Regarding variable names strongly consider keeping the first variable name which comes to your head. It is simple, straightforward. I often see overly elaborate variable names where I know the author took their time to come up with it ending up with an abstract variable name which makes far less sense. Another tip for novice programmers: don't do leet code or watch random videos which talk about loops and variable na…

> consider keeping the first variable name which comes to your head. It is simple, straightforward.

That strongly differs from person to person, I am the kind of guy who immediately comes up with names like glass-hardness-at-temperature-in-centigrade-before-tempering before refactoring it to untempered-glass-hardness-at-centigrade.

> Instead watch or read about people building things.

Definitely watch/read those too, but there's nothing wrong with watching e.g. the MIT OpenCourseWare Structure and Interpretation of Computer Programs (SICP) videos.

Re: Advice to a novice programmer

#33

Earlier quoted context omitted.

I still don't really understand what Vim users see in it. They always seem to claim that you can edit faster... and sure you can if you're comparing with Notepad++. But modern editors have multiple cursors and tons of useful editing tools that let you be easily as fast with much less pain.

can you go a full 8 hour work day without touching the mouse? edit: can you easily pipe the entire file through grep or awk, or insert the contents of the output of curl or jq?

you do that in vim?

I do that in terminal (I'm a heavy vim user)

vscode subs for vim, not for the CLI

Re: Advice to a novice programmer

#34

Regarding variable names strongly consider keeping the first variable name which comes to your head. It is simple, straightforward. I often see overly elaborate variable names where I know the author took their time to come up with it ending up with an abstract variable name which makes far less sense. Another tip for novice programmers: don't do leet code or watch random videos which talk about loops and variable na…

> the first variable name which comes to your head.

I do this. I do it, but I will say it's not for everyone, including me. There have been a lot of "jimmy" and "pibbo" over the years. Keep the first name that doesn't embarrass you...

Re: Advice to a novice programmer

#35

Regarding variable names strongly consider keeping the first variable name which comes to your head. It is simple, straightforward. I often see overly elaborate variable names where I know the author took their time to come up with it ending up with an abstract variable name which makes far less sense. Another tip for novice programmers: don't do leet code or watch random videos which talk about loops and variable na…

The variable naming can be good advice once you get used to programming and have some experience at it, but I'm not sure I'd agree it's best for novice programmers. I've seen even seasoned programmers with garbage variable names, which I'm sure were their first instinct, that tell you nothing.

One thing I see a lot of in particular that I wish I didn't are variables that are overly abbreviated to save the programmer some typing (which there is autocomplete, so typing shouldn't be a big deal), to the point where you don't know what it represents without sitting there and decoding the code.

To make up an example that's similar to what I saw in a code review a month ago (I don't remember the exact example), what does "tpTr" stand for? Turns out it's the target position for the transition out animation, but I have no idea without chasing that variable around and seeing how it's manipulated. Just say what it does.

Or you might see a lot of generic variables like 'data' or 'obj'. Like what type of data or object? Yeah for a tiny function you can probably get away with something like that, but anything larger and you should have something on there to help specify it a bit more. And yet I see this in code I review as well.

Re: Advice to a novice programmer

#36
Speaking of using sharp tools…. I really don’t get the love for VSCode.

I’ve used Jetbrains for years and last week gave VSCode a really solid try.

Man what a mess. Everything is a plug-in, plug-ins are inconsistent, getting basic things to work requires a tsunami of plugins. Everything feels half baked and duplicated and needing updates or abandoned ugh.

Nothing feels professional because everything is a plug-in built by random person X or y or maybe some plugins are professional I don’t know.

And even when I’d plugged in as much stuff as I could find it still couldn’t do basic things like find and import node modules.

I abandoned the experiment and gladly went back to JetBrains where the tools are sharp, available and well organised.

Re: Advice to a novice programmer

#37

Regarding variable names strongly consider keeping the first variable name which comes to your head. It is simple, straightforward. I often see overly elaborate variable names where I know the author took their time to come up with it ending up with an abstract variable name which makes far less sense. Another tip for novice programmers: don't do leet code or watch random videos which talk about loops and variable na…

> Regarding variable names strongly consider keeping the first variable name which comes to your head. It is simple, straightforward.

Strongly disagree with this. Variable naming is so important if you want to write code others can understand.

The first name I come up with tends to be overly verbose/specific or too general. Variables named "count" are a good example of a name that's too general requiring a developer new to the code to ask, what is being counted? While "userUniqueVisitCount" might be too verbose when given the context perhaps, "visitCount" would be fine.

Just little things like that can really help a developer understand what's going on quickly.

Code structure is super important too though... If you're making too many abstractions it generally forces your variables and methods to be abstract and meaningless too. Your names should hint at this when there is a problem. If you find you need to use extremely verbose names to explain what a variable or method is doing, you likely have something structurally wrong with your code.

Re: Advice to a novice programmer

#38

> ... start in VSCode... set aside time to do some tutorials... Read a vim tutorial. Sheesh, I'm an emacs user and I think it's the greatest thing since sliced bread but I don't go around telling newbies that they should use good tools. vim's great. If that's what works for you, stick with it. You'll learn how to work with it eventually.

You don't even have to read a vim tutorial. The tutorial is already baked in.

I learned vim by doing vimtutor every couple of months to learn more advanced features after getting basic navigation and editing motions down and forcing myself to use it for as much of my work as I possibly can.

Learning vim early paid dividends in terms of productivity and also by forcing me to learn more about how to actually leverage other coreutils around vim to get the most out of it.

The path of learning that way from the start is slower and more difficult, but the skill ceiling it unlocks is much higher in the long run imo.

Re: Advice to a novice programmer

#39

Speaking of using sharp tools…. I really don’t get the love for VSCode. I’ve used Jetbrains for years and last week gave VSCode a really solid try. Man what a mess. Everything is a plug-in, plug-ins are inconsistent, getting basic things to work requires a tsunami of plugins. Everything feels half baked and duplicated and needing updates or abandoned ugh. Nothing feels professional because everything is a plug-in bui…

100%. I'd be using jetbrains stuff right now if I wasn't experiencing weird inexplicable issues with Rider in the .netcore stack. Legit the first real issues I've had with their stuff in over 10 years.

Re: Advice to a novice programmer

#40

This is great advice, although personally I will continue using vim over vscode. If vscode is a sharp kitchen knife then vim is a katana sword. Novice programmers should probably not start with vim.

The biggest mistake I made when learning to code was trying to do it with vim.

Get an IDE, I suggest JetBrains.

I use vim everyday day as I work on Linux systems copying code and writing scripts and things but it should not be your primary development tool, certainly not for novices.

Post reply on HN