Monday, December 2, 2013

Why new developers should write crappy code.

Some things about development are not taught in college, some things about development are not even taught on the job. Some things you are just "assumed" to know, almost as a 'gut' instinct. You can take every great tutorial on How To Code and memorize all of the "Best Practices" but that is no better than simply memorizing the answers to a test in school. At the end of the day, what did you truly learn? What do you really know?

As a junior developer working on a team with a lot of senior developers, I get to spend my lunches listening and learning from them and I am very fortunate and grateful for that. Yes, I got hired  from a very blue collar background of shoeing horses for a living with no college education and although that's great I am painfully realizing that I am lacking any 'gut' instinct. I had simply memorized enough of the 'test' answers to get hired.

How does one develop a true 'gut' instinct for knowing how and what to code? Everyone will give you all sorts of different answers from: You'll get there eventually to Never look stuff up to Always look stuff up that you don't know. I think the answer (at least for myself) is writing crappy code and making tons of mistakes. I think we should encourage young developers instead of learning everything about the best practices with methods right off the bat. Just try to make a little command line game, like Hangman, without using ANY methods.

No longer will the conversation be: "What's the reason why we do 'x' like this or that?" or "What's the best practice?". Young developers will truly KNOW what not to do, and will instinctively go towards better ways of making the code better especially if they know an experienced developer that they can go and ask questions which can also help prevent bad habits.

I know for myself if I don't know why I am doing something I am going to try to make a program not using the thing I don't understand and see what happens. For the last few weeks everyday after work in the evenings, I fire up the text editor and just start making things. I know without time pressure or this is the only way to do it mentality. I have learned so much and am having a BLAST!

I am slightly embarrassed to admit that at lunch today I showed a program that I made on my own time that was giving me an error to a very senior member of our team and the first thing he said was: "Josh this is bass backwards!" and showed me why I was getting the error. That lesson today at lunch clicked in my head and will not be repeated because I had spent an hour last night trying to make the program work.

I know at least for me in my free time I am going to be writing code and enjoying the whole learning process without worrying about if it's the perfect way. I don't think new developers should write experimental code like this obviously in ANY sort of production code base but I think young and upcoming developers shouldn't be pointed to just tutorials. They should just make something on their own regardless of how crappy it is. I think that is how a true coding 'gut' instinct is born.

5 comments:

  1. The reason (well, one reason) "crappy code" is worth suffering through is that it helps develop one's ability to find bugs, and eventually to *see* bugs almost subconsciously, and finally to incorporate those lessons into planning how to write new code in the first place. It's like learning to make pancakes. (If you don't know how to make pancakes, go find one simple recipe, read it quickly, and start cooking. Iterate until the pancakes are edible, not chewy, not heavy, not burned, not too sweet, not too bland, not ugly, and so on.)

    ReplyDelete
    Replies
    1. I agree with you, good analogy :-) It certainly is how I really "get" things and understand new concepts versus just reading a book and doing the exercises...thanks for the comment and for reading!

      Delete
  2. As a long-time developer I can affirm that you've found the secret sauce: code constantly and always attempt things you don't know how to do. It makes sense that a blacksmith would figure this out, I'm sure the first thousand or so times you swing that hammer must be sheer torture, but you realize you'll never get there just by looking at the anvil and dreaming. Programming is like that too.

    ReplyDelete
  3. Brilliant Article, thanks was worth reading, now I am going to open VS2012 and fuck some shit up lol :P

    ReplyDelete