
Ask HN: How to become a better programmer? - ashhimself
This post has been inspired by https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8697772 (Ask HN: How or where to begin learning mathematics from first principles?)<p>I would describe myself as a semi competent programmer but I would say I am more on stack overflow looking for solutions to my problems then actually fixing them myself. I tend to understand examples of code more than actually reading the documentation. Is there a book or website I could follow which would make in time a more competent programmer that an organisation would want to hire?<p>What I am doing now.<p>- Programming daily and better learning how best to use cakePHP.
- Following some courses on code school (Particularly Angular
======
Softly
So, in my eyes, competency in programming isn't about knowing everything there
is about programming. It's about finding knowledege. There's no shame in
looking for similar problems on stack overflow (so long as you don't directly
copy if you're in a place which that sort of things matters) and you slowly
start to see patterns in your problems, which makes you look a lot smarter
than you actually feel.

Unfortunately, you do need to get good at reading doc and code examples.
Thankfully you generally get both, but not always.

Having some SysAdmin knowledge goes a long way; terminal command on Windows,
Mac and Linux can be a real life saver when all the fancy GUI stuff fails.

The best way to get experience is to actually get involved in coding something
medium to large. Its not easy just to jump in, but a lot of open source
projects can have some very easy bugs to fix.

To help with recruitment, I add everything I can to github. Even if its bad
code it will at least show improvement if you keep going with it (I still
cringe at my first attempt at python).

A friend of mine wrote a book about getting hired (helpfully titled "Getting
Hired") in the computing industry, it offers some great advice about the
employability side of things: [http://books.stuartherbert.com/getting-
hired/](http://books.stuartherbert.com/getting-hired/)

Hope that helps!

------
onion2k
If you want to be more employable then you need to concentrate on the skills
that _aren 't_ coding[1]. Develop your communication skills, your organisation
skills, being a better fit in to company culture (going for drinks with
coworkers for example). Faced with two candidates who can both do the job,
pretty much every hiring manager will give the job to the person who'll be
easy to work with and a better fit in the team than the person who can write
fancy code.

[1] Assuming that you _can_ code. If you can take a spec for a site and turn
it in to working code then you're already good enough.

------
mc_hammer
try programming a multiplayer game - they encompass all things computer, to a
more thorough degree than other things, for example security - anybody can
make php site, but can you make on that cant be exploited, the players cant
make a cheat and fly around or they players cant keep spawning items they
want, its a challenge even for senior devs.

a game has: packet level networking, multiplayer, graphics, direct input from
keyboard/mouse, security or anti cheat, copy protection, server/client model,
physics or collision detection, video integration or codecs, oop, modules or
libs, etc...

and you get to optimize your game (and to see time you optimize, how much each
tweak changes the FPS)... it might even be mandatory to optimize your game...
whereas with php if its not fast who really will notice. at least thats my
thinking -- also its very possible to make a web based game with
cakephp+websockets+angular.

what do u think?

------
rtwste
I don't find "courses" useful really. I prefer following the intro guide for a
technology (let's say Django) to set up something simple like a blog. Then try
make something more complicated using Stackoverflow and other online resources
for help.

------
_RPM
Take all the advice here with a grain of salt. Start programming everyday. The
language you use is irrelevant.

------
codenut
always be coding

------
smt88
Same way you get better at anything: practice!

Here are some additional tips:

1) Learning to code has a lot to do with how well you Google things and how
easily you give up.

Needless to say, you should be great at Googling and not give up easily.

2) Break new things into smaller chunks.

If it seems like something is too hard, figure out the first step. Google it
if you can't do it yourself yet. Then move on to the next step.

Every program can be distilled down to very small, very simple parts that are
then assembled into something more complicated. It doesn't matter how
complicated the end result is: the basic parts are still the same.

(Note that this always applies to web development, but not always to lower-
level stuff.)

3) Stop using PHP.

It's inconsistent, and it has these weird mashups of features from other
languages that add to the confusion. It is harder to learn other languages
when coming from PHP.

I think that Go is a great language to learn on because it's simple,
consistent, and explicit. By explicit, I mean that there isn't a lot of
"magic" going on underneath your code.

You may also want to check out Python, which has some weird "gotchas" (e.g.
inconsistent naming of iterating functions), but is mostly a good learning
language.

Java is the traditional beginner's language, but that philosophy has come
under fire. I still think it's a good way to learn fundamentals, though. Java
has a lot of vanilla implementations of concepts from object-oriented-
programming theory.

3b) If you continue to use PHP, turn on strict errors when in development
mode. Also use phpStorm (not free) or NetBeans (free). They understand PHP
shockingly well.

Using a good IDE is surprisingly vital to learning and coding quickly. You'll
want to be able to CTRL+click on classes/methods/functions to go to their
definitions (among many other useful shortcuts).

4) If using PHP, Ruby, Python, or Node, learn how to write unit tests and
start writing them.

This is incredibly important. They're not that fun or interesting, but you
_need_ to get comfortable with them. Not only do they make you much faster at
finishing an app, they also make you a better programmer by forcing you to
write only testable code.

5) Learn what the following mean and make them your religion (Google is your
friend here):

\- (Related to #4) Test-driven development

\- "Premature optimization is the root of all evil."

\- DRY (don't repeat yourself)

\- Principle of least astonishment

\- "You aren't gonna need it"

6) Always have a mission.

If you get up and say, "I'm going to learn how to make a single-page app
today," you're not going to learn it. You need to have a real, finished
product in mind.

That's what professional coding is (plus getting paid), so that's what you
should practice. Many of the philosophies I mentioned above actually require
knowing what you want to accomplish.

So as you go through your life, think of apps you want to create and write
down your ideas. Don't remove ideas because they're hard -- remove them
because you're not interested in them anymore.

7) Look around at different APIs.

There are a ton, and you can mash them up in really interesting ways. There
are APIs for payments, text/video/instant/audio messaging, cars, movies, maps,
places, government data, weather, finance, _and so many more things_.

There are countless projects you could put together in a weekend that use all
of these different APIs. Do it for fun or profit, but make sure you learn how
HTTP APIs work! (Strict REST APIs are a fairly rare subset of HTTP APIs, but
you should definitely understand REST principles, as they pop up everyhwere.)

8) Ask the right questions.

Don't ask "how do I do [x]?" on Q&A sites or forums. You can just Google stuff
like that. "How do I write cookies in JavaScript?" There are a million
answers. "How do I send an HTTP request in PHP?" Again, a million answers.

If you really want to grow, take chunks of your code that are clunky or
inefficient and ask people if there are better ways to write them.

So instead of saying, "how do I do [x]?", say "I've done [x] like this. Is
there a better way to do it?"

That's how you learn. You're basically turning the anonymous experts in those
communities into your personal mentors.

9) Seriously think about taking some classes.

Fundamentals are important and will save you lots of time and Googling. I'd
highly recommend a class on relational databases as well.

I don't know anything about boot camps, but if you try one out, make sure you
"Ask HN" about it.

~~~
ashhimself
Thanks so much.. I really am thinking of switching from PHP, I really do agree
with about improving chunks of code.

I have a to do list of functions that i'd like to program again because I
think the way of I have done it is either totally inefficient or simply the
worst way of doing it.

