Live data from Hacker News

Articulate Coding

casestatement.tumblr.com

11–20 of 29 posts

Re: Articulate Coding

#11
Interesting. But from the heading I thought this was going to be about something else. Articulate coding could mean 'using bigger words' in the sense that you'd refactor your code and use built-in functions wherever possible.

Point being that most people probably don't get the most out of, say, Python's standard library.

Re: Articulate Coding

#12
Sometimes I find myself doing this in a small way right after I deploy a new product version or feature. My mind is open enough to take in some of the decisions that were made to get to that point.

Re: Articulate Coding

#13
I understand the point of the exercise and I can see that an individual coder might gain some benefit from this.

However, in a professional environment you would expect that the lead developer(s) had already given this stuff a lot of serious thought and enshrined it in a coding standards document for every member of the team to follow.

Re: Articulate Coding

#14
post #8

As a novice programmer, I found this article to be a good bump towards thinking for myself. Too often I find myself doing something because its what the tutorial or book I was reading said was best practice, without really thinking the situation through. Being able to explain why you are making the decisions that you make seems like an important step between just haphazardly piecing together snippets of code you memo…

Hooray! That's a big step toward becoming a better programer. (I've worked with programmers with years of experience that still just slap code together.) Your comment also painted the article in a new light for me. Perhaps doing this level of documentation would make a good exercise for newer coders. Maybe on a smaller scale - document every token in this method, or similar. I'm going to figure our a way try this now, thanks. :)

Re: Articulate Coding

#15
These 12 points seem to be the most insignificant things you can think about your code. Indentation? Camel case? Come on... mastering WRITING code will not make you a good coder. It will make your code consistent, I'll concede, but there's nothing stopping your from writing consistently bad code that looks good. Wouldn't it be more fruitful to think things like: 1) Why did I write this code as one function? 2) Should I not write this query in a loop? 3) How much memory will this array take to store? 4) Will I understand this code 3 months from now? 5) Is this code readable without comments 6) Would commenting this block help the reader understand my intentions? 7) Should this be a class, and if so, how complex will it be? 8) Can I make this code reusable?

Re: Articulate Coding

#16

These 12 points seem to be the most insignificant things you can think about your code. Indentation? Camel case? Come on... mastering WRITING code will not make you a good coder. It will make your code consistent, I'll concede, but there's nothing stopping your from writing consistently bad code that looks good. Wouldn't it be more fruitful to think things like: 1) Why did I write this code as one function? 2) Should…

The two go hand-in-hand. Writing articulate easy-to-read code does not mean it precludes thinking about the things you mention. You could be the best (according to your criteria) coder in the world, but if your code is unreadable, it will quite literally waste others' time. This might not seem like a big deal with a smaller project, but scale to something the size of the Linux kernel or larger and it begins to become an issue.

http://www.kernel.org/doc/Documentation/CodingStyle

Re: Articulate Coding

#17

I understand the point of the exercise and I can see that an individual coder might gain some benefit from this. However, in a professional environment you would expect that the lead developer(s) had already given this stuff a lot of serious thought and enshrined it in a coding standards document for every member of the team to follow.

A good idea is to check for certain style issues which you want to enforce and are easy to catch at checkin time. You can enforce things like no real tabs, line width, no trailing spaces, etc and make the person checking in the code get rid of it. Usually once it winds up in VCS[1], it is harder to go back and clean it up. People make mistakes all the time, and tools are scriptable.

[1] Or do it at merge time if your setup involves pushing to a "work" repo which is merged to the real codebase later.

Re: Articulate Coding

#18

These 12 points seem to be the most insignificant things you can think about your code. Indentation? Camel case? Come on... mastering WRITING code will not make you a good coder. It will make your code consistent, I'll concede, but there's nothing stopping your from writing consistently bad code that looks good. Wouldn't it be more fruitful to think things like: 1) Why did I write this code as one function? 2) Should…

The two go hand-in-hand. Writing articulate easy-to-read code does not mean it precludes thinking about the things you mention. You could be the best (according to your criteria) coder in the world, but if your code is unreadable, it will quite literally waste others' time. This might not seem like a big deal with a smaller project, but scale to something the size of the Linux kernel or larger and it begins to become…

I've rarely seen such poor code visually that it made it hard to follow - except in the rare case where someone commits line breaks incorrectly. Camel-case, underscores, indentation etc.. do not vary so widely as to prevent me from understanding code. What does prevent me from understanding code is 5-10 nested if blocks and insane logic checks without commenting.

Have you actually experienced a coder that writes good code but writes it in a manner that prevents you from understanding it? I'd love to see some actual code samples.

Re: Articulate Coding

#19

These 12 points seem to be the most insignificant things you can think about your code. Indentation? Camel case? Come on... mastering WRITING code will not make you a good coder. It will make your code consistent, I'll concede, but there's nothing stopping your from writing consistently bad code that looks good. Wouldn't it be more fruitful to think things like: 1) Why did I write this code as one function? 2) Should…

This is a great comment. I worried that my example was too simplistic, it's difficult to bring up design decisions (as opposed to coding style decisions) without context. For many of my questions, you'll write them down, understand them and move on to deeper questions. However, they weren't all about consistency. I think naming is particularly important, drives design, and is often overlooked.

But the exercise shouldn't stop there, as your program develops questions like yours should be asked and understood and defined. The more questions you can ask yourself, the better you'll understand your thought process.

New developers might not get far past my list. Most devs might ask some but not all of your questions. The best developers will realize more fundamental questions to ask about their decisions. Hopefully everyone can learn something new by asking those questions.

Re: Articulate Coding

#20

I understand the point of the exercise and I can see that an individual coder might gain some benefit from this. However, in a professional environment you would expect that the lead developer(s) had already given this stuff a lot of serious thought and enshrined it in a coding standards document for every member of the team to follow.

I have a copy of Code Complete on my desk, it is 915 pages long. The techniques in there have been gathered from years of experience and research. There's no way I'll ever absorb all of the knowledge in there, but some of it may stick. When I write code I might unconsciously pick out a technique from the book, yet later on I'll miss the opportunity to apply the same technique again. If I better understood what I was doing the first time, I'd be more aware of it later.

Now, you're right, the easiest questions (as in the article) to answer can and should be encoded in standards document. But there are many many questions to ask and some are highly dependent on context and don't belong in standards documents. Maybe some of the existing standards that you thought you understood are really just there by convention and could be improved.

Post reply on HN