hjertnes.blog

Redux like pattern with ClojureScript and Reagent

08.09.2019 10:28

I’ve written about my redux like pattern with ClojureScript and Reagent on my wiki.

Links worth a click

06.09.2019 18:05

Trying out a new name for my “Like” posts. They have really never been stuff I liked but rather links I think are worth checking out.

Old school headphones, modern iPhones.

04.09.2019 19:47

The iPhone 6s/6s Plus were the last models with a headphone jack. And the solution since than have been to either use bluetooth or a lightning to 3,5mm jack.

Bluetooth have become pretty great since the early days, but I still prefer using old school headphones for a number of reasons:

  • A lot cheaper
  • A lot moe durable (dumb headphones without electronics survive anything)
  • No delays
  • More choice

I have tested two different adapters, and this is my take on what to use based on that. I have used a few of the stock Apple ones and one from Belkin.

The Belkin ones are not as good in general, but it supports charging and listening at the same time. What’s great about the Apple one, even though it is very thin and looks like it is going to break at any point, is that it almost never disconnects even when in your pocket. This is not the case for the Belkin one.

My current preference is to use the Apple one all the time, except for when I’m also charging.

These dongles are not great, and I would prefer to get the built in jack back, but it is not all bad. It seems to me that instead of what everyone that have used any pocketable music player know, where you get connection problems close to where the jack plug is, the dongle breaks.

What I do, is somehting in the middle. I use old school headphones plus a bluetooth DAC from Fiio. It was expensive, but probably cheaper than having to replace a lot of dongles

Framework versus libraries

01.09.2019 16:54

The move away from does it all frameworks have been going on for a while now. They are usually not the go to solution in the world of React and Node; and the Clojure world aren’t fund of them either. This is a good place to start.

To understand the difference between a library and a framework you can take a look at Django, Rails, jQuery or Angular. All of them attempt to solve “everything” or a lot of different things. And as a result your app end up having dependencies to them all over the place. While if you a bunch of libraries and have good abstractions you can limit the dependencies to a third party library very effiently.

The key difference between using libraries and a framework is that you need to do more of the configuration yourself. But you often understand more about how stuff works when you do so. Also: it is often a lot easier to change what you use for X and a lot easier to upgrade dependencies. The reason for this is that let’s say you have a well designed React app, and you have a “api-module” for all the requests to the backend, and you decide to change from axios to fetch you’ll only be required to change that module. Then you just remove axios from deps are you’re done. Let’s say you wanted to do the same with jQuery, it would take forever because people on your team would continue to write code using jQuery $.get/$.post etc because it is there.

There are also things like Entity Framework that is more like a library, even though it is called a framework.

Rails or Django may still be the correct thing for you and your projects. But there are some disadvantages to it, and I think it is important to understand them. And I don’t think frameworks are the future.

Likes

30.08.2019 18:39

Notes on beginners and software development.

28.08.2019 19:11

I think it is really important that it is as easy as possible for some kid to just figure out they want to make a web app, and have something on the screen really fast. These are some of my notes from seeing all kinds of people learn how to code in a professional enviornment for the first time.

  • Anything that requires you to do many steps to get something on the screen can be really discouraging. Any framework like .NET Core, Rails or Django is like this, for good reasons, but this makes it harder to get started.
  • React and JavaScript is something experienced developers struggle more with, than new ones. Because they’re probably not that used to much else.
  • Anything where you can start simple figure out one thing and then introduce another and repeat seems to work well.
  • Stuff like React and Express have worked out well, because you add a line of code and seconds later you see it on the screen. And you can keep it all in one file.
  • Make sure the tooling works as much out of the box as possible. The easier this is the faster the’ll learn

I think the most important thing if you try to make things easier for beginners (and not what some old dude think is difficult and therfore it must be harder for beginners) is to listen to some beginners.

JavaScript Rant.

25.08.2019 20:09

There are some problems with JavaScript. For example how broken math is or how much it pretends to be a C# or Java like OOP language.

But JavaScript is in general great. We get a new version of the language every year, that solves real problems. And there are new tools and libraries showing up each month (sometimes each week) that try to solve a problems a lot of people have. The great thing about this is that what is a real pain point in 2018 is very different from 2019.

This isn’t all without issues however. The negative side to thing becoming a little bit better more or less all the time is that you as a developer will have to spend more time keeping up to date than you would in a slower moving community.

But I’m in general mostly happy with where JavaScript and Node have been moving.

Likes

23.08.2019 19:30

Using NPM for command line tools

21.08.2019 18:03

I started to write all my custom command line tools in Node a while back. It was less than a year ago, but more than six months ago. The reason is simple, if I can put them up on NPM I can run them everywhere using npx without having to think about installing or keeping stuff up to date.

A lot of people have problems with JavaScript and Node for various reasons. Some because it change a lot(I think it is great because then things get better a lot faster) others don’t like that it is async (it is only a issue until you get used to it, and stuff like async and Promises have made it a lot easier).

What I enjoy a lot about this strategy is that the tools are solid, and that I can use third party libraries to solve a lot of stuff.

I do not regret moving all of my python, perl and shell script stuff over to node, it has made everything a lot easier to manage.

React in 2019

18.08.2019 11:10

The big thing going on in React this year is to move away from class based components to pure functional ones that use Hooks where it is possible. And if you are doing React development I recommend that you start doing this as soon as possible. You should at least get used to hooks.

I like hooks a lot better than I have ever liked class based components, and they are a lot easier to make re-usable. But they can be a little bit confusing in the beginning. Especially if you have not started using them yet.

My bet is that the React team will add hooks that solve the remaining things only class based components can do in the next couple of releases. What usually happens when something change to something new in React you usually get a couple of years before you start seeing warnings and then another year before it is gone. And it is a lot easier to deal with this kind of change if you start doing it early.