

Five Ways To Write Better Code - tnorthcutt
http://www.brandonsavage.net/five-ways-to-write-better-code/

======
dbecker
It is widely recommended that learning a new language will improve your skills
with languages you already know, and I've never heard anyone contradict this.

But I've never noticed this in my experience. Moreover, whenever I come back
to a language after any time away from it, I'm amazed how much time I spend
remembering (or looking up) superficial differences.

Stuff like looking up whether I get the length of a vector with "len" or
"length" (for a language I already knew) just feels like a distraction.

~~~
cschneid
One thing I'd suggest is to learn a vastly different language. If you use ruby
all day, learning python probably won't give you the type of insight that
learning C would. Or learning a lisp.

So much is looking at things in a different way, and a quick way to do that is
by picking something across the metaphorical language town, rather than the
language next door.

~~~
viscanti
Exactly. Although I've found it helpful to learn similar languages too (i.e.
more than one scripting language). Seeing how subtle differences in the
languages play out (beyond the superficial len/length type differences) has
helped me understand some of the more subtle concepts of computer science.
That said, you probably get the most bang-for-the-buck by picking up a
language with a fundamentally different programming paradigm or at a lower or
higher level than what you already know.

~~~
brandonsavage
Languages exist to solve certain classes of problems. PHP, for example, is
primarily designed as a web language. Learning ANY language designed for other
uses will teach the developer something new. Once you have learned something
like Python or Ruby, learning C would probably be the next logical step.

------
adam-a
> 3\. Fix bugs in the open source projects you use.

> I’ve never taken a hard look at the Apache source code before, but I have
> found a few bugs in Apache that I’d love to have fixed

How can you take this advice if the author doesn't even follow it himself?
Seems like a shallow recycled piece designed to promote the author's eBook.

~~~
jlkinsel
What's the Apache source code?

You mean Apache httpd? :)

Realize "Apache" means the Apache Software Foundation, which is made up of a
large collection of open source projects.

(disclosure: Apache CloudStack contributor and PPMC member)

~~~
ternaryoperator
I understand and generally agree with your point. However, if we're going to
slide and dice, it should be pointed out that the Apache Software Foundation
(founded in 1999) was named after the Apache web server (1995), not the other
way around. So, if the context clearly suggests the web server, as it does
here, I think he's OK.

------
jlkinsel
I've become jaded with "top 5" style lists recently, but this one's pretty
nice. I'm doing a few "secure development" training sessions with development
teams in the next week, will be referencing this for sure.

I'm not sure writing tests makes you a better developer...gives you better
habits, but not sure it results in your code being better, compared to things
like fixing bugs in others code and learning a new language.

The learning a new language holds true past software development - when I
learned Spanish in high school, my understanding of some of the stranger forms
of English (say, past participle) improved.

~~~
brandonsavage
I have to disagree with one point: that writing tests doesn't make you a
better developer. Here's why:

Writing a test requires you to think about your code in different ways than
just creating it. TDD requires you to plan your code. And the more code you
write, theoretically, the better your skills will be.

Now, will it make you the best developer? Probably not. I doubt writing tests
is the most productive use of time. But for the practice of software
development, writing tests is critical.

------
larsmak
Also, write lots of code! If you're stuck with legacy-code, start a hobby
project that you think might be useful to someone (if you're not stuck with
family that is, then there's really no hope).

------
danso
How about getting into the habit of writing tests? First, they're code
themselves. Second, it really forces you to think about interfaces and
coupling.

Third, it's a nice habit to have if you work on a larger project.

