Slashdot Mirror


What To Do Right As a New Programmer?

globeadue writes "My company just tagged me for full time App Dev — I've essentially never coded for money, but the last 3 years of support desk gives me the business sense to know the environment I'll be coding for. Now my company will be training me, so I think the technical side of things will be covered, what I'm looking for is best practices, habits I should/shouldn't develop, etc as I take on my new craft."

5 of 662 comments (clear)

  1. Document your code by TheSpoom · · Score: 5, Informative

    Tab out everything in a code block. This should be obvious, but you'd be surprised how bad some stuff is out there. And try not to put in too many one-line ifs without brackets delimiting the code block... you can easily make the mistake of thinking something should be in the if's scope but isn't becuase there are no delimiters.

    Comment. Comments are incredibly, incredibly important. They kinda go along with an overarching "don't be a douche" rule; while you may know what's going on in your own code, if it's at all complicated, tell the reader what it's doing. If you don't, someone is going to be very pissed at you later. If you want to go above and beyond, do Javadoc (or other style appropriate to your language) comments where appropriate; a lot of IDEs actually hook into them so you can highlight a method and see what it's doing.

    And try looking at / working on some open source stuff as well. The big apps usually have a coding style they follow throughout and aren't that bad for a reference.

    --
    It's better to vote for what you want and not get it than to vote for what you don't want and get it.
    - E. Debs
  2. Stay away from the vending machine! by Anonymous Coward · · Score: 5, Informative

    Eat healthy and exercise. Pack your lunch or buy real food instead of the overpriced over-caffeinated junk in the vending machine. You'll save money and feel better.

  3. Re:Go with the flow by jd · · Score: 5, Informative
    On the other hand, there are some universal rules:
    • Plan/Design everything
    • Document everything
    • Version control everything
    • Test everything
    • Deny everything
    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  4. Some tips by sukotto · · Score: 5, Informative

    Here are a few tips off the top of my head.

    * Learn how to use your company's version control system.. and *use* it

    * Comment your code and be smart about it.
    That is... Keep the signal/noise ratio of your commenting as high as possible.
    Comment the big picture and a description of what tricky bits of code are supposed to be doing (and why). Not commenting trivial things.

    * Avoid putting tricky bits in your code :-)

    * Never assume that some code you write is temporary. Lots of mission-critical systems started off as a "temporary" project.

    * Always try to write the best code you can, even if it's just a little one-off (see above point)

    So, that means making sure your function names, variables, etc all have intelligent names. Each block of code does one thing. Each block of code is small (try to keep it on a single printed page, including all whitespace and comments)

    Avoid using global variables, gotos, tightly coupled code, code that messes with the internals of objects/data-structures, etc.

    * Set up a little svn server on your workstation for all those little snippets of test code you write. You never know when you're going to want to go back and look at that stuff again.

    * Read other people's code. Try to figure out if it does what it's supposed to do.

    * Get a good IDE and learn how to use it really well. Use the same one as the majority of your dev team (unless it really sucks).

    * Make yourself as FAST as possible. If you're really fast/efficient then you have more time to think and solve problems:
    - Learn how to type. seriously. get a typing tutor program and do 30 minutes a day until you can touch type as fast as you can speak.

    - Learn the hot-key combos for your programming environment. You won't believe how much faster you'll be.

    - Stop using your mouse for common tasks.

    - Use code templates everywhere you can get away with it. Every time you start a new file, every time you write a new function

    - Learn the idioms of whatever language they have you using. You should never have to stop and think about common constructs in your code

    * Keep a spellbook. If you learn anything cool, interesting, or elegant. WRITE IT DOWN. By HAND I know it sounds stupid, but it really helps

    * Learn how to accurately estimate your time. For everything you're asked to do. Write down how long you think it will take (in hours). At the end of the task, or the end of the workday, track how much time you've currently put in, and how much more you think you'll need. (Never modify your original estimate). Then, when people start asking you to estimate how long a project will take you'll have some historical data to help you come up with a realistic number.

    Pro tip... when you're starting out. Multiply all your estimates by 3. Newbies are usually way too optimistic

    * Read. lots
    Read books on the language your company expects you to learn. Try to also read general books on programming, design, project management, etc. Try to understand the big picture of your project as well as the nitty-gritty of the part you're working on.

    Some good books to get you started
    - Code Complete
    - Pragmatic Programmer: from journeyman to Master
    - Programming Pearls
    - Joel on Software book
    - Mythical man month
    - Getting Things Done

    * At the end of each project, keep a log of what the project was called, what it was for, who it was for, and what you did to contribute. You can also jot down what language you used, what gotchas sprung on you, your estimate accuracy ratio, etc.

    --
    Come play free flash games on Kongregate!
  5. Re:Always think about maintenance by enkidu · · Score: 5, Informative

    Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?
    - Brian Kernighan, "The Elements of Programming Style", 2nd edition, chapter 2

    --

    There is no trap so deadly as the trap you set for yourself
    -Raymond Chandler, The Long Goodbye