Learning as a senior developer
Tags: learning, go, psychology
Published: 2021-07-09 21:33:42

"Things I already know eventually bore me, and things I don't know stress me out. It feels like the line between the two gets thinner with each year." [Dan Abramov](https://twitter.com/dan_abramov/status/1205975645618130944)

### Learning is stressful
Everyone keeps saying that you should learn a new programming language every year. 

But how exactly do you learn a language? When can you say that you have learned a language? I remember that when I learned my first languages, I was excited about everything. Usually, I just practiced the syntax, the keywords, the OOP features. And it would make me happy about myself.

Years later, I know that besides syntax, keywords, operators, and OOP / FP features, "knowing a language" includes:
* 1-2 popular frameworks and libraries;
* package managers;
* adjacent technologies and tools;
* building and deploying what you have written;
* writing tests and knowing test frameworks.

Learning a new language is more frustrating when you already have programming experience. You realize just how much you don't know yet. In your primary language, you are fluent and quick, you are so used to comfy old shoes. With the new language, every other line of code requires searching or reading documentation. It is just the sheer amount of things to learn that is overwhelming. Every gained piece of information seems like a grain of sand in the desert of knowledge.

### Mixing in some familiar things
How to make the learning process less stressful for a tired senior developer? The idea is to use current skills as much as possible. That way, I can intake the new knowledge in small portions while still getting some noticeable progress.

I want to learn Go, so I reuse:
- Deploying with a [docker container](https://hub.docker.com/_/golang);
- Designing a REST API in [OpenAPI format](https://swagger.io/specification/). Firstly, it is nice to have a layer of abstraction between the frontend and the backend code. Secondly, the [echo](https://echo.labstack.com/) framework has a code generator [oapi-codegen](https://github.com/deepmap/oapi-codegen) - I can read the generated code and learn from it. 
- Using [PostgreSQL](https://hub.docker.com/_/postgres) as the database - I am familiar SQL databases, PostgreSQL is a popular choice, and there is a also popular ORM library [gorm](https://gorm.io/);
- Using something familiar for the frontend, like Vue.

### Where I started
These decisions already simplified my life - I don't need to choose frameworks, I know that I'll use echo and gorm.

Instead of reading golang documentation, I started with echo's "Hello world" deployed in a docker container. It immediately gave me the feeling of something real that I do.

The next step was designing a simple REST API in the OpenAPI editor, with just one type of resource and basic CRUD operations. First, I generated and ran the classic PetStore example from OpenAPI and then replaced it with my own.

Finally, after making it work, I added the basic code for PostgreSQL connection with `gorm` and tried writing and reading from the database.

I wrote very little code yet, I even didn't write any loops or switches. I have a very vague understanding of Go so far. But I have a server with an API that can write and read the DB. I can also deploy it in the docker container. How much of the language did I learn? How well do I know the language now?

Photo by <a href="https://unsplash.com/@tmdpw?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Tim De Pauw</a> on <a href="https://unsplash.com/s/photos/tired?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>