Tuesday, October 8, 2013

What Makes You a Better Programmer?

I wrote previously about my dip into the pond of programming after taking a bit of a hiatus.

Every time I look at the lines of code I've written I question whether there was another way I should have done it a different way. Should this be in a subroutine by itself? Is there an easier way to do this? Am I missing something that would be obvious to an experienced programmer?

I'm not sure if the second-guessing is a symptom of learning or a symptom of my own lack of confidence. Perhaps it's a little bit of both.

What I've generally been doing is pushing the application to do what I want it to do, to a minimal degree, while making some small notes about things I should do later. Little things like actually checking if a network connection was made rather than assuming it got the expected responses the applicatoin needed, and not overwriting a file of cached data with an error message from the servers. Better error checking. Wiping test assertion and debug message boxes sprinkled into the code.

I'm trying to make something functional to the point of demonstration.

I'm trying to make scaffolding, a facade; something good enough that I can go back to smooth the rough edges.

This also means that I'm cutting corners. I didn't write a spec. Only after making significant progress to a working application did I stop and create a pseudo-spec of how I wanted it to work. By not putting in the planning I'm creating things on the fly, and so the application logic probably isn't as clean as it could be.

It feels like it's close do the "demonstration" status. But doing it the way I have...feels amateurish. I think I pictured a "true programmer" as not going through stages like this, just whipping out functional code from the get-go. They get an idea in mind of what they want, sit down, and just keep ripping through function after function until a shiny, properly functional application pops out of the compiler.

So how do I become better?

I've heard some say that you just get better by doing. Want to become a better programmer? Program!

I never really believed that. Not fully; I think it has merit to keep in practice by doing something, but only if you do it correctly. If you are doing something incorrectly, you're simply reinforcing doing it incorrectly.

I told my manager that I was working on a project to enhance my programming awesomeness and he seemed glad I was working on it. I didn't get into much detail on the project...I wanted to wait until I had something to show. I brought up looking at my old projects and being appalled at the sloppy coding.

"I hadn't even sanitized the input! Sure, it was an internal project, internal network, and the chances of something bad happening were slim, and I put the whole thing together in four months, but still...even in the notes for the project I acknowledged these shortcomings."

"Well, at least you knew of the problems."

Maybe part of being a better programmer is realizing the shortcomings in your program.

What are the hallmarks of becoming a better programmer? Recognizing issues with your programs? Being able to sling lines of code without a second thought and have it compile the first try? Simply spending time programming, programming, and programming some more? Or are there other things that make you better (and how do you measure the baseline for improvement?)

No comments:

Post a Comment