Hjertnes.blog

The Visual Studio Code Git Client

I have been using Git on the command line most of the time, for as long as I can remember. There have been periods where I have used apps like Tower. Some of them are okay. Tower is a great one, but way too expensive for me, and Fork is another great option.

Git clients in IDE’s and editors on the other hand have always been really confusing to me. I can never understand how the hell to use them. The exception being the one in Visual Studio Code and Magit. What I really like about the one in VS Code is that the visual UI is just about about committing changes. You have some other UI like showing the current branch, and some nice wrappers for running git commands through the command interface and other places. But the main UI thing is committing.

I really like it, because it makes it all really intutive and easy to understand for anyone.

Link dump

Stardew Valley

This was one of the first games I downloaded for my Switch. I think it was the first day when I got it and I downloaded a few games.

It is a great game, and I do enjoy it a lot, but I don’t love it. This is the perfect game when you just want to kill some time. I have played a lot of it on the train from and to work.

I think this is one of the games everyone with a Switch should get, because it is not expensive, and you get a lot of entertainment out of it.

Why I went for Clojure

The reasons I went for Clojure is:

  1. It’s the one with the most Hackernews traffic
  2. JVM
  3. Node
  4. Great tools
  5. A lot of great documentation (and books)

A new Kindle Paperwhite

My story with Kindle’s and e-book reading starts with my first modern smart phone. I got a HTC Hero back in 2010, and then I also got a iPod Touch a few months later.

I started to read some e-books on them, and then around when the first iPad came out I ordered a Kindle 3. It’s the last one with a keyboard on it. And I used that until late 2012 when I bought the first Kindle Paperwhite.

That one died a few years later, and I replaced it with a iPad mini. And when that died I didn’t replace it.

Some time after I didn’t have a dedicated e-book reader my e-book reading went way down. So this year I decided to finally get one again.

I went for the cheapest model, the Paperwhite. It is great, the reading experience is awesome, the side lights are great when you read in the dark.

The general feel of the UI is still klunky and slow though. And the process of setting up a new Kindle isn’t great. It comes paired with your Amazon account, but it still takes forever to download the books and all of that.

Anyways. It is a great device, and I recommend having a dedicated device if you want to read more e-books.

Mophie XXL

I’ve been a huge fan of powerbanks for years. They kind of changed how I think about using battery powered devices. Suddenly you’re not limited to the built in battery or having to sit next to the power outlet while it charges.

I ordered a new powerbank in the beginning of December. It is made by Mophie, it’s just called XXL. The main feature of it is that it is a real USB-C powerbank. You can charge it with your MacBook Pro USB-C power brick and it will take advantage of the power of it. And you can also charge anything USB-C, like the Swithc or even a MacBook.

It also comes with a A style port.

What I love about this thing is that it charges from empty to full way faster than anyhting I have owned. And it can charge anything USB I own. It have made by travel powerbrick situation a lot simpler.

Links

It is amazing how many links I actually read each week, and consider interesting.

Gitkraken

I’ve been very skeptical about this app, for a really long time. I never got what the fuzz was about. It is a electron, subscription, freemium app. Talking about hitting all the hate points out there. But it is awesome.

It is a fantatic Git App, but it is not the best App in the world. It is very cross platform.

If you have used a git app for any amount of time, there are probably some stuff annoy yu a little bit. Like dealing with merge conflicts managing branches or even doing simple editing while committing. What Gitkraken seems to be doing is to make things a little bit better all places there are some friction.

Merge conflicts? You get a simple interface with checkboxes. Simple edits? It has a very basic text editor. Changing branches, upstreams and al of that junks are at most two clicks away. I have used it for a couple of months by this point, and I really like it. Not because it is a great app, it isn’t, but because it removes a lot of friction.

Links

Write code with tests in mind

You can write code in many different ways, some of them are more testable than other, even though many of the less testable ways are not bad or anyting like that. Like mutating a reference value like when something takes a output pointer etc. Or having most of the code in the controller.

None of these are “bad”. But it makes it harder to write unit tests for it.

If you think something is good, then try to make it as easy as possible to do it.

I don’t do test driven development, because I don’t think it is the best way to work. But I do think that writing unit and integration tests should be a part of the process, because having good tests and coeverage will save you time in the long run. And it is a must if you want to move to the next level and get into automated deployments.

If you start with a typical C# .NET Core REST API. Then you could do everything in the Controller. It would work well. And the code could be clean. Probably a little or a lot of duplication of code but still it could work.

The problem with this approach however is that there is nothing you can unit test, because everything is tied together. Then you are limited to integration tests.

What I usually do is that I take the Controller and I limit it to validating input, checking permissions (ideally done with attributes and filters) and calling a “service”.

The services takes input from the controller and is in charge of checking all the right things, doing all the correct operations and preparing the data structure the API should return.

Then all SQL stuff, and all the Redis stuff etc are put into repositories. And the classes that takes data and turn into something else are done in builder classes.

All of this are tied together with as many static methods as possible (where it is possible) and dependency injection.

The advantage of this approach is that you can actually write tests for the controller without it showing up in the database. And the same goes for the service and the builders. Because you can just fake the dependency injection crap.

If you want to have a project where most of the code is covered by tests, then you need to write the code in a way where it is possible.

Link dump

New site

I’ve done some changes to my site, so if you were subscribed to my feed you should update to the new url: http://feedpress.me/hjertnes

The Zelda Book

Zelda Breath of the Wild is a nuts game. It was the first game I got for my Switch, and it is one of those games I obsess about in certain periods.

It is a really hard game, and a big game. The thing about Zelda is that it is a game where you, after the first part, can do shit in more or less what ever order you want. This means that a lot of it is to figure out stuff to do.

It is not like Pokemon where you have a order, and a lot of side stuff. In Zelda there are some orders you have to do stuff, but there are also a lot of variations to the order you can do the different things.

In order to make stuff a little bit easier on myself I got this huge ass coffee table book on Zelda.

If you’re into Zelda, I’d get it. Both because it is cool, and because it makes the game easier and less confusing.

Great Switch Games

This list contains 5 awesome games to get for your Nintendo Switch, in different categories.

  • Your first game: Super Mario Odessy: not super hard, but freaking awesome.
  • Your second game: Donkey Kong: very hard but a lot of fun.
  • The best: Zelda: I think this is one of the best games Nintendo have made, if not the best.
  • Interesting: Splatoon 2. It is so awesome.
  • Indie: Mounument Valley: this game is so good. A masterpiece by one crazy guy.

Links

It’s a little bit weird, but I always think I don’t read much in Instapaper, but when I empty out my likes it always turns out to be a lot more than I thought.

Links

I have been thinking a lot about how to share links over the last couple of months. My old style was to add a post for each link. The reason I used to do that was because it started as a Micropub like, and I just kept doing it after I moved away from using Micropub. I have decided that I as a reader would prefer that someone collected them and posted it in one larger post instead of many smaller ones.

The way I consume content online these days is that anything that looks even a little bit interesting are sent to Instapaper, and the stuff I think was interesting or cool are marked as a favourite there. So what I am going to do is that once a week I’ll empty out my likes from Instapaper and share them here.

#

Liked: Lazy sequences are not compatible with dynamic scope

#

Liked: linux-noah/noah: Bash on Ubuntu on macOS

#

Liked: My Name is Mark and I have Mental Illness – Mark Bates – Medium

#

Liked: Stop Learning Frameworks – Lifehacks for Developers by Eduards Sizovs