Non Linear Programming with Web Components

December 20, 2023

Arrival Alien Language

A favorite movie in the Patton household is Arrival with Amy Adams. SPOILERS: The first time around the movie is suspensful and somewhat hard to track. But the more you watch and appreciate Amy Adams magnificent character and understand that Alien’s came to gift humans with a language that transcends time, each time it gets better and better.

The article name, Non-linear Programming is a bit misleading but it will illustrate my point.

The rest of the article below is a hope I have for React one day. I still use React daily and there are so many things I love about it. I love teaching varying concepts/tools in the React ecosystem to other developers. There are many things about Web Standards I envy, and many things about using React on a daily basis that have lead to pain in the work, thus this article.

Linear Programming

The vast majority of us are caught up in what I would call ‘linear programming’. Set aside the reality that non of us can escape time, many of us spend our days chasing someone else’s “progress”. How much of your DevOps team is built for CI/CD due to breaking changes shipped by software and tools whose authors are rapidly changing unaware or uncaring of the wake they leave behind them?

These authors are sprinting to keep on the cutting edge of linear tech fashion while most of us have people, bosses, companies we are responsible too and cannot willy-nilly ‘keep up.’ Thinking “progressively” is not always pragmatic. Progress for the sake of prgress, progress to always be seen on the cutting edge is fine for personal fleeting fancies and ego driven development, but doesn’t contribute to the large ecosystem of developers.

When your marketing engine has your company going at Formula 1 speeds or you give into the notion that you have to be going that speed in the first place, you have succumbed to a rat race. You have to stay on a track. You cannot travel the open road.

This is not inherently specific to tech companies, although it is very specific to tech companies and tools in this article. Everyone likes to quip about the tortoise and the hare while still acting and setting their life up like the hare. This is a natural human thing to do. To react to life instead of respond to life. Responding to life means taking stock. It means being poised and making choices with clarity and wisdom. Reacting to life means you are a powder keg about to explode in whatever situation you are in. It may be a great name and a good metaphor for somethings but it is not a great way to make decisions.

Oddly this doesn’t seem to be about programming at this point and yet, it is all about programming. The assumption for all of us is that we are always moving towards our goals and yet many of us don’t know what those goals are. We have thoughts about things without any careful planning. We run experiments and think we know where we want to go. We choose “efficiency” and yet continue to add more roadblocks on our path by not doubling down on choices that lead to longevity.

Linear programming leaves you exhausted, discouraged, and tired of the thing you once loved.

Some will push back and say “for the joy of coding” is why you should be doing it. I don’t disagree. But joy of coding is a phrase rife with subjective interpretations of joy. I want to show up everyday knowing I did a good job. I want to build things that last. I want what I build to be reliable, maintainable, and great. When you program linearly you have most likely adopted tools and practices that prevent you from realizing that dream.

So then we attempt to make ourselves feel better with “well just do the best job you can.” I think that sounds good but if you spend any amount of time thinking about it you will get to the point of knowing “yes, I did the best job I can with suboptimal things which means the job I did will always be suboptimal because I know it could be better.” Maybe you are the person who wants to put in after work hours to fix things. But wouldn’t it be nice to go home when the day ended knowing what you did today, if you never touched it again would be there whenever you check in?

Like a master carpenter who built a masterful chair, you can sit in it for the remainder of your life barring some natural disaster or unexpected event.

Non-Linear Programming

As one who tends to be more emotional about life, I tend to be more reactionary to things. It takes considerable discipline to not listen to emotions. I’m not talking about any one emotion but more so the spectrum of emotions.

“I saw snake on the porch”, I say to my wife. Seconds later I am actually anxious about that snake being in our room or attacking us or our son in the middle of the night when we are helpless. Irrational, obviously, but it is reactionary.

Non-linear programming is about a poised approach to building software. We are in a renaissance of sorts in the dev world with html and web standards. I want to say I am early to the party. But honestly that attitude is part of the problem.

Chris Traeger realizing he is part of the problem with women not be represented in government in parks and rec

Non-linear programming, as I am referring to it here, is the ability to write software that lasts. When I learned web development, I learned react. And I am grateful for what I learned and being able to get a job when I graduated. But I have noticed about my new career that I am always, always playing catch-up with react and its associates. They are on a linear track. React is what I knew so I assumed it’s what I should stick with.

You can do incredible things in react. But always keeping up with something was the choice I had to make so as to not fall behind. Ironically this attitude is the same reason it is difficult for a React developer or other framework developer to think about Web Components. The feeling of using Web Components and writing them in classes is one of “going backwards.” Why? Because the React narrative has been that what comes from that team is cutting edge and is progress. Meanwhile, most people who are more “senior” in age, and I am not referring to old but those who have 15-25 years of experience in software, have been pleading for some time to not get caught in the react quicksand.

My favorite definition of Web Components has come from Rob Eisenberg. The definition is:

A collection of web standards that enable an HTML native comopnent model.

The biggest feature of web standards and the component model is backwards and fowards compatability. Not only are web standards risilient for the future they are also designed to work with older versions. For web standards technologies you can simply upgrade to the latest version without breaking your application.

This is not true in many cases for the current state of frontend frameworks. More specifically this isn’t the case for those of us using React and Nextjs. If you seek to keep up with those two, many of the other things you have implemented will fall behind. So you either hold back on keeping up with the framework for the sake of other libraries and code, or you figure out how to refactor and move beyond to keep up. Either way you are responsible for the problems introduced by someone else even if it is in the name of innovation.

Non-linear programming through use of web standards allows for creation of resilient software and high ability to ship core logic making development effort more useful and honestly providing a “better DX.” Not only are you building things that won’t break you are also providing great user experiences allowing us to therefore care about what we are here for in the first place, the users. Yes you can use Typescript with Web Components should you desire to do so.

Conclusion

Due to the hard work of Browser teams and Web Standards teams, the web platform is a true marvel. Being able to think of, build, and ship software that lasts was a dream. Many of us entered this strange wide webby world and were overwhelmed with the feeling that we had to “keep up” with all the things. At the core of many tools and technologies that “ever evolving” notion exists alongside the “survival of the fittest”. Meaning, you either keep up or get knocked out.

With great irony, the platform those same technologies are built upon are providing a way for you to evolve as much as you want with the platform and escape the proverbial treadmill race.