Jan-Lukas Else

Thoughts of an IT expert

My code is still a mess, but I’m learning

Published on in 💭 Thoughts
Short link: https://b.jlel.se/s/66f

I taught myself Go (and programming in general) by learning by doing. I learned by making a lot of mistakes and after noticing them, doing the necessary research. My Go code is probably a big mess, but it’s so satisfying, after not touching some code for a while, to do a major rewrite and improve the code with everything I’ve learned since the last time.

Today, for example, I replaced a lot of bytes.Buffer with io.Pipe, so that my program needs to allocate less memory and may run faster. I also replaced buffers with string.Builder where it made sense. And finally, I got to know a new package: errgroup. It helps to catch errors when using functions with error returns in goroutines.

As for the code mess, I admit that I have trouble structuring and organizing code. I can write code that does what it should do, but I really need to improve when it comes to separating the different logical parts of the code. Since Go is not an object-oriented programming language, it doesn’t matter as much there, but I also notice it when I work with Java in my day job. I should probably read some books about it, but first I have to finish my AWS certification.

I’m (still) a junior developer according to my job title, so please excuse any shortcomings in my code, as I’m still learning (and growing) a lot!

Jan-Lukas Else
Interactions & Comments