The enchanted electrical website of Dr. Sinclair
-
How to use React (and Redux) with your crufty old CMS
Written by James SinclairGetting your JavaScript to run well on a CMS can be difficult at the best of times. But the difficulty grows exponentially when you add something like React and Redux. And this isn’t the fault of the CMS. Unfortunately most React tutorials assume you’re writing a Single Page web Application (SPA). And that’s great if you are actually building an SPA. But what about when you’re not? What about those of us who have a CMS imposed on us by our employer? What about those situations where a CMS is the best tool for the job?
-
What’s the point of art?
Written by James SinclairWhat is art for? What is the point of it? It’s not like food, clothing and shelter. We don’t die without art. At least, not straight away. Take away air, or water, or food, and we die. But we seem to be able to last much longer without art. Art doesn’t appear to be essential for life. In fact, it even seems frivolous at times. Its utility is not obvious. Yet, we humans keep making it. And the better our physical needs are met, the more art we seem to make.
-
React, Redux and JavaScript Architecture
Written by James SinclairWhether you use them or not, React and Redux are important. They have changed the way we think about structuring front-end web applications. They can be very powerful. But they are not magic. JavaScript code does not automatically become better just because it uses React. It is easy to write horrible React code, just like it’s easy to write horrible vanilla JavaScript. So, why is React important then? The thing is, understanding how to write React and Redux code is one thing. Understanding why you’d want to use React and Redux is another matter entirely. Once you understand the why of React,then modern JavaScript starts to make more sense. This is true whatever framework you’re using. Whether it’s React, Vue, Ember, Angular, Web Components, or something else entirely. React and Redux have had a huge impact on how we organise front-end code.
-
Flavours of prayer
Written by James SinclairHave you ever visited different types of churches and listened to how they pray? Growing up, I had the privilege of visiting several churches. They were all different. And the people in them prayed with different styles.
-
Faster, Better, Cheaper—The art of making software
Written by James SinclairNobody wants to deliver late, over-budget software. I don’t know a single software developer who wakes up in the morning and thinks “I’d like to do a rubbish job today. How can I cost my employer more money?” And yet, so many software projects don’t go well. And with every new project, there seems to be more and more pressure to go faster. So, if we’re in the business of making software, what do we do? How do we go faster without compromising quality?
-
JavaScript. But less iffy.
Written by James SinclairHave you ever started writing some code that seemed so simple? But then you had to validate the input? And handle an edge case? Oh yeah, and that weird thing the server sometimes does? And somehow this oh-so-simple piece of code turned into a mess? This article looks at how we can reduce the complexity introduced by conditionals.
-
JavaScript Without Loops
Written by James SinclairWe’ve been talking about writing less complex JavaScript. We do this by choosing the right abstraction to solve a problem. But how do you know which abstraction to use? So far, we haven’t looked at any concrete examples of how to do this. In this article we look at how to deal with JavaScript arrays, without using any loops. The end result is less complex code.
-
Indentation is the enemy: Writing less complex JavaScript
Written by James SinclairI’ve been working a lot with a legacy code-base lately. And this one is particularly troublesome. It has all the hallmarks of a rush job. The code is brittle. There are no tests. Things often seem to break at random. And to my embarrassment, I wrote most of it. So, I’ve been thinking about how I ended up here. How did the code get so intertwined and brittle? And how do I prevent it in future?
-
Why Christians should write Fantasy Stories
Written by James SinclairIs it OK for a Christian to write fantasy stories? The bible is pretty clear that people should not use magic. Why would it be OK to write about magic? And isn’t the whole idea of writing fantasy stories frivolous anyway? Wouldn’t our time be better spent serving the poor and telling people about Jesus, or even reading the bible? I would argue that not only is it OK, but if you are a Christian with the inclination to write fantasy stories, it’s helpful if you do.
-
The Marvellously Mysterious JavaScript Maybe Monad
Written by James SinclairMonads have a bad reputation in the JavaScript community. Douglas Crockford even said that monads are cursed: Once you reach enlightenment and finally understand monads, you immediately lose the ability to explain them to others. Even amongst experienced functional programmers, monads are treated with respect. But, if you can understand Promises then you can understand monads.