2017 / 9 February

Teach yourself a new programming language

12311006886_7b9a6772e0_oThis post is aimed to people who want to learn a new programming language. If you are already familiar with coding this will help you structure your way to learn, if you are not, I hope this post will help you anyway!

Learning is experience, everything else is just information – ALBERT EINSTEIN


First things first, what coding language to you want to learn?

This seems like a basic question, but why is it that you want to learn a particular coding language? Is it for that upcoming job interview? Is it because it is the new cool language everybody talks about? Is it because you have a project you would like to code and believe this language is the best fit? Is it because you have to bugfix someone’s work?

Whatever the reason I hope it is a good one! Why? Because if it isn’t you’re probably going to fail!

The number one reason for failing to learn a new programming language is motivation! It will take time, and your motivation will probably fade away if you are not doing it for a good reason. So each time you feel like quitting, think why you started in the first place, it should boost you if the reason is good!

So now that you have chosen a programming language, how to get started?

Forget about teaching yourself a new programming language in 15 minutes.

Learning a new programming language can be fast, but not that fast. And obviously, if it only took 15 minutes, the world would be full of programmers! You’ll need time and patience.

Think of a project you want to learn to code on.

You’ll need a dummy project to learn the techniques in a realistic environment. Don’t pick your billion dollar startup idea right away, start with something smaller. The best project you can think of is a tool which you would like to use related to a passion you have. For example, a tool to manage your impressive comics collection. The idea is that you know what you are talking about when it comes to your passion, so the only thing you have to concentrate on is to learn the coding language, not the business related information. Picking from a passion, will also keep your motivation high

Get to know the tools.

The tools you are going to use are as important as the language semantics. You will need to find out about the following:

  • What IDE am I going to use? (what is an IDE?) Do I even have a choice of the IDE? You often have, but not always. You are sometime tied to one IDE for one or another reason.µ
  • What database am I going to use?
  • What do I need to connect to the database? This can be an online administration tool (like phpmyadmin, or a piece of installable software like sqlserver management studio)
  • Do I need a web server? If yes, which one? (Answer is yes if you are planning to do web development).
  • Do I need a simulator? If yes which one (Answer is yes if you are planning to do mobile development or any development on a device of any kind).
  • Do I need an O/R Mapper? Unless you are planning to do some low level development, you’ll probably want to choose an O/R Mapper for accessing your database. As you are in the learning process, not in the optimization process, go for the most popular one used within your language (probably a free one too).

Avoid learning several things together.

If your goal is to learn a new language, maybe the best option is to use a database you already know, not learn to use a new one at the same time. Sometimes it isn’t possible, but if it is, keep the things simple.

Prepare your workspace.

I don’t mean clean your mug and empty your desktop (even if that can be useful), I mean install all the tools you’ve identified in the previous step on your computer (yes, you’ll need a computer!). At this point, you’ll hopefully not realize that you need a PC instead of a MAC of the other way round, you should have discovered that at the previous step!

Find online resources

You’ll need documentation to start to learn a new programming language. I am not talking about a “Coding mylanguage for Dummies” book, but more about a reference guide and online forums. For example for C#, the reference would be the msdn library. Whatever language you pick, I am quite sure, you’ll find answers to your questions on websites like stackoverflow.com, codeproject.com and many others. Whatever the problem you encounter, you’ll probably find an answer by searching it online!

If you’ve read this far, you probably are ready to start learning, so let’s code!

Set up your project

In your IDE, you’ll need to create a new project:

  • Give it a proper naming, not MyApplication1!
  • Make sure to keep the separation of concerns in mind when setting up the project.
  • Before adding extra code, make sure you can compile your project
  • If needed, setup the connection to the source control tool (TFS, SVN, GIT…)

Setup your database

You’ll want to handle data in your project, to unless you are planning to use code first techniques, design and set up your database tables. Populate those tables with data. The more data you have, the better!

CRUD operations.

The first thing you want to do in any project is data operations. The CRUD operations (Create, Read, Update, Delete), can usually be dealt with in several different ways in each language. Get to know how your O/R Mapper works and prepare methods for your CRUD operations on all those tables you have prepared. These operations are to be written and executed without a GUI (Graphical User Interface). We’ll come to the GUI later. Remember that it’s better if your Primary Keys are auto generated and sequential, therefore your CRUD operations don’t need the primary keys as inputs, but maybe will need them as output.

Setup your testing

In a professional developer world, you would setup your testing project before your CRUD operations, but in this case, as you are learning, it is ok to do it after! Prepare methods to test all your CRUD operations in a unit test project. You’ll be able to run these unit tests whenever you need to make sure that everything is still working well.

Let’s do a GUI!

Now that your CRUD operations are working and tested, let’s build a GUI. Keep the design simple. If you are working on a web project, don’t bother with a nice CSS for the moment, go with the standard look and feel. You should build your screens in this order:

  • Read (display the data)
  • Create (data input screen)
  • Delete
  • Update

Start with the simple data, for example the tables with no foreign keys. Once you’re comfortable, you can work on more complex screens.

Business rules, validation, logic…

Now that you have decent CRUD operations and screens, it is time to add the more complex business related rules, validation, logic etc. To do so, remember the separation of concerns and make sure that every piece of code is at the right place. You don’t want to validate data in you data access layer, and you don’t want to implement your business logic in your GUI.

The final touch

By now you have a functional piece of software which should be able to handle your data decently. Of course it still looks very bad, so this is the moment where you start making it look good. Now that you are a software developer, you’ll maybe need the help of a graphics designer for that!

Good luck!

Image Credit: David Sittig (CC BY-NC-SA 2.0)

No comments so far.