A few days ago there was a thread on Hacker News where the comments were discussing Clojure

There are several valid comments there about refactoring in Clojure being risky in large codebases and tooling as a hurdle because Clojure demands more from its editors than most languages

If we consider heavy tooling and risky refactors the weaknesses of Clojure for the purposes of this article we can move on to look at:

The Unison language

The Unison language which is a relatively new language, if you haven’t heard of it I recommend watching this video:

The idea of hash addressable code

For those…


Remember all those problems we had? https://medium.com/@sfyire/all-change-here-a0d2f1b53876#.4nkasp9o6

All gone in this article, yep this is the golden ticket to programming nirvana, just use these custom functions I came up with! Half life 3 confirmed, 1 === 1 confirmed, quantum physics debunked, chem trails real something something.

Okay I lied but I am going to try and poly fill for functional programming at least for the scope problem

If you ever find yourself using use() in map/filter/reduce and then you need to refactor your function out of scope then you can use partial() to inject your parameters early like so


This is a continuation of https://medium.com/@sfyire/everything-in-its-right-place-dae94cbe15b7#.7ojixyu8z

$articles are great they resonate really well with my brain’s tendency for one overriding opinion in a reality where absolute truth doesn’t exist.

But I’m thinking our happy little $valid_articles need to all say follow me on twitter because that’s the world we live in.

Let’s do that in the most convoluted way possible:

Great, we’re at a good point so far, performance is down and the code is slightly more convoluted to read, (Hope you know the order of parameters for filter, map callbacks by heart!)

Before we move on to anything…


hey maybe you read this? https://medium.com/@sfyire/everything-in-its-right-place-dae94cbe15b7#.hbzscngzx

and maybe you thought hey that’s great but what if I need my article ID to be 166, and my $body is ‘sexy’, if not then I want my PHP app to phone the cops.

So first step is you’re going to need to install composer to download Twilio, no wait, fuck you make your own app, I’m here to talk about filtering reality

So let’s say we have our happy little article:

Yep, okay but maybe, everything is on fire and the article isn’t sexy enough to get posted to our most…


Look at this code, it’s about value objects in PHP

Thanks to type safety through value objects we can make certain guarantees about our data in our code, those guarantees include the existence of a property and the type of any property on the article value object.

Benefits:

  • Type based validation
  • Guaranteed data structure
  • Data grouping allows for smaller function signatures later on

Cons:

  • Writing ->props[$foo] is annoying, this can be mitigated with __get() and __set() but I like to keep ->props as a signal that I am reading a value object

Here is a link (not created or…


Earlier this year I saw a video on Youtube by Douglas Crockford, for the uninitiated he is author of JavaScript the best parts and he popularised JSON, it is a fantastic talk that I encourage you to watch here:

As a Web Developer myself I took the time to watch all of it but I am not sure enough people took note, perhaps hidden inside was the most pertinent section of code I have come across in my working career thus far:

In his video he said he was writing objects like this now, at the time I was…

adrian smith

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store