iPhone Development →← Zend + AMF

Tips for new coders

The comments in this discussion are priceless. They’re language or platform specific at all — for you folks out there looking for how to learn quickly, get better as a coder and thrive at a new environment, this thread is a must read.

I’m expecially a big fan of:


std::string mkdec(std::string x) // Converts x, a string representing a hexidecimal number, to a decimal string.

vs.


std::string convert_hex_string_to_decimal_string(std::string hex_string)

These methods do the same thing, but the latter example is unquestionably better, as it is simultaneously a method and a comment rolled into one. You won’t forget what that method does no matter where it shows up in your code.

September 26th, 2008  by Jamie  /  3 Comments

Comments on “Tips for new coders”

  1. I’ve found that using one or the other exclusively this way gets too cumbersome on one hand and too non-intuitive on the other. Cumbersome mostly just when you need to string methods together for whatever reason, and non-intuitive for obvious reasons.

    I’d prefer to mix and match a little, having at least a relatively self explanatory method name mixed with comments that provide more details.

    For example..

    std::string hex_to_decimal_string(std::string hex_string) //Converts hex string to decimal string

    vs

    std::string convert_hex_string_to_decimal_string(std::string hex_string)

    This works for strictly typed languages best, as you can usually infer what type is being played with.

    Dustin Sparks on September 26th, 2008 at 2:43 pm
  2. This is the tip??? That’s IT??? Waaaw…I wish i could say this helped me in some way but it doesn’t in the slightest. This was written from the perspective of someone that really understands what it is and what it does. For someone new to coding they’d be like “huh?”.

    Anpu on September 27th, 2008 at 1:28 pm