hjertnes.blog

#

06.03.2018 01:00

Awesome Clojure book I’ve been reading for the last few days : Clojure for the brave and true

#

06.03.2018 01:00

I’ve changed the Overcast playback settings back to 1x, after using the max playback speeds for years.

Why? I’m trying to be more intentional on what I do and how I do it this year.

Fast development versus reliability

06.03.2018 01:00

When you choose what programming languages to use for your project you should take in to consideration if developer productivity or reliability is more important.

For example if I develop the backend in Python and Django I’m much more productive, but if I use a programming language such as Java or C# I get a much stronger type system, which are catching more potential problems during compile time (if you are using it correct).

Having a strong type system can help you a lot, which means that it helps you to make sure that you don’t add a number to a string variable. But that means that you need to use more time declaring what type a variable has. But on the other side you often have to add more code to make sure that your data structures have the correct content in dynamic languages like Python.

And having a strong type system is also very helpful when you refactor code.

On the other hand, languages like Python often requires far less code than C# does.

It doesn’t matter that much on the end result, but my experience is that having solid automated tests are very important when you use dynamic languages. And I think there are something very comforting about letting the compiler doing the first round of validation.

This is by the way one of the big advantages of using Swift instead of Objective C.

#

05.03.2018 01:00

How to get into programming.

05.03.2018 01:00

The “How do I get into programming?” questions is one of the hardest things to answer. Or I do at least think it is. This is because being good at programming is about having experience doing it and having the drive to always looking for better ways of doing everything. Including those things you didn’t know was a problem, and of course the things you think are annoying.

The way I got into programming, and the way everyone I know who know how to code got into it was by doing. They had something they wanted to make, and they figured out how to do it. I started with web development. First I wanted to add a visit counter to my web sites, then I figured out how to make it only count unique visitors within a timeframe. Before I moved on to implementing a full CMS driven by PHP and MySQL.

The best way to learn how to code is to start learning about the technology you would like to make it in. If you want it to be a iOS app you should start with Swift and Xcode and if web devvelopment is your thing I would start with HTML and CSS, before moving over to JavaScript and server side technology. I would start with either Django or Ruby On Rails because they are very easy to get started with and almost everything you want is included. And React or Vue are good places to start for when you want to do Web App Development.

How you learn the basics are up to you. Some people like to watch video lessons, while others like a more interactive approach and I prefer books and blog posts. How you do it is up to you, but I would encourage you to try different methods and stick with what works for you.

And the final step to get started is to find a project. If you are doing a web development, making a custom CMS is a good place to start. Not because you’ll get the most amazing thing every. But just because you will learn a lot from doing it. Everything from server side rendering on what people will see and more advanced Web App development on the admin side of it.

A todo app is a good place to start, if you are doing an native app; but also works if you are doing a web app.

Then I would encourage you to make what every you are making as good as you have the time for. And always improve everything as you learn new stuff. A solid project that shows how you work and what you can do is always useful when you are going to apply for a job.

There will be a lot of “abstractions” no matter what kind of software development you get into. They are a way to make more complicated or time consuming tasks easier to work with. The good thing about them is that you don’t need to know all the details when you start out. The bad thing is that you need to learn more things. But I would still take the time to learn to theory behind them as you get more experience.

If you decide that you would like to make a living as a developer then I would start by looking at what kind of languages, frameworks and technology are popular in your area. And the best way to do that is by looking a job listings. And then start learning that. The next step is to have some code you can share with potential employers when you apply for a job. The closer the code is to what they use the better it is. It is just a way to show them that you actually know how to do the job. Because the biggest nightmare when we hire is to get someone who don’t know how to code.

Pairing it down even further.

05.03.2018 01:00

I’m lucking enough to own a lot of great pens. But that means that I can’t use all of them. Or I can at least not use all of them all the time.

I own a few Retro51’s, three Pilot Metropolitan, one Lamy Safari, two TWSBI Eco, one TWSBI 580AL, a Lamy 2000, A Pilot Vanishing Point, a Pilot Metal Falcon and one Noodlers Ahab.

The way it works for me is that the pens I use is the ones I have in my Nock Hightower. It has room for three pens. And I have a system for rotating the pens in it. Too few pens means that you run out of ink, and too many means that they dry up or that you spend more time making sure that they don’t dry up than you spend writing with them.

My problem before I started to move pens out of rotation, first with the Metropolitans and then the Eco’s was that there was three pens I enjoyed way more than the others. I love the Metropolitan, but I enjoyed the other five pens way more. And I also loved the Eco’s but I loved the other three pens more.

The result was that I almost never used them, except for when it felt like “I had to”. Therefore I decided to clean and rotate out everything that I didn’t enjoyed the most. And I’ll probably ink them up when I test out inks.

My current pen carry is as follows:

  • Pilot Metal Falcon: Broad Flex Nib

  • Lamy 2000: Medium Nib

  • Pilot Vanishing Point: Broad Nib.

Testing your web app

05.03.2018 01:00

To implement tests in a Web App requires your to test three different things: the backend, the front end and cross browser testing.

Assuming your backend is a series of REST API’s, the tests should make sure that your API’s are always doing what you expect even when you get input you don’t expect. And it is always a good idea to implement tests that re-produce bugs that are reported to make sure they don’t are re-introduced.

Then you also need to test your front end code. This means that you test all of your components or views and make sure that they always do what you expect, even with input you don’t expect. This is especially important when you are dealing with forms.

And last you should also use something like Browser Stack to do cross browser testing. Just to make sure there aren’t any problems with either your backend or frontend code in any of the browsers you support.

The reason you want all of this is to make sure that a) everything works right now b) test if some changes you made broke something c) see if performance improvements actually improved things.

Using a higher order function to deal with exceptions

05.03.2018 01:00

I have a longer and complicated relationship with exceptions, and I do in general think that they are the right solution, but I’m not a fan of the syntax. And I also think that they are not always the best solution. For example I personally think that to throw an exception when you are trying to fetch something(as in one exact row) from a database and don’t get anything back, I would prefer null instead of an exception because it ends up being a lot of code to deal with something very trivial. But when there are actual problems (like you try to get one of something and there are many, then you should get one). Long story short.

You have many different approaches when it comes to dealing with Exceptions. There are problems you can recover from and then you have those you either can’t recover from or those you don’t know about. I say use a specific solution to fix the former. But I often use generic ones when it comes to dealing with “the rest”.

I have written many versions of the higher order function below over the years. It is a simple HOF to wrap a function that will or might trigger an exception in a try catch and deal with it. For me it almost always means sending some feedback to the user and reporting the error.

Web Development in 2018

05.03.2018 01:00

Web Development is in a weird place for me at the moment. The choices for front end development are pretty solid. Frameworks or libraries like React, Vue, Ember and Angular are pretty solid; I personally prefer React, but all of them are good. Backend development on the other hand is in a weird place for me. I have used both Django and .NET a lot in the past. But neither of them are what I want in 2018 or 2017 for that matter.

The good thing about Django is that everything is easy to do and you get all the tools you need to build a database driven, fully tested RESTful JSON API out of the box. And you get the same with .NET Core. What I don’t like about both of them is that there are a little bit too much “magic” in other words stuff that the frameworks just does. The thing I don’t like about Django or Python is the lack of a solid type system, which makes the tests more verbose than needed and too much validation code. And C# and .NET have gone a long way, but there are still too many places where you need to define full classes to do simple things.

I spent a lot of time last year to see if Node + Express was what I wanted. And the answer is not quite. The reason is that I could come up with a setup that is almost there, but the type system is still too far away from what I want.

The next thing I started to check out was F#, Chicken Scheme and Guile. But none of them had all the stuff I wanted.

What I want is either a framework or a set of libraries I can configure to Database Migrations, define database tables in code (ORM), write RESTful API’s, manage authentication etc. And I want the language to have a good type system, support functional programming well and most important be fun to use.

The thing I mean when I say “good type system” is to define what kind of parameters to I expect to get of what type over URL parameters, GET Parameters and BODY data. Ideally those who are required and not required.

What I have decided to use for now is Clojure. It is a LISP, which I love. And I think everything is just a question of setting everything up to work like I want to. My “starter” project is on GitHub but it is far from done.

What I Carry

05.03.2018 01:00

What I carry these days are more or less the same as always, with some minor changes.

I always carry three pens, and I rotate them from a collection of five that I have in active use: Lamy 2000(M), Pilot Vanishing Point(B), Pilot Metal Falcon (Broad Flex), TWSBI Clear Eco(B), TWSBI Black Eco(Sub).

All of them are inked up with the same ink, as always. I currently use the Diamine Sargasso Blue, which I reviewed a while back.

As always, I use my Nock.co Hightower to carry my pens and pocket sized stuff.

Some of this stuff might change when Nock.co releases their A5 and Travelers Notebook Covers.