The fast way of learning a new programming language - Part I

How to boost the learning process and save time

Learning a new programming language is a skill. Unless you are a person who spends 40+ years with the same technology stack (and if you do that, please tell me your story, I really wonder how it is even possible), soon or later you will switch between programming languages or entire technology stacks.

Audience

This article is written for people who already have some experience. If you are a complete beginner, please free to ignore it or read it just for fun. But this post has value for the professionals who already wrote their couple of thousand lines of code.

The traditional - and slow way

That is the way that we all know: we attend a course, maybe we struggle and earn a degree, finish an online course, watch Youtube tutorials till the end or read some books cover to cover. That approach is working. No question about it. And it is slow. If you have ever read a programming book until the appendix, you know what I write about.

Learn by doing - the slow way

Our goal is to save precious time to do more important things. To be able to do that, let me introduce a faster method:

The first key factor is to learn technologies because we have a reason: we want to create a mobile app, a website or we want to change a job. The reason can be anything but not because it looks fancy. Or it is new.

Example

Today, we will pick Java as an example.

Learn java: It is too broad, let's narrow it. Actually, we want to create a website in the future.

Learn web development in java: Closer. Except nobody does the frontend in Java. (Except the old legacy projects). So creating a back-end API looks better.

Learn API development in java: It is almost narrow enough. Except as established developers we know we never write such a thing from 0. We use a framework. Now we google a little bit and we found Spring boot is the most common web framework. There are some alternatives but it seems that is the keyword in most of the job postings.

+Learn API development with Spring boot+: Almost perfect. Only one thing is missing: we want to learn by doing.

Set a clear goal

We know we will learn Spring boot by developing some kind of API. Now we have to convert it to have a clear goal.

Now, that is the point when I would split the topic into two categories: the basics and the framework.

Basics

The basics are something that we cannot avoid but on the other hand, as we already have some experience we can run through them pretty fast. Topics that must cover:

  • Literals, variables, control flows: if, switch, for, ...
  • Type system, OO concepts: objects, inheritance, polimorphysm
  • Exception handling
  • Arrays, collections

Framework

The framework is the tool that will help us build our API. As we create an API, that will be a web framework. But as an API, it can call other APIs and also can have database work to do as well. And of course, do not forget user management and security.

Topics that must cover:

  • Routing
  • Logging
  • HTTP call
  • Dependency injection
  • Database access (Maybe an ORM?)
  • User management
  • OAuth
  • CORS
  • Async (if it supports it)

At this point, we have two long lists. But still - nothing about learning by doing. So now, we can put some clear and measurable goals for each topic. We can literally handle our learning in the same way as we do our projects at our daily job.

Stories based on the topics that we cover

Epic: create a simple todo API. It can add, remove, modify and list our to-do items and can provide a list of items over their deadline.

  • Literals, variables, control flows: if, switch, for. Arrays, collections => Create a console app that can add/remove/modify and list to-do entries (plain text).
  • Type system, OO concepts: objects, inheritance, polymorphism => Todo-items should have Title and Description. There can be two types of items: with or without a deadline.
  • Exception handling => validate the input. Throw an exception for bad inputs. Different kinds of custom exceptions for different types of todo-items.
  • Testing => cover the project with unit tests

Now after collecting the basics, we can start working on the web API part

  • Routing => create a REST API that can add, modify, and list todo-items. The items are stored in an array.
  • Testing => unit tests for the API endpoints.
  • Logging => add logging for each endpoint call: endpoint name and passed parameters. And timestamp, of course. Refactor the unit tests.
  • Error handling => validate the inputs. In case of wrong input, give back Bad request and log the error. Refactor the unit tests.
  • Dependency injection => Implement a repository pattern to store the todo-items. Work with an in-memory repository.
  • Database access (Maybe an ORM?) => add a database connection. Figure out how database releases will work and create the schema. In the dependency container, switch from the in-memory implementation to the real database implementation. The unit tests should still use the in-memory implementation. Add an integration test.
  • User management => add user management.
  • OAuth => implement a simple OAuth login. The existing endpoints should receive a proper authorization token. Unit tests.
  • CORS => enable CORS. The sign-up and sign-in endpoints should be allowed for every request.
  • Middlewares => Put user context, OAuth, and CORS management into proper middlewares if it is possible. Do not forget about the tests.
  • Async (if it supports it) => Make your endpoints async. Do not forget the tests.
  • HTTP call => implement some tracking (E.g.: add and finish todo-items). Register into a tool like Amplitude and send your tracking data into that.

Summarize

In the first part, we have covered creating an example project with a learn-by-doing system. We have decided to create a whole project and set the exact steps to reach the goal. Now we buy 100 cans of energy drinks, sit down in front of the computer and do the work.

In the next part, we will cover some techniques about collecting training materials, deciding what to read and what to skip, administering our learning path, and adding some extra boost on the learning curve.

Enjoy coding!