The Intellectual Accountability Myth

Radiohead’s "My Iron Lung" starts off with a short guitar intro and then the bass and drums kick in. The groove is incredibly tight with the bass and drums completely locked in and the bass lays down the foundation of the harmony underpinning the guitar lines. This is exactly the role of the bass in most genres of music – lay down the harmony and lock in a groove with the drummer.

From a purely esoteric, theoretical and analytical point of view, Colin Greenwood’s bass playing on "My Iron Lung" is harmonically and rhythmically very simple. However it is absolutely perfect for the context of this tune and it’s near to impossible to listen to this tune without tapping or nodding some part of your body along to those repeated eight notes that are completely in the pocket.

Many moons ago when I was about 18, I first started playing the bass guitar. I started to build up my knowledge of harmony and rhythm and my ability to apply this technically on the instrument. As I talked about in a previous post, I soon started jamming with friends. Back then, if I were shown a song idea consisting of a couple of chords with a straight ahead rock feel, there is no way I would have made up a bass line like Colin Greenwood’s on "My Iron Lung". This is not because I didn’t have the knowledge or technical ability to do so – one of the things that beginner bass players soon learn is to play root notes along to a chord progression. It is because I had built up some knowledge and technique beyond the basics. How would I get to use this knowledge and technique if I was just going to bang out root notes under a chord progression! Even if banging out those root notes was perfect for the tune at hand. Of course this was misguided and I knew it at the time but something inside me would put up a resistance to just banging out those root notes. What was that resistance? Why would I have to make up some bass line that was far more complicated than the tune required?

I never really put my finger on what to call this resistance. Some might just call it "immaturity". That would be a one good way to describe it. Later on I matured as a bass player and played countless jazz gigs where part of the set would include one or two slow ballads where I would be playing those simple root notes for the whole tune.

Probably my most memorable gig was a Tuesday night in the International Bar in Dublin sometime in the 2000s. I always loved getting the call to play that gig but that night, in particular, was something special. It was a small room but we had a great crowd who were really into it. We kept the tunes pretty open. After the main melody, we would take the tune to new places. One tune in particular went on for what could have been half an hour. Our sax player went into a long and highly emotive solo and we all kept building and building behind him. The energy and feeling of connection in the room was palpable. It was an incredible feeling! By the time I got to this stage in my bass playing career, I had built up a lot of knowledge and technique having gone through a 2 year Jazz Performance Diploma playing the Double Bass. I had spent countless hours practicing and countless hours listening to and transcribing bass lines and solos from the bass playing masters of the past and present. If it had been my 18 year old self in that room that night, there is no way that we could have created music that would have brought the same emotional experience. No doubt I would have tried to shoe horn all my technique and knowledge into what I was playing and it would have sounded awful! So what did I play on that tune? Apart from a short bass solo I played as an intro to the tune, I spent the following half hour only playing about 2 notes repeatedly in a groove with our drummer. The groove got more and more intense with our keyboard player playing all sorts of musical shapes on top of it and our saxophone player soaring over it all. All those countless hours of practicing just to play 2 notes over and over again! How would I have convinced my 18 year old self to do that! Luckily that early resistance I had to playing the simple had broken and I could play for the whole instead of for myself. But what was that resistance in those early years?

Recently I’ve come up with a possible label for this resistance and I call it "the intellectual accountability myth". I was holding myself intellectually accountable. My 18 year old self couldn’t just play simple root note bass lines when required because something inside me was saying "no this isn’t clever enough"! This is paradoxical because by trying to be "clever", I would be creating something far too complicated then required which wouldn’t have actually been the clever thing to do.

I have seen the same things play out in my software engineering career. On learning a new programming paradigm, design pattern, optimised algorithm or even programming language, a resistance would soon build up within me against writing code as I did before I learned the technique in question. This is perfectly fine if that new technique was adding value to the code I was writing and in the context I was writing it. Often though, the context would not be suited to this new technique. I would know this but that subconscious feeling would soon arise – "I’ve painstakingly learned a new technique, how can I write ‘sub-standard’ code that doesn’t use it?!" This may not have been an explicit thought but it was definitely a feeling. After gaining experience as a software engineer, I don’t get this feeling that much anymore. I would like to think that I now care more about the value that the code brings to end users and stakeholders and the value that its readability brings to my team-mates and future-me. My team-mates and future-me aren’t going to hold me to some intellectual accountability – they will care more that the code is well tested, does what its intended to do and isn’t going to take a disproportionate amount of time to understand when it comes to maintaining it.

I’ve found though that, even recently, there is a residue of the intellectual accountability myth within me. I’ve noticed this in writing code for my recent posts. The point of these posts is to show the ease at which microservices can be implemented and deployed with the combination of Kotlin, Spring Cloud and PCF. So, I came up with a small expenses CRUD microservice – the type of thing that might come up in some enterprise system. While writing the first of these 2 blog posts, I distinctly remember a feeling of resistance to just doing something very simple with simple Spring Boot CRUD. It was this resistance that led me to creating example code that was far too complex not only for the job at hand (show the power of Kotlin, Spring Cloud and PCF) but also for any CRUD service where there is almost no business logic to go with the CRUD. The code in those blogs has mappings from DTOs to a core domain model and then to a DB entity representation and all the way back. In fact nothing of any value is even done with the core domain model! Yes, the algebraic datatypes are a nice thing to show and are useful when there are business rules to encode. However there were no business rules except for the fact that there were certain properties in some expense types that shouldn’t be present in others (e.g. we don’t want distanceInKm in a meals expense). Simple inheritance along with the appropriate JPA and Jackson annotations takes care of all of this for us with no mapping code required. Okay, in a real production grade application, we would probably want to at least separate DTOs from db representations for security and separation of concerns. However, this code was just supposed to be simple demo code and, besides, there is only one table in the DB with no foreign key to any other table and data is just passed to and from it anyway with no other checks.

It was in reflecting back on the example code for those blogs that I realised there are still times when the resistance to just doing the simple can be there. Its hard to know why that is. Perhaps it’s knowing that the code is going out publicly on the web for anyone to see. It was also in reflecting back on those blogs that the idea of "the intellectual accountability myth" came into my mind as a way of explaining why, sometimes, keeping things simple isn’t so simple. I suspect it’s not only me who sometimes has a resistance to keeping things simple. In the industry at large, it seems that things that should be simple aren’t always so simple. I don’t know how many more tools and frameworks will be invented to simply move data between some storage mechanism and some viewing mechanism. Or, will we keep breaking the world record for the amount of YAML configuration files it takes to inject a String into an application! I hope these recent reflections will remind me to be vigilant to the intellectual accountability myth and to apply tools and techniques in the contexts for which they are suited.

I’ve included a simplified version of the Expenses service below.

import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.data.repository.CrudRepository
import org.springframework.stereotype.Repository
import org.springframework.web.bind.annotation.*
import java.math.BigDecimal
import java.time.ZonedDateTime
import java.util.*
import javax.persistence.*

@SpringBootApplication
class ExpensesServiceSimpleApplication

fun main(args: Array<String>) {
runApplication<ExpensesServiceSimpleApplication>(*args)
}


@RestController
@RequestMapping("/expenses")
class ExpenseController(val expenseRepository: ExpenseRepository) {

@GetMapping
fun getExpenses(): List<Expense> {
return expenseRepository.findAll().toList()
}

@PostMapping
fun postExpenses(@RequestBody expense: Expense) {
expenseRepository.save(expense)
}
}

enum class Mode() {
Air, Rail, Sea, Taxi, RentedCar
}

enum class ExpenseCategory {
Meals, Travel, Fuel
}

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes(
value = [
JsonSubTypes.Type(value = Meals::class, name = "meals"),
JsonSubTypes.Type(value = Travel::class, name = "travel"),
JsonSubTypes.Type(value = Fuel::class, name = "fuel")
]
)
open class Expense() {
@Id
@GeneratedValue
var id: Long? = null

}

@Entity
@DiscriminatorValue("Meals")
class Meals(val employeeId: UUID, val submissionDate: ZonedDateTime, val amount: BigDecimal) : Expense()

@Entity
@DiscriminatorValue("Travel")
class Travel(val employeeId: UUID, val submissionDate: ZonedDateTime, val amount: BigDecimal, val origin: String, val destination: String, val mode: Mode) : Expense()

@Entity
@DiscriminatorValue("Fuel")
class Fuel(val employeeId: UUID, val submissionDate: ZonedDateTime, val amount: BigDecimal, val distanceInKM: Int) : Expense()

@Repository
interface ExpenseRepository : CrudRepository<Expense, Long>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s