@mycognosist

Welcome to my GitHub Page! I'm primarily working with Python (Flask) at the moment and learning a bit of Rust in my sparetime. I also like to work through CTF challenges when the mood strikes. I'm slowly building up a collection of blog posts, tutorials and walkthroughs - both to document my learning process and to share with others. Please feel free to reach out to me on Twitter or Scuttlebutt.

View My GitHub Profile

Reflecting on my first nine months of (serious) coding

10 September, 2017
@mycognosist

The backstory

Like so many of my peers who end up engaging passionately with technology, whether as hobbyists or professionals, my journey began as a young child; playing F-16 flight simulators run-off floppy disks, dismantling electronics and exploring telnet servers via clunky 56k dial-up. With an electronic engineer for a father and an analytical mind, what else could be expected? Had I known about penetration testing when I set-off for university my path might have been completely different. As it turned out I fell in love with anthropology (quite accidentally) and – though I never relinquished my engagement with computers - put my aspirations of a career in technology behind me. That was in 2007.

In November 2016, following a year of travelling through South America and many years of research work before that, I decided to fulfill my lifelong ambition of being a programmer. Not just someone who wrote ‘Hello World!’ in C once upon a time, you understand? I mean a fully-fledged, deep-knowledge, professional coder. Now, nine months later, I’ve decided to sit down and reflect on my progress to date, where I’ve found success in my learning path and how I would act differently if I could go back in time. In addition to this being a useful personal exercise, I hope that through sharing my story I might encourage or assist others – just as I have been helped and inspired by the efforts of so many others.

Start with your passion

My decision to re-engage with programming was largely driven by my interest in infosec and my desire to be able to work remotely. I watched YouTube videos featuring Ed Skoudis, John Strand and other infosec professionals discussing careers in infosec and the ways in which students can prepare themselves. The message was clear: learn a programming language. Wasting no time, I picked up copies of Black Hat Python and Violent Python and began working through the exercises. Having learning material which applied to my broader interests was key to keeping my attention engaged during those first weeks of learning. While working through a generic ‘Learn Python’ book might have left me numb with boredom, learning to brute force passwords, sniff network traffic and build simple botnets held my attention – ultimately pushing me to work through the initial learning-curve. At times I felt as if I wasn’t really retaining any of the content, but forcing myself to type-out and run each exercise in the book gradually developed my understanding of Python syntax and structure.

Choose a project

Roughly one month into my learning journey my father approached me with a challenge: could I read the contents of a CSV file and input the data into a database using Python? Relishing a challenge, I quickly accomplished the task and gained a great sense of satisfaction from having solved a real-world problem. As it turned out, this simple task was the first step in building a web application for the company my father was working for at the time. They wanted a mapping and monitoring application to communicate with custom hardware via Modbus and store the data in a database. The specification required the software to run on a Raspberry Pi and be accessible from the local network. While I had zero development experience at the time, I decided to work on building a demo version of the software, without any promise of an order or compensation from the company. To cut a long story short, I hacked together a working prototype using Python, PHP and Javascript – with a lot of help from Stack Overflow along the way. It was probably the ugliest, jankiest code ever written but allowed me to create a video demonstration of the software and land an official order from the company. I was terrified that I’d be outed as a fraud but kept going. It was then that I learned about Flask and quickly began rewriting my code.

There are a couple lessons I can extract from this part of my story. First, having a project to work on can really help to drive your learning forward in unexpected ways. Think of something you wish to create, or a problem you wish to solve, and then break it down into ever-smaller problems and tackle them one at a time. Second, don’t stress about writing perfect code and don’t get hung-up on coding conventions and best-practices. Hack something together, get an early-win and surf that momentum towards greater understanding. I look back on the first code I wrote with absolute horror, yet I acknowledge the importance of this period in my development as a programmer. With time, you will learn about best practices, style-guides and tools; you will begin to look at code produced by more experienced programmers and slowly improve. Don’t let perfection stand in the way of progress. Third, realise that you will feel like an imposter for a long time and that’s perfectly okay; every programmer I know has felt this way at some point. Reach out for support when you need it and keep putting one foot in front of the other.

Take good notes

Jumping into programming is daunting and you can quickly find yourself sitting in a puddle of tears with a million browser tabs open to different tutorials, feeling lost and utterly useless. The best way I’ve found to navigate through the confusion is to keep detailed notes as I progress. A simple text document on the desktop is all you really need to keep track of things: tutorials you’ve found helpful, important terminal commands, local file paths etc. Think of this as your programming diary/journal. It takes discipline to document your code and your process, especially when you’re wired on caffeine and buzzing with excitement, but you will save a lot of time and effort by building such resources. In addition, you’ll be able to reflect on your learning progress at a later stage, identifying weaknesses and strengths in your code and approach to learning

Log all the things

If there is one thing I underestimated about programming, it’s the importance of debugging and the keen attention to detail this requires. In my first few weeks of coding I often struggled to interpret the exception errors thrown up by my Python scripts. Equally mystifying were Javascript / jQuery errors. There were times when I spent hours scouring my code for errors, only to discover that I’d left out a single character. While this was incredibly frustrating, with practice I learned to decipher the silent screaming of my computer and gradually spent more time writing code and less time playing hide-and-go-seek with semi-colons and parentheses.

Using strategically placed print statements and console alerts can be helpful in the initial stages of programming. However, when it comes to building more complex applications and not simply running a single script, rooting out errors can quickly become far more complex. Knowing that your software is broken is only the first step. You then need to know where it’s broken and why it’s broken before you can focus your attention on how to fix it. These questions become far easier to answer when you have detailed information to analyse. I discovered this fairly late in the game, having shipped my initial codebase to a client for testing. Try debugging your code remotely when it’s interacting with custom hardware you don’t have access to! Is it your code that’s broken? Or the client’s hardware? If it’s your code, where exactly is the issue? After a couple days of sheer panic I came to realise the fundamental importance of logging and quickly worked to implement detailed logging of the stdout and stderr of all my scripts. This simplified my troubleshooting with the client (‘Can you please send me the log files?’) and drastically reduced the time I took to find and fix the problems. If I could go back to the beginning, I would have learned simple logging practices right up front!

Pick a language and stick with it

One of the major things I had not anticipated about development is the huge amount of non-programming work that’s often involved. By that I mean having to navigate installations, configurations, code editors, ecosystems, version control…the list goes on and on. First off, I’d say it’s important to focus on one thing at a time – especially when starting out. Pick a language and stick with it for at least a few months. Sure, you’ll probably be tempted to explore the seven new Javascript frameworks that just dropped this week, or that hip new functional programming language, but exploring and understanding the ecosystem becomes much easier when you have a working knowledge of a single tool/language and what it’s capable of. In addition, you’re not only learning a language – you’re learning how to solve problems. You’re learning a way a thinking, breaking complex tasks into many simple ones and tackling them one-by-one using basic commands and queries as building blocks. When you being to ‘see’ in this way, picking up a new language becomes much easier as you can focus on learning the syntax and quirks of the language, rather than trying to figure out how to problem solve with code.

Connect with others

Depending on your personality type, learning to code can be a lonely experience at times. I was fortunate to have my dad around during my first couple months of learning and often popped my head into his office to geek-out about the latest trick I’d learned or share feelings of ineptitude. Now that I’m on the other side of the world, I occasionally drown my non-tech friends in my techie babble. Don’t let your journey be a solo one. Reach out to other developers, even if you feel shy or embarrassed. This can be as simple as tweeting the creator of a tutorial you found helpful, or emailing a conference presenter to tell them you enjoyed their talk. It makes the world of difference to the people you’re thanking and you’ll be surprised by how approachable and friendly most developers are. As time passes, you can begin giving back by creating content yourself – whether it be a simple tutorial or reflection post such as this one. Meetups are also a great way to make irl friends who share similar passions. These interactions will help you to feel part of a community; to feel like you belong and are supported in your efforts. I can’t overstate how important this has been in my life.

Keep going, you can do it!

And so here I am, nine months after picking up my first Python book. I’ve recently learned to write simple unit tests, I submitted my first application for a developer position and I just wrote my first Python module in Rust. It has been a challenging time full of ups and downs but I can say for certain that I’m doing it, and that I love it! I’ve become a programmer, not through thinking about being a programmer, or wishing I was a programmer, but by programming – each and every day. As Alan Watts once said (and I’m paraphrasing): Don’t aspire to be a writer, be a writer. If you’re writing…you’re a writer! The road to mastery is paved with practice. Keep working at it, be kind to yourself and you’re sure to find fulfillment and the realisation of your dreams!

I hope you enjoyed this reflection piece and that you gained something positive from it. Please feel free to reach out to me on Twitter or via email (gnomad@cryptolab.net) if you have any feedback, questions, or if you just want to say hi. I’ll be focusing on producing more content in the coming months and can’t wait to continue the journey!