All Beautiful Code Starts UglyPublished on
There have been quite a few posts on the internet about experiences about programming at a young age. Some recount their days of hacking on computers in middle and high school, whereas others write their first experience is with a college programming class. Those starting in college are often self-conscious about their skills as they know that they have acclaimed self-taught prodigies in their class who have been programming for four years and are only in that class because it is a requirement. These new programmers are often discouraged, and when they stumble upon bugs they get frustrated especially when they compare themselves to others, who often walk into class bragging about few lines of code they needed.
Here’s my advice to new programmers. Don’t give up. Programming is a radically new way of thinking, and it is in my opinion that one cannot fully grasp that way of thinking in one semester. It takes time. It takes a lot of time. It will take a lifetime of ambitious learning. I also feel like this is the reason why new programmers shouldn’t be intimidated by their peers.
Most likely there isn’t a high school student who spends 40 hours a week programming. With school, sports, and other activities, I don’t think it’s possible. Frankly, I would be surprised to find a high school student who spends 10 or even 5 hours a week programming. When they are programming, it’s nothing serious. Some code here, some code there. They’ll finish the small project they’re working on and then take a break from programming.
This is why new college programmers shouldn’t be afraid of high school programmers. Sure high school programmers have been exposed to the art longer than they have, but in college it is different. It’s time for shine. Serious time. A time where entire days can be dedicated to programming (and I admit, those are the best days). It doesn’t take long for the differences between new and old programmers to diminish. In fact, many high school programmers are familiar with a Java like language, whereas college classes that I’ve taken are based on C/C++. After a week or two, someone new to programming and passionate, could give their experienced peers a run for their money. Yes, that’s a reference to C/C++’s lack of a garbage collector.
There is a caveat. Those who programmed seriously in high school have “that style” of thinking. They have intuition if something looks right or how to solve a particular problem. Over the course of many years of trial and error they have become very good problem solvers.
I believe I started programming around the age of 12. My dad had bought me a book called Game Programming For Teens, which taught teens programming with BlitzBasic. I progressed slowly. It took me probably a couple of years to grasp the fundamentals taught in an introductory class. A good example. I bet it took me over a year to grasp the functionality of an array (for those who don’t know, it’s the difference between keeping track of individual jelly beans and a jar of them). My most proud accomplishment was a program that repeatedly printed “I love you dad” forever.
I soon left Blitz for Visual Basic.NET, where I learned the language from “scratching my itch”, which was developing an application for Paradox Interactive and the project eventually turned into the EU3 Savegame Editor. However, every new version represents a new rewrite, so this means that there have been five complete rewrites! Hopefully this gives you an idea how just how terrible my first version was. The entire source code was contained in one file totaling 5,000 lines. Yes. 5,000 lines. 5,000 lines of no code re-use and little understanding of the language. Bugs were impossible to track down and new features required more code written that wouldn’t be re- used.
I converted to C# over spring break of my junior year of high school. Before switching, I read about functions being used more than once, and so my first foray was a rewrite of my VB.NET code into C#. In the one week of spring break, I took 5,000 lines of code and translated it into 600. Still in a single file. Still ugly, but a huge improvement. The subsequent rewrites gradually beautified the code. I eventually learned code separation and eventually things called structs and classes. It’s embarrassing for me to admit this, but this is one of the beauties of being self-taught. You have these horrible scars from when you wrote bad code, and you’ll never write that code again.