│

Exploring Quality, Complexity, and Creation

Author: Jesse Daniels

  • Tyranny in Software Code

    Tyranny in Software Code

    Proper software development is complex. Some software engineers are creating complex systems without un

    Proper software development is complex. Some software engineers are creating complex systems without understanding the abstract hierarchy of dependencies between different pieces of software code. This can create what is known in complex social systems as tyranny.

    Tyranny in Complex Systems

    When people hear the word tyranny, they think of corrupt oppressive government rule. Particularly government actors that force arbitrary choices upon individual citizens. These choices, or actions, that are forced upon the individual might be arbitrary to the individual, but perceived to makes sense to the higher system domain (the government).

    An obvious example of tyranny is slavery. Governments or powerful citizens forcing back breaking labor upon a subset of individuals in society. Individual freedom, which is important and the lower level of dependencies within the social complex system, is abandoned or ignored by the government for perceived efficiency in the production of material goods or services.

    These systems that force higher level concepts onto lower level dependencies become fragile over time. Southern American states that relied on slavery for many decades are still recovering from the fragile state that the tyranny of slavery caused. Slavery weakened or destroyed individual growth and motivation. It violates the rules of tribalism which is vital for social cohesion. All of this leads to a fragile complex system.

    Tyranny is forcing concepts or actions at the wrong hierarchy of dependencies in a complex system.

    However, social systems that do not force concepts or actions at the wrong hierarchy of dependencies will be robust over time and will have higher probabilities of flourishing in harder times. The federal system is a great example of a social hierarchy of dependencies that has been robust over the years.

    Software Tyranny

    So if tyranny is forcing concepts or actions at the wrong hierarchy of dependencies, how does this relate to software code?

    Below I will provide an example of software code tyranny.

    Example Software System Overview

    The system is an article system, like Medium, that provides the ability for consumers to create articles and share them.

    The Problem

    We needed to enhance the system to use a caching system when users outside of the system read the articles, since there are way more users reading articles then editing. But we can’t use the caching system when users are editing the article since we want the current data available as quickly as possible.

    The Solution

    The article rendering system needs to use a separate cache system for retrieving the data needed to render the article.

    The system at the highest level knows about “editing” and “viewing” when a request comes in to render the article via a query parameter. If it is in an editor, the URL will look like this:https://articleservice.com/article?editMode=true.

    Below is the server code:

    const express = require('express')
    const app = express()
    const articleStorage = require('articleStorage');
    const renderEngine = require('articleRenderingEngine');
    
    app.get('/:articleId', (req, res) => {
      //get article data from storage
      let articleData = await articleStorage.getArticle(req.articleId);
    
      //convert the article data into HTML for rendering 
      let html = await renderEngine.renderArticle(articleData);
    
      //send the HTML back to the browser
      res.send(html);
    })
    

    This is the code of the server for rendering the article. It fetches the data from storage, converts the data to HTML and then sends it back to the browser for rendering.

    Solution by Tyranny

    Now we have our app, we need to update it to use the cache system. Below I will show you how to use tyranny to update the system to do what needs to be done.

    app.get('/:articleId', (req, res) => {
      //get article data from storage
      let articleData = await articleStorage.getArticle(req.articleId, req.params);
    

    We pass in the params from the request to the ArticleStorage (the ?editMode=true that was discussed above).

    Now we will update the dependency code to fetch the article data from the cache system when we are rendering for view mode vs edit mode:

    const cacheSystem = require(‘cacheSystem’);
    const databaseSystem = require(‘databaseSystem’);
    
    export class ArticleStorage {
      async getArticle(articleId, options){
        let articleData;
        
        if(options.editMode !== "true"){
          articleData = await cacheSystem.getCacheForArticleId(articleId);
        }else{
          articleData = await databaseSystem.getArticleByID(articleId);
        }
    
        return articleData
      }
    }

    Can you spot where the tyranny is happening? It’s the if statement

    if(options.editMode !== "true"){
    

    This is a concept (edit mode) that is being forced at the wrong dependency hierarchy. In Domain-Driven Design, the ArticleStorage is in a different domain and the concept of whether to use the cache system should not be coupled to the concept of “editMode”.

    “EditMode” is a higher level concept that does not make sense at the storage level code in the system.

    The High Quality Systems Solution

    The proper solution will look pretty similar, but will have a major impact for the future of the system.

    Since the ArticleStorage is in a different domain, the concept needs to be translated.

    export class ArticleStorage {
      async getArticle(articleId, options){
        let articleData;
        
        if(options.useCacheSystem == true){
          articleData = await cacheSystem.getCacheForArticleId(articleId);
        }else{
          articleData = await databaseSystem.getArticleByID(articleId);
        }

    The ArticleStorage should have an option to useCacheSystem . Now reading the ArticleStorage makes more sense.

    The article rendering route should translate the concept of “editMode=true” to “useCacheSystem=true”

    ...
    app.get('/:articleId', (req, res) => {
      //create article options
      let articleStorageOptions = {
        useCacheSystem: (req.params?.editMode == "true")
      };
    
      //get article data from storage
      let articleData = await articleStorage.getArticle(req.articleId, articleStorageOptions);
    ...

    Now we have a solution that does not force concepts at the wrong hierarchy of dependency.

    A Bright Future

    The pragmatist will argue that our argument above adds additional code that one will have to support in the future, which will make the future worse for maintaining and enhancing the application.

    However, forcing concepts like this in the wrong abstraction layer will only cause issues in the future. What if we want to use the ArticleStorage to retrieve article data for a different part of the system that doesn’t have the concept of “edit mode”? That other part of the system will have to have to translate what “editMode” means, which will add confusion when supporting the code at a later time. Where as the domain translation we introduced is logical and readable, which is more maintainable.

    This form of tyranny limits optionality in the future. It also limits the freedom of responsibility that dependencies need in order to create high quality systems (more on both of these points in future articles).

    Overview

    Tyranny is forcing concepts or actions at the wrong hierarchy of dependencies in a complex system. We have seen this over and over again in complex social systems, but this also takes place in complex software systems. Tyranny should be avoided in any system if that system is to endure the test of time.

  • Allergies – An Anti-Fragile Definition

    Allergies – An Anti-Fragile Definition

    Growing up, I had seasonal allergies. Starting around August, my eyes would start watering and my nose plug up. It wasn’t much fun. Growing up, I was surprised to learn that allergies is a very modern phenomenon. It is something that is only seen in wealthy countries.

    What are allergies? Why don’t people in developing countries have them? Why don’t animals in the wild have them?

    Below I’d like to outline a definition of an allergy within a complex system.

    A New Definition

    All the definitions on the word ‘allergy’ are biologically based: “a damaging immune response by the body to a substance, especially pollen, fur, a particular food, or dust, to which it has become hypersensitive.”

    I would like to propose a more abstract, system based definition :

    Hyper activity of a defense mechanism in an anti-fragile system due to lack of stress.

    Anti-fragile?

    Our bodies are anti-fragile systems. Here’s a quick review of Anti-fragility:

    Antifragility is a property of systems in which they increase in capability to thrive as a result of stressors, shocks, volatility, noise, mistakes, faults, attacks, or failures. (Wikipedia)

    Nature figured this out billions of years ago and has used this to constantly expand/extend itself in a reality that has entropy at its core. Since we’re apart of nature, our body systems are inherently anti-fragile.

    The classic example of our bodies anti-fragility is weight lifting: the stress of lifting weights tears your muscle fibers. Once you’re done lifting, your bodies defense mechanisms repairs your muscle fibers, making them stronger.

    Too Clean?

    Throughout history our bodies were used to being in an environment full of dirt and pollen. This environment constantly applied a stress to our body, foreign invaders called pollen and dust that our system had to fight and defeat.

    Since our bodies are an anti-fragile system, it needs this stress in order to stay strong. Without these stressors our bodies will become weak. The reason is that the defense mechanisms for fighting the foreign invaders will not have any work to do and find something else to fight. Or, in the case of seasonal allergies, hyper react to pollen/dust and cause issues with the overall system. (Try working with an allergy attack!)

    How to resolve an allergy

    Since an allergy is a defense mechanism hyper-reacting do to a lack of stress, then the simple solution is to apply more stress. Sounds illogical, but it works!

    My season allergies were pretty bad, enough to get allergy shots at our local clinic. But no solutions from the medical industry worked in the long term. The shots didn’t even work at all.

    After understanding anti-fragility, a better solution presented itself: get outside more! Especially during the seasons that caused the most issues. So I added many activies to my daily regeme to get my body out into nature with all of its pollen and dust. Activities included cycling, walking, and hiking.

    It worked really well!!! I do every once and while have an allergy attack, but not nearly to the extent that I had throughout most of my life.

    Oral Immunotherapy

    Be careful, some modern allergies are so severe that applied stress could be deadly. Peanut allergies is an example of an extreme allergy. Currently the best way of treating peanut allergies is called Oral Immunotherapy.

    Oral Immunotherapy is a process of having an individual with a food allergy, in a properly supervised environment, consume the food they are allergic to at a small, but ever increasing amount over time, thus slowly applying stress to the immune system.

    For deadly allergies, please seek medical advice from a professional about safe ways of re-applying stress to your system.

    Overview

    An allergy is a hyper activity of a defense mechanism in an anti-fragile system due to lack of stress. If you find an allergy within a system, the simple fix is to increase the stress to the system.

  • Consumer Provider Conflict – Problem Solving In A Fractal System

    Consumer Provider Conflict – Problem Solving In A Fractal System

    Ever had a sales person sell a feature that your product didn’t have? Unfortunately this has happened to me many times throughout my software engineering career. If you have experienced this, you have experienced a conflict that is happening throughout your entire system: the Consumer Provider Conflict.

    Software Systems as Fractal Systems

    First I need to show that a quality software system is fractal in design. Software systems are usually hierarchical: higher level “consumers” solving problems using lower level “providers”. In that system hierarchy, a fractal pattern of property/method shows up.

    Starting at the top, the system solves specific problems. For example, a save button for your text document editor will convert your domain specific data into a markup format and save the data to disk. This is a very specific problem that has many steps.

    At the lower end, code is created to solve general problems. From the example above, there would be a piece of code in your system that would save a string to a file by path. This low lever algorithm is a general purpose piece of code that would be used in many other places in your code.

    Code solving specific to general problems in a fractal system.

    General/Specific Problem Solving Paradox

    The example above was only describing 2 dimensions, but we all know that software systems have many levels. This fact helps illustrate an interesting paradox:

    No matter where you lookin in a system’s hierarchy, higher level code is solving specific problems while lower lever code is solving general problems.

    This means that if you move your focus up, the code you were looking at before which looked like was solving specific problems now looks to be solving general problems. That lower level code that saves a string to a file, its using even lower level code that deals with byte management on disk, which makes the code that saves the string to a file look like its solving a specific problem.

    Throw a dart anywhere in the hierarchy and the code above looks to be solving specific problems while the code below looks to be solving general problems. If you move down the hierarchy and look up, the nodes that you saw to be solving general problems now look to be solving specific problems.

    But what’s even more interesting is that no matter where you are looking within the system hierarchy, there is a dynamic happening: there is an inherit conflict in problem solving between the higher level code and the lower level code.

    Problem Solving Conflict

    There is an inherit conflict within a fractal system such as the one described above:

    Higher level entities (consumers) will want lower level entities (providers) to solve specific problems, while lower level entities will want higher level entities to solve general problems.

    Back to our sales/engineering example: the sales person is at a higher level in the business. They are working with potential clients and helping them solve their specific issues. Engineers are at a lower level in the business, creating product that can solve many problems. The conflict comes when the sales person, rightfully representing their client, will champion their specific solutions while the engineer will reflect and push for the sales to adjust their solutions to use already created features.

    In code, the tendency is for lower lever code to sway towards solving specific problems, thus making them less reusable. The conflict usually shows itself over time and due to the fact that one person (a software developer) is writing the code at every level of the system. The software developer is thinking like the sales person: we need to solve a specific problem.

    Coding From The Bottom Up

    The first principles I teach junior developers is Inversion of Control (IoC). If you are not familiar with IoC, you can read a great tutorial at TutorialsTeacher.

    The specific part of IoC that I teach is to write code from the bottom up, not top down. This forces the developer to think about solving the lower level general problem solving code first, then work their way up to solving the specific problem that they have set out to solve.

    Then next principal I teach is the Single Responsibility Principle. For junior developers, I’ll make then summarize the class and method. If the word “and” is in the description, then the code needs to be split up. This helps the developer think in creating code that solves general problems.

    Unintended Consequences

    There is one big issue with creating systems in the way described above: general problem solving never solves 100% of the potential problems. It’s more like 80%. Because nodes within a fractal system solves 80% of potential problems, then we get Pareto Principle effects at the system level. Issues like “20% of the code has 80% of the errors” or “80% of a certain piece of software can be written in 20% of the total allocated time.” Wikipedia.

    Even though these are unwanted potential issues with a complex system, I believe currently there is no better way to build a complex system that is extensible and maintainable.

    Overview

    Within a fractal system, there is an inherited conflict between higher and lower level nodes: higher level nodes wants lower level nodes to solve specific problems and the lower level nodes want higher level nodes to solve general problems. This conflict is central to a developers growth in creating modular code that is of high quality.

  • Goals – Aiming for Subjective Value

    Goals – Aiming for Subjective Value

    People are taught that when you want to achieve something, you must first set goals. And those goals must be measurable. If you wanna lose weight, set a goal of losing so many pounds in a certain amount of time. If you wanna get good at the piano, you must practice so many hours for so many days a week.

    What I’d like to argue is that your goals should be based on something that isn’t measurable. If you wanna lose weight, adjust your life style. If you wanna learn to play the piano, find something fun to play. By setting your goals on something that isn’t measurable, you will shift your focus from gaining an objective value (quantity) to a subjective value (quality) in which only the subjective value will bring true contentment.

    Goals and Quality

    The difference between goals and outcomes is tied to the difference between quality and quantity. Quality is subjective, quantity is objective. If you ask somebody how they would improve the quality of the system, what they would give you is subjective opinions like “improve the interface”, or “make the code more readable”.

    If somebody tells you that in order to increase the quality of a system you must increase a number of something, then they are not talking about quality: they are talking about outcomes or strategy.

    Quality Isn’t Measurable

    Trying to measure quality is impossible. The only thing you can measure is outcomes from the improved quality of the system.

    In the software industry, one measurement of “quality” is code coverage. I’ve already gone over why measuring code coverage is a bad idea in When To Stop Looking at Code Coverage – Goodhart’s Law. However, high code coverage is usually an outcome of a system that has high quality.

    Our software team uses Test Driven Development (TDD) to help ensure that we don’t add bugs into the system over time. The tests don’t improve the quality of the system. We use them to assert that certain expectations on the system don’t change. We could be writing very bad code that is very inefficient, but at least we know we haven’t introduce any bugs.

    So code coverage isn’t a measurement of quality. It’s a measurement of something we did to help maintain/improve quality. Our goal is to make highly usable/scalable/maintainable/extensible software and code coverage is a strategy to do just that.

    Nomological Networks

    Should we still measure anything when trying to achieve a goal? Absolutely! Just remember, any measurement by itself should not be used to validate your goal. For example, measuring how much time one practices piano is a useless measurement if the only thing that was practiced was scales.

    One way to use measurements to help assess quality is by building a nomological network of cumulative evidence.

    A nomological network (or nomological net) is a representation of the concepts (constructs) of interest in a study, their observable manifestations, and the interrelationships between these.

    Wikipedia

    When creating a goal, like learning to play piano, a nomological network is a collection of observable manifestations (like total time practicing scales per day, total time practicing songs, ability to read notes in different clefs, etc…) and how these together help achieve your quality based goal. In his book The Parasitic Mind, Gad Saad introduces the concept of building a nomological network to build a bullet proof case for a truth:

    “The objective would be to build a network of cumulative evidence stemming from widely different sources, all of which serve to construct the final jigsaw puzzle”

    Gad Saad, The Parasitic Mind

    Once you create your quality based goal, create a list of measurable actions or to/dos that you think will get you to your goal. Make the list as big as you can. This is your nomological network. Once you start on your goal, keep reassessing you list. Over time you’ll find that some measurements that you have in your list aren’t helping you achieve your goal. One will have to keep accessing the construct validity of each item in your nomological network. You will have to continually judge your nomological network items.

    Human Judgement

    The best way to really assess your goals is by human judgment. No machine or measurement can tell you quality, yet. The only entity on earth can can assess quality is a human.

    In software development, the best way to achieve quality is by peer review. For our team, code that is checked in, is reviewed by at least two people. This is true for everybody, even our most senior developers have their code reviewed. We’re all human and humans make mistakes. We’re also a lazy species and self discipline can be difficult in the best of times. Having other people review your work is the best way to improve/achieve a higher quality.

    I believe America’s founding fathers knew this when building our judicial system. Judgements in court are not made by measurements but by humans. A smoking gun doesn’t always prove guilt.

    Only a nomological network of cumulative evidence with human judgement can bring us the best quality outcome within court.

    Overview

    Goals should be quality based. Since quality can’t be measured, one will have to use techniques like nomological networks and human judgement to gauge if one is achieving their goal.

  • Creating New Ideas Through Boredom

    Creating New Ideas Through Boredom

    Creative problem solving, on the spot, is a pretty difficult task. Solving problems is difficult enough, but to be creative in your solutions is a whole other level.

    Early in my career I was fortunate to stumble on some ways of generating creative solutions. Now there is some good science coming out showing there is a great way of creatively solving a problem: boredom.

    Walking For Solutions

    Back when I was just starting my career, I worked in an office that was next to a residential area. During lunch, when the weather was nice, I would go for a walk to get my mind off of work. After a few walks I noticed that some problems I wasn’t able to solve during work hours would magically solve themselves when I was out on my walk. I wasn’t even thinking about the problem and a solution would just pop in my mind.

    Now whenever I would get into a situation where I’m having a hard time coming up with a solution, I will go out for a walk. Many times I will get a solution before reaching the end of the block. Why!?!?

    Active Mind At Rest

    New neurological research has revealed quite a bit about how our brains work. Recent research, according to
    Olga Mecking’s book Niksen shows that our brain is actually more active when it is at rest.

    the brain when people were not doing anything in particular, and instead of less activity, he saw areas with increased activity.

    Olga Mecking. “Niksen.”

    Essentially, our brain is more active when we are bored. When doing a task, the mind will shut down other processes to help focus resources to complete the current task. This limits the ability for the mind to create new neural connections. Olga continues “I was surprised to find that when you engage in a task, some areas of the brain actually decrease in activity.”

    Hare Brain Tortoise Mind

    Similarly, in his excellent short book “Creativity“, the famous John Cleese talks about how his “unconscious was working on stuff all the time, without being consciously aware of it”. This he labeled the Tortoise Mind, from the book “Hare Brain, Tortoise Mind” by Guy Claxton

    The traditional concept of the brain, the part that processes information using logic and reasoning on deliberate conscious thinking he labels the “Hare Brain”. But, according to Cleese we have another brain: the “Tortoise Mind”.

    [The Tortoise Mind] proceeds more slowly…It is often less purposeful and clear-cut, more playful, leisurely or dreamy. In this mode we are ruminating or mulling things over, being contemplative or meditative. We may be pondering a problem, rather than earnestly trying to solve it.

    This Tortoise mind isn’t as clean and refined as the Hare Brain. It’s pretty easy to get into the Hare Brain mode of thinking: just start concentrating on something. The Tortoise mind, however is more “aimless”. This “aimlessness” is “particularly suited to making sense of situations that are intricate, shadowy or ill defined…when we are not sure what needs to be taken into account, or even which questions to pose—or when the issue is too subtle to be captured by the familiar categories of conscious thought—we need recourse to the tortoise mind.” This is called creativity.

    The Tortoise mind has been a mode of thinking that has been a part of all cultures for some time. This is something that Olga Mecking talks about in her book Niksen.

    Niksen

    In her book, Olga Mecking describes niksen as a daily Dutch concept that involves “doing something without a purpose, like staring out of a window, hanging out, or listening to music.” Niksen is sprinkled throughout the Dutch culture. This boredom helps not only to reduce stress and anxiety, but it also helps creative problem solving. Olga shows that “boredom literally makes us more creative, better at problem solving, better at coming up with creative ideas”

    The Dutch aren’t the only culture to have boredom built in. Here are some other ways around the world people have integrated boredom into their culture:

    Sabbath – God rested on the 7th day of creation, thus we should rest 1 day a week.

    Siesta – people in Spain and France, during the hottest part of the day, would rest and take a nap.

    Dolce Far Niente – Italian for “sweet doing nothing.” It means the essence of doing nothing and enjoying it. This is at the core of the Italian culture for enjoying a stress free life.

    Wu-Wei – Chinese for “non-action”. From the teachings of Lao Tzu and is at the heart of what it means to follow Daoism. Wu-wei refers to the cultivation of a state of being in which our actions are quite effortlessly in alignment with the ebb and flow of the elemental cycles of the natural world.

    What To Do

    Here are some ways to use boredom to help solve problems:

    Walks – When you’re stuck on a problem, stop what your doing and go for a little walk. Don’t think about your problem! Just enjoy the walk. You’ll be surprised how quickly your Tortoise Mind finds a problem. Some of our greatest thinkers where walkers: Albert Einstein, Charles Dickens, Steve Jobs and Friedrich Nietzsche.

    Naps – I know you’re not a 3 year old, but naps is another way to activate your Tortoise Mind. John Cleese in his book Creativity recounts how Edison used sleep to help come up with his creative ideas:

    [Edison] found that he got his best ideas in that funny no man’s land between being awake and being asleep. So he used to sit in a comfy armchair with a few ball bearings in his hand and a metal bowl underneath. When he dropped off to sleep his hand relaxed, the ball bearings fell on to the plate and the noise they made woke him up. He’d then pick up the ball bearings again and sit back and get into that same drowsy, dreamy frame of mind that he’d just been in.

    Delay Decisions: John Cleese points to a study done by the Psychology department at the University of Sussex on creativity showed that architects that ranked high in creativity “always deferred making decisions for as long as they were allowed”. This allowed their Tortoise Mind time to come up with fresh ideas.

    Play: Those same architects in the University of Sussex study also knew how to play. How they define play is “the ability to get enjoyably absorbed in a puzzle: not just to try to solve it so that you can get on to the next problem, but to become really curious about it for its own sake.” Or “exploring, not knowing where they’re going, and not caring either.”

    Limit Interruptions: one of the greatest killers of creativity is interruption. When you are using your Tortoise mind, setup your environment to limit any interruptions: set your cell phone to airplane mode, turn off the TV, etc. John Cleese points out that “research has shown that, after an interruption, it can take eight minutes for you to return to your previous state of consciousness, and up to twenty minutes to get back into a state of deep focus.” The Tortoise mind requires time and “the longer you sit there, the more your mind slows and calms down and settles.”

    What Not To Do

    Don’t do any activities that stimulates your brain. Neurologically this means any activity that will release dopamine. This includes visiting Facebook or watching YouTube videos. A great rule of thumb is anything that will give you the sense of being productive or active.

    Overview

    A great way of creatively solving a problem is through boredom. If you are having a hard time coming up with a solution, simply stop what you’re doing and let your mind wander. Neurologically your mind is more active when you are not using it. You’ll find that a creative solution will show itself when you are no longer thinking about.

  • Office Tribes

    Office Tribes

    Stress, depression and anxiety have been a major problem in the modern world. Suicide rates continue to climb without much promise of decline. Most of us can agree that there is something wrong.

    Maybe understanding our history might help. I’m not talking about our immediate history, but evolutionary history.

    Wait!!! Don’t leave yet! I know that word is pretty taboo lately, but please hear me out. Maybe, just maybe we can achieve a better way of living by learning about tribes.

    Millions Of Years Of Tribal Living

    Humans have lived in tribes for a very long time. Around 2 million years humans descended from the trees and lived on the open lands in Africa. We would live in smaller groups, usually 150 people or smaller.

    In contrast, our modern way of living is pretty recent in the history of the universe. We only started living in larger groups 10,000 to 12,000 years ago with the birth of agriculture. This is a fraction of time compared to our tribal living.

    For those 2 million years tribal living was fundamental to our way of life, but these past 12,000 years we’ve forgotten that way of living.

    Tribe Economies

    It’s weird to think of hunter gatherer tribes as having an economy, but in his book My Ishmael Daniel Quinn compares our traditional concept of an economy to tribes.

    At the core of our current economies is production. In order to get food, one must produce. Without production, one cannot get basic necessities like food and shelter. One must be “productive.”

    Tribes have a different core concept to their economy: human energy. This human energy is through unconditional support for all people in the tribe. Making sure that all people in your tribe receives all that they need makes sure the tribes survives.

    Wealth in our economy is capital. But tribal wealth is something else entirely: security from death. To achieve this, there are 2 fundamental laws.

    Tribal Laws

    Here are the two main laws regarding tribes:

    1. Each member will give their all for the tribe
    2. The tribe will take care of all members

    Every member must help the tribe. If the tribe fails, that means DEATH. If the member is kicked out of the tribe, that means DEATH. One must contribute to the success of the tribe!

    On the flip side: it’s in the best interest of the tribe to take care of every member. In My Ismael: “The rest of the tribe won’t turn its back on you as you struggle with this problem. They know that a problem shared widely becomes almost no problem at all—and they know very well that each of them will someday need similar help with one problem or another”. Every member is needed for the tribe to survive.

    Humans evolved into these rules due to necessity. These rules are fundamental for a tribe. Give your all to the tribe and the tribe will take care of you. With this security, all tribes people live without fear. No anxiety, no stress, no depression. Just security.

    Give your all to the tribe and the tribe will take care of you.

    Here’s the modern problem: these laws are inherited within us and we apply them unknowingly. We apply these tribal laws to many parts of our modern way of living and it’s causing our stress and anxiety.

    Company Tribes No More

    We naturally are constantly seeking membership into a tribe. We are constantly looking for tribal security. Companies used to provide a tribal experience: work hard for us and we will provide for you until you die with a salary and a pension.

    Expulsion from a tribe means DEATH, and we have either been excluded from a tribe or never been in one.

    Those days, unfortunately are gone. Companies, for the most part, no longer provide pensions. The average length of employment is around 4 to 6 years. More and more employers are looking to hire contractors instead of full time employment to save money due to high health insurance costs. Companies are no longer acting like tribe leaders.

    Tribal Conscious.

    Expulsion from a tribe means DEATH, and we have either been excluded from a tribe or never been in one.

    After having something go wrong at work, have you ever over reacted? Ever thought “their gonna fire me” when logically that would never happen? It’s happened to me a few times over my career.

    When something goes wrong, employees instinctually fear being excluded from their tribe. Expulsion means DEATH and we all fear DEATH. However, if tribal members feel taken care of, they will give their best effort. Tribal members have to give their best or the tribe will fail, which means DEATH. This, I believe, is core to our psychology of motivation.

    3rd Level Of Motivation

    Daniel Pinks great book “Drive: The Surprising Truth About What Motivates Us” talks about different types of motivation.

    1. Motivation of necessity (hunger, shelter)
    2. Sticks and Carrots (Rewards and punishment)
    3. Autonomy, Mastery, and Purpose

    The last level of motivation is key for motivating creative types such as software engineers. However, this last level of motivation doesn’t work unless the employee is using it to further secure the tribe (purpose). When they are given autonomy and a chance to master their craft, they are given an opportunity/purpose to secure the future of the tribe. This is instinctual. Autonomy and mastery within a void will only cause stress and anxiety since it will soon be clear that their purpose will NOT help the tribe. Freedom without purpose is not freedom, but can become a detriment to happiness, because you are no longer helping the tribe, yourself or anyone for that matter.

    The Future

    People in tribes lived in security without fear and anxiety. No, we don’t need to go back to living as hunter gatherers, but we can start living in tribes again. Let’s use this knowledge to change how our companies, families, and churches behave. Warning: we must be careful with the power of tribal thinking.

    Living as tribes can be bad if we’re not careful. In My Ishmael, Daniel Quinn points out that “there is no operational difference between a tribe and a cult.” People die for cults…that’s the power of tribal thinking. A nefarious tribal leader can lead the tribe to ruin; people can mistake the tribe for the leader. Just look at our current political environment.

    But if we can harness these laws, people can be motivated well beyond their potential. As Ishmael says in My Ishmael: “People have died for [tribal support]. People will die for that—not because they’re crazy but because this is something that actually means something to them.”

    Overview

    Humans have lived in tribes for million of years to survive. Because of this there are 2 tribals laws that have been ingrained in us: the tribe will take care of its members, and the members will give their all for the tribe. Our modern workplace used to accommodate these laws, but in recent years businesses have been moving further and further away from them, thus explaining the degradation of motivation and the increase in stress and anxiety in our culture.

  • Generalizing Specialists and Transactive Memory

    Generalizing Specialists and Transactive Memory

    In the last decade I’ve been fortunate, or unfortunate depending on your view, in going through multiple company transitions from Waterfall to Agile practices for organizing software development work.  Most…no, all the transitions didn’t go very well.

    What they all had in common was that they hired a “certified” scrum master to lay down the rules for the new Agile practice. (yes, that is ironic)

    All the scrum masters that I worked with preached an idea that I always took issue with: all developers are to be treated as generalists.  Any developer in the team should be able to pick up the top user story in the backlog and do it.

    This never worked for any of the companies I was at. Developers are good at different things. Some developers are really good in front-end code, others are CSS gurus, and some were strictly database developers which only knew SQL.  Software is so complex and diverse, that there is no way that developers are going to be awesome at all the different domains needed to create great software.  Imagine telling the SQL guy that he has to do CSS development.  Ha!

    Transactive Memory

    It is inefficient to have every module within a system store and retrieve the same information.  Evolution figured this out a long time ago.  One way it figured this out, is through the concept of Transactive Memory.

    It is inefficient to have every module within a system store and retrieve the same information.

    Transactive Memory (Wiki) is a memory system of collection, storing and retrieving knowledge throughout a group.  This is a form of specialized division of labor.  Instead of retaining a piece of complex information, like say, how to create indexes within a stored procedure in a SQL database, I know that Bob over in the corner desk is really good at it.  When I need to get that information, I talk to Bob.

    Separating domains of knowledge within different parts of the memory system allows the system to build a more complex and potentially effective knowledge base.

    This is one reason why the generalists approach to development never worked within the dogmatic Agile approaches sited above.  Not everybody can be great at everything and transactive memory develops naturally within a group of individuals, such as a development team.

    Generalizing Specialists

    The latest buzz word in the tech industry is Generalizing Specialist. The term generalizing specialists has come to mean an individual who has a particular area of deep expertise, but also has experience in a large number of other areas that may not be directly related to their core area. (AgileAdvice) Gaining more generalized knowledge outside your particular career path, is very advantageous.

    In his book Range: Why Generalists Triumph in a Specialized World, David Epstein argues that generalized knowledge is a requirement for solving complex problems or creating complex solutions. “The more contexts in which something is learned, the more the learner creates abstract models, and the less they rely on any particular example,” writes Epstein.

    Epstein sites many examples of Generalizing Specialists outperforming Specialists.  One was that of a team of E. coli specialists vs a team of  “scientists with chemistry, physics, biology, and genetics backgrounds, plus medical students”.  Both teams were tasked at creating general solutions for E.coli research.  At one point both teams encountered the same experimental problem with regards to protein measurements getting stuck in filters. The generalists team was able to solve the problem the same day, due to one of the team members drawing on knowledge from their medical degree.  The specialists took weeks to solve the same problem, even though this was their area of expertise.

    Overview

    Expecting a software developer to be a generalist, that is good at developing in all software domains isn’t realistic.  Through the concepts of Transactive Memory, teams naturally segregate knowledge to individuals within the group.

    High powered software teams consists of “generalizing specialists” that have a high knowledge of a particular domain, but a breadth of broad generalized knowledge.

  • When To Stop Looking at Code Coverage – Goodhart’s Law

    When To Stop Looking at Code Coverage – Goodhart’s Law

    All companies want to know if their investment will bring them value.  In order to understand how much value they are getting, the company will implement some sort of measurement.  This is common sense: I invest, show me what I’m getting with my investment.  However, a measurement can have an adverse side affect in the creative process, particularly if it is a requirement.

    Code Coverage

    A number of years ago, Test Driven Development (TDD) spread throughout the software industry as a way to increase software quality.  Tests were written first, then the software was written to satisfy the tests.  To see how much of the software was covered by the tests, the test runners would give a number that would represent the percentage of how much of the code was covered by tests.

    Research showed that this percentage correlated with high quality code in the industry. Because of that correlation, many businesses believe that they have to have a high percentage of code coverage, in order to get high quality code.  High code coverage was then set as a requirement for many software shops.

    Goodhart’s Law

    Economist Charles Goodhart, while criticizing the United Kingdom government of Margaret Thatcher in a 1975 article for trying to conduct its monetary policy on the basis of targets, created a simple law:

    When a measure becomes a target, it ceases to be a good measure.

    Goodhart saw that when a feature of the economy is picked as an indicator of the performance, then it inexorably ceases to function as that indicator because people start to game it. (https://coffeeandjunk.com/goodharts-campbells-law/)

    Examples of Goodhart’s Law

    This simple law is applicable to many industries.  Here are some examples of setting measurements as targets:

    Search Engine Optimization – Once web masters found out that the quantity of keywords on their website would increase their search engine rankings, they would duplicate keywords countless times and have the text color be the same as the background color so that the users wouldn’t be confused about all the random text.

    No Child Left Behind – Once schools understood that in order to get proper funding their students had to do well on standardized tests, the schools started teaching to the tests instead of continuing to learn content.

    Dieselgate – In September 2015, the EPA found that Volkswagen had intentionally programmed turbocharged direct injection (TDI) diesel engines to activate their emissions controls only during laboratory emissions testing which caused the vehicles’ NOx output to meet US standards during regulatory testing, but emit up to 40 times more NOx in real-world driving. (Wikipedia)

    When Code Coverage Is A Bad Indicator

    Once the goal of a developer is set to hit a high code coverage number, the developer will get pretty inventive.

    One shop I was at, that had code coverage as a requirement, I was spotting this all over in the codebase:

    [System.Diagnostics.DebuggerHidden]

    I tried to step debug into some code, but couldn’t.  The previous developers started to hide code from the debugger, in order to increase the code coverage percentage, since the test runner used the debugging framework to assess if the code was hit during testing.

    This was obviously against the spirit of code coverage, but they were also under really tight deadlines. Having the measurement as a requirement made them do bad things to the system.

    Overview

    Once a measurement becomes a requirement for your dev team, it ceases to be a good measurement. Developers will start coding to the measurement instead of what’s really important: business value.

  • Fractal Dependency Segregation – Creating Clean Code

    Fractal Dependency Segregation – Creating Clean Code

    Spaghetti code is something that all developers know is bad. They have an idea on how not to create it, but inevitably do. It’s like the governments definition of obscenity: you know it when you see it.

    There are some good patterns and practices to help prevent spaghetti code, but I’m still itching to have a good definition of what spaghetti code is.  I’d like to show one way of understanding what makes spaghetti code by looking at software systems as fractal systems that contains layers of code.

    Layers of Code

    Most places that I’ve worked at as a developer have their code organized in a similar way. Most places have heard or used the Repository pattern. DOTNET shops have plenty of experience creating “client” code for communicating to SOAP or WebAPI endpoints. UI projects all now have “controllers” or “view models”.

    These “types” of classes/code are different fractal layers within a system.  What I mean by fractal is that they look and act very similar but are at different levels in the system.

    Dependency Segregation

    Here is a simple example of types of classes that would be in a UI application (web or native) (dots representing classes):

    Class Layers

    Each level is a fractal layer: the classes look and act very similar, but each layer is a hierarchical level in the fractal system.  Views use Controllers, Controllers use Services, Services use Clients, etc…

    Class Layers Call Stack

    Each hierarchical layer uses as a dependency a class from the lower fractal level.  The call stack starts to look like a tree, or root depending on how you view it.  Nature’s best pattern at work!

    Spaghetti Code

    Spaghetti code is code that has references or makes calls to the same or above levels within the fractal system.

    SpaghettiIn this outline, the call stack looks more like a snake than a tree.

    Your code must fork, not snake!

    This creates many problems, one being the high change of circular references. The other issue is that this will highly limit optionality on future enhancements or bug fixes. We can’t make changes to one controller without it affecting another controller without our knowledge.

    Cross Same Level Communication

    There will be many times that one will need to communicate across the same level classes within a system, and there are some great patterns for this: Pub/Sub and the Observer Pattern are a couple.

    The two patterns have their differences, but the idea is the same. It provides a way for classes within the same fractal level to communicate via sending events.  This keeps all the classes highly decoupled and provides a way to not violate the fractal dependency segregation due to having a central messenger or event bus at a separate fractal level.

    However, one can still violate the fractal dependency segregation if they were to publish events from one fractal level and read it in another.  Events need to be kept within the same hierarchical level.

    Events need to be kept within the same hierarchical level.

    Overview

    The fractal dependency segregation description above is a simple way of viewing the hierarchy of your code to help prevent spaghetti code.  Spaghetti code is a call stack that is calling entities at the same or above level within the fractal system hierarchy. Communication between same level entities should use patterns such as Pub/Sub or the Observer Pattern.

  • Software Principles and Misintegrated Thinking

    Software Principles and Misintegrated Thinking

    All these software principles and practices can be hard to keep up with when developing applications. They can be even harder to implement. One thing that makes it difficult is figuring out when not to follow them. Like a good database architect would say: it takes experience knowing when to denormalize data.

    One problem that I admit having is prioritizing software practices and principles over what should be the true purpose of writing code: to make a great product.  Why did I, and other developers, sometimes fall into this trap?

    DIM Thinking

    In the book The DIM Hypothesis: Why the Lights of the West Are Going Out, Leonard Peikoff outlines 3 different fundamental modes of integrating new ideas/data into a whole: Disintegration, Integration, and Misintegration.  They are defined as such:

    • Integration: data is integrated through rational means.
    • Misintegration: data is integrated through a prism of ideas.
    • Disintegration: data is integrated through no means. (nihilism)

    The one mode that affects us is Misintegration. Misintegration has its roots from the philosopher Plato concept of Idealism.  This states that “Eternal truths exist in the realm of Ideas rather than in what we would call the natural, physical world.”  This type of thinking places a priority in ideas over reality.

    There are some big problems with prioritizing ideas over reality. Leonard Peikoff shows in his book that the Misintegration mode is linked to the outcome of the Medieval period, the rise of the Nazi party and Stalinism.

    Placing Principles ahead of Product

    Software principles are ideas.  They are ideas that help us make better maintainable software.  But, they are not the reason we make software.  If by following software principles we make more complicated software to maintain in certain situations (yes, this does happen), then we probably shouldn’t follow it.

    Following software principles blindly without rationally assessing context and/or situation is a great example of Misintegration mode of thinking.

    67191c8a506e176e26685aeb624135a4460fe775a50719dfdb01d75d4d2b4592

    Unfollowing Principles Example

    Our main frontend application is an AngularJs application. We needed to create a badge input where one can type a string and the control would see if the string is in a valid list of badges.

    When creating the control, I pushed that the control should be as reusable as possible: a badge-input control.  The control should know nothing about what its data is and where it got it.

    The developers did a great job creating the control!  It was a very well made control that was easy to use.  However, AngularJs doesn’t make it easy to practice inheritance and polymorphism with components/directives.

    Later our product owner wanted the new component to allow the user to add a badge to the database.

    giphy.gif

    Our beautiful reusable control wasn’t created to do that.  Well, do we try to keep it generic and have some very confusing configuration options for doing this?

    After a short talk we all decided to make the control specific to the database entity.  So now its a badge-label-input instead of a badge-input.  If AngularJs provided a better way to practice inheritance and polymorphism, then we would have kept it reusable and extended it.  However, since the framework limits us, we decided not to follow the very good Object-Oriented Principles that I preach, even in my blog.  The irony is is that the application is still very easy to maintain and pretty easy to enhance, even when we purposely didn’t follow OOPs.

    Overview

    Creating great applications that are maintainable and extensible should be a higher priority than implementing software principles and practices.  Knowing when to not follow them is a sign of great experience.