DEV Community

Matthew Bland
Matthew Bland

Posted on

Learn Readability and Conciseness Early

But why?

A little background first: I started programming when I was 11; my parents were both Software Engineers and so one day they decided to show me a little of what they did. They started me simply, with Rockerfer Basic. I caught on pretty quickly and bought a C++ book when I was 12. I didn't learn too much since it was a For Dummies book and was geared more towards business managers that could use a little C++ to automate things if they needed it. It did let me dip my feet into the world of programming, though, which proved to be fairly useful. At the time I thought I could be better at programming if I just tried to master every single thing C++ had to offer (fairly dumb in retrospect considering the complexity of C++ and my age). Later on, I decided to learn some Java through YouTube tutorials and eventually in High School later. This time with Java, I tried to focus less on just learning every technique I could and what this and that keyword does, and more on how to make code concise, easier to read, and faster.

I didn't really begin to see the benefits of this until my college career. Knowing the language is only a small part of the battle. It helped me way more to know the concepts of making code concise, readable, and fast than just trying to learn everything about one language (or a little about a lot of languages). I've now found that transferring to another language is much easier, partly because I'm familiar with C++ syntax, but mostly because I know many of the programming techniques it takes to really be a good developer. I've now been able to breeze through the lower, mid, and some high-level programming classes at my University.

So how would I personally recommend going about learning programming techniques? Well, of course, there is an incredible site with great information on what not to do called DEV.to! I've also found that CPPCon talks on YouTube are incredibly informative on this subject, e.g. Kate Gregory's talk about how important variable naming is, as well as some other (more extreme) rants and talks about how functional and procedural programming is better than OOP in many cases, such as Stop Writing Classes (my favorite part is his explanation of an API that starts at 4:30) and Object-Oriented Programming is Embarassing. The gist of these videos isn't to completely ignore OOP, but instead to focus on readability and minimal line count as well as to stop writing a class for everything (looking at you Java) that shouldn't need polymorphism or multiple instances, which I've found helps incredibly with conciseness, readability, and sometimes speed.

A good personal example is when I wrote an SFML game in C++. A YouTube video that explained the base game/rendering/ticking and states etc. claimed that you need to write a class for the game. In C++! Of course, this is extra; why would you need to polymorph the game? Will you ever have multiple different games running at once? No, that's when you make a different game altogether. I managed to get the 3 file, ~50 line base engine for the window down to a 1 file, ~20 line project, purely because a separate .cpp file and .h file that held a class for the game was unnecessary and the render() and tick() methods could be put in the file with the game loop and main method.

BUT, this is just my opinion! Some of you may have found that it is better to wait, and some of you may not have had the same exposure to programming that I did. So feel free to tell me I'm wrong in the comments or anything I may have misinterpreted that may come back to bite me in my career. Thanks for coming to my TED talk, and good luck with all your projects DEV Community!

Top comments (0)