Six Pieces of Advice I Wish Someone Had Given Me When I Started Coding
Earlier this year, I decided that it was time to learn how to code. I made a decision to focus on learning a programming language called Python (which was supposedly easy to learn). I bought a book. I opened it. There were so many words that I didn’t understand. Some of the words I had heard before but I didn’t get how they were being used now: dictionaries, constructors, arguments and functions. And some of the words I had never heard before: booleans and tuples!
This made me nervous and frankly, put me off wanting to learn how to code. Opening my coding book for the first time felt like I was reading Swedish or Danish. When it feels kind of like English but actually isn’t and you end up being horrified that you read the bloody sentence three times thinking you were stupid but actually weren’t because it wasn’t in English to begin with. You know the feeling right? No? Maybe just me.
I have written this article to help you see the bigger picture. Learning a programming language is infinitely less complex than learning a natural (“real”) language. If you don’t allow yourself to be intimidated, and you put in the work, you could probably learn the basics of a programming language in a couple of weeks. And from there, the sky is the limit.
So, here are my six pieces of advice to you:
The concepts aren’t that complex
It’s a myth that in order to be a decent programmer you need to be super clever and have an amazing mathematical mind. If you’re doing stuff with neural networks or data science, that might be the case. But the majority of the time, you won’t be using maths. If you want to use programming to make websites, apps, etc, then I promise you won’t need maths. But you will need to allow yourself time to understand some abstract concepts.
The concepts in programming languages can often be explained by how things relate to each other (thing like inheritance) , by the flow of the program (so, if this happens, then this happens), and objects (knowing the methods associated with it). When you start out…it’s like you’re in an empty vast desert and over the horizon there’s a storm filled with abstract concepts and you’re expected to somehow, take on it this storm. A mere mortal! pf!
It only feels like that because when you start out learning any discipline, you lack the foundational knoweldge that concepts are built around. I promise you, that you won’t feel this fear for long. Once you’ve learnt that basic concepts for a single language…it’ll translate into the others.
If I was you, I’d start with a fairly easy language like Python and start learning it. While I am doing this, I’d look up other languages, and try and see what they have in common with Python (or the language you’re learning). Because each programming language was written by someone, or a group of people, who made the call on whether to include an abstract concept in their language. Ask yourself this: how does the lack of a concept make THIS programming language better catered to what it was designed for.
Worry about the semantics, not the syntax
Each programming language can be said to have a semantics and a syntax. That is to say that each language has things/concepts that mean things and a way they can be written down. Think of the semantics as concepts/meaning, and the syntax as the grammar.
When you’re starting out, focus on the concepts in the language, what can be done with it, etc. Concepts generally have a keyword that goes along with them, or a very obvious piece of syntax, once you’ve learnt enough of those…go on Github and read other people’s code. See how they’re using the concepts that you’ve read about in your book.
“Oh, nice. She’s just made a class called Person”.
Don’t worry about becoming perfect at writing syntactically correct code. You’ve got software that will grammar check them for you! And trust me, because your code won’t run with incorrect syntax, you’ll get very good at writing syntactically good code quickly. The IDE (the software you use to write/run your code) will tell you “hey, you’ve got a some shit code on line 25, sort it out”.
So yeah, don’t worry about the grammar of the language! Just make sure you understand what’s going on.
Google is your friend
The internet is filled with genuinely nice people who will help you out with your coding problems. When I first started out, I used to Google every single error message I got. Stackoverflow is one of the many websites you’ll find yourself frequenting. So, if you’r getting an error message you don’t get, or you’re struggling with a bit of code, go ahead and write up your issue with snippets from your code. Someone will get back to you within the hour!
Google everything. Watch lectures and conference talks. Learn. Learn. Learn.
Design Patterns are everything
One of the most daunting realisations when you’re just starting your coding journey is that you absolutely have no idea where to begin. I mean, you now know how do simple things in the language…but what now?
ENTER: design patterns.
Let’s be real, you’re probably not the first person to design a website or make an app. I imagine lots of other people have done it, and they’ve done it so often that they’ve come with clever design patterns for it. Think of it as best practice, or really efficient ways of dealing with a problem.
Problem: website design.
Design Pattern: MVC
One example of a design pattern is the MVC design pattern. You design your website or app into three interconnected sections. You first write the M part (model), and in this section you put all the information your website/app would need. If you’re making a social network, you make a model of what a person is, what a group is, and the necessary information about what a person can do, what a group can do, etc. This section is essentially how stuff is going to be stored in the database. So, under the object person, I’d say that a person has a DOB, a name, a birth place, list of friends, posts, notes. A group has admins, members and posts.
Next, you get working on the V (View) and this is what your end user sees. So, here you might make a page for displaying all the posts of the people on your site (LISTVIEW), and a page that has detailed personal page (DETAILVIEW). The List view is your timeline on FB/Twitter, etc. And your detail view is your profile pages, or what happens when you click on a link in the timeline. The detail view has as an ID number of slug connected to it, so when someone clicks on it…the database looks up who that ID belongs to and bam! It brings up their information: where they live, who they are, their most recent posts, etc.
Finally, the C (controller), the user’s input gets sent to the model or the view. So, what happens when a user clicks on a button on the timeline? Which bit of the database will be queried. So you might write a bit of code that says, hey, whenever someone clicks on this link, it takes them to this blog ID number.
There are lots of other design patterns. But this just goes to show you, that if you’re designing a website, whether Facebook or Twitter, or the Daily Mail website…you’ll have a similar set up. It doesn’t matter what language you’re using, it’s always the same process. So, you, my friend, are not expected to reinvent the wheel. You’re just expected to make a decent wheel with the materials you’ve been given.
There’s a really cool Carl Sagan quote where he says: If you wish to make apple pie from scratch, you must first create the universe. No one every creates a website from scratch, or an app. People use these things called frameworks, and they’re essentially like a scaffolding. Clever people have sat down and said, what are the most time-consuming/inefficient things we do everyday that we can probably do without. They’ve then made these packages that you can build your website with. This means that a project that should take you months can literally be done in the matter of weeks.
Now, these frameworks are each designed with a single language. So, whatever your language of choice is…there’s a framework out there that does what you want to do. And the first thing to do when interacting with them is to figure out: hey, where do different things live…what type of files get stored where.
Just do it
Stop talking about it. Just do it.