Deep Diving: React

I’ve had the opportunity to dive into React quite extensively for the past two months. Large project. Many, many components. Rather complicated setup on the backend, including a Python CMS which hydrates the SPA, in many different ways, including acting as a REST intermediary service for some other 3rd party APIs.

My take away from this so far is: React is not as bad as what you would think based on the extensive framework flamewars all around the interwebs. It’s very easy to get sucked into this whole discussion, but you lose sight of what this thing really is: a bloody tool to get bloody things done. No religion there.

I actually ended up playing around with React in my spare time and gave styled components a go. That was actually quite interesting. This current gig requires me to write CSS according to BEM, which heavily componentizes CSS as a whole. But I noticed that the resulting CSS is huge – the more components, the more SASS mixins.. the more bloated the CSS becomes. Why to write componentized code when it all ends up in a huge bloody file at the end of the build process, anyways. But I do like components and tightly specified CSS.

Styled components basically force CSS to be inline at all times and takes care of the specifity of selectors on a component level. I spent a few hours trying out a few things based on a react boilerplate app and was surprised how easily I could get a fairly complex style definition going, still using a mixin approach (higher level components) for mediaqueries, typography and block level layout and the entire theming, like I’m used to with SASS.

The biggest downside for now is that for example VSCode can’t parse styled declarations well, no autocomplete and no linting. But I’d call that a minor annoyance.

So far, no surprises and components are as manageable as when you’re using CSS modules. With the added perk of not having to leave the JS mindset completely while styling components.

In terms of performance: this might become an issue for projects relying on 100+ components. Probably. But then, maybe the entire architecture should be revised instead of being concerned about loading time of inline CSS.

In a sense, styled components feel like more tightly integrated BEM patterns, without having to write the awkward class names yourself.

But what I’ve learned in terms of using React as a framework is probably, most importantly, the fact that if you decide to go with a frontend framework, you should embrace it and abstain from trying to merge and crank some other concepts in, around or on top of it. If you need serverside rendered content, use the framework’s approach and keep things separated and clean. Probably also try to abstain from migrating your old framework’s stuff blindly over to React and instead start completely from scratch, because you won’t need half of the crap you migrate, anyways. Embrace the frameworks flow and adjust your own accordingly. Try to keep dependencies as loose as possible (for example frontend/backend stacks), so you can act quickly to revise decisions on how the project develops as a whole. There’s nothing more frustrating than being stuck with a stack that you know “sort of sucks” but everything is already way too interwoven to change anything without causing a chain reaction.

I’m still looking around on how to best solve the content management aspects of SPAs in the simplest possible manner that doesn’t require a fancy build setup/deployment for smaller projects. If we’re completely honest, a flat file PHP cms for content editing that provides a REST API is probably going to cover the needs of at leat 90% of all projects we work on in the small and medium business website segment. While it sure is fun to run a dev ops mission and deploying docker containers and stuff, its not really necessary and overengineering things in most cases.

But anyways. I was proven again that you shouldn’t judge something before you got a good chunk of experience of actually using it and probably most important, join the flow of how things are being done, rather than questioning every bloody opinionated method. And, for the love of god, ignore all those medium articles and fiery rants in the first place.

Dirk Gently’s Holistic Detective Agency

If you don’t know this series already, I greatly suggest you get your hands on it. I watched the first season in one session. Crazy, I know. But whaddyagonnado! Super fun, nerdy, full of twists and heartfelt.

Coincidentally, this overlaps with my current Hitchhikers Guide to the Galaxy audiobook session. Douglas Adams, man.. genius. Just the right kind of crazy. Definitely going to dig for the novels of the above TV version.

Fucking cultists

If a life crisis has something good attached, it’s probably that you’re at a point where it is relatively easy to question how you lived your life to date and wether there’s things that you need to consider if you want to improve your quality of life. I got into the whole nutrition topic at some point, not because I have an acute health issue. I just want to live healthier, because I realised that I simply did the opposite. My ears were open, so when something came along that seemed interesting to read or watch, I just did.

I ended up reading a lot and I came across 2 documentaries, “We love paleo” and “What the health” in this order, both specifically dealing with nutrition. The first is basically promoting paleo, the second veganism.

The topics and arguments overlap to a huge degree. And I can agree that the problems are much larger than what we stuff into our mouths. Where does it come from, what is its footprint? All of these approaches have a common ground and a common goal. Which is great. This awareness affects your decisions, as well as your role as a consumer. Awareness is the keyword here.

The only problem that I have with most of the information out there dealing with “nutrition lifestyles” is that they very, very quickly turn into some sort of semi-religious discourse that is as monetized as everything these guys are criticizing. These two documentaries make my point pretty easily. The way the documentaries are structured is almost identical, people with personal stories talk about their transformation, lots of “experts” talking, lots of facts that are not entirely lined out, no link to a list of sources, arguments laced with emotions. The more you dig around for additional information, at some point you realise that this is all manufactured by “members of the cult”. This is really not helpful. It is inevitably manufactured itself to be a PR piece, even if part of their message is to show that corporate interest itself is the fundamental issue here. So battling PR with PR. Agenda with agenda. Fucking useless, constructed PR arguments that are not supposed to inform you rationally but try to lure you into some kind of a cult. The “all or nothing”.

Can’t we just establish facts for a moment without having to delve into conspiracy theories? Are we trying to look at the big picture or is the big picture just a hook to get you to join a lifestyle cult? Maybe it’s just simply wrong to connect the big picture (ecology, economy) to the personal issue (nutrition) as it creates a large number of paradoxical situations.

I’m not a fan of how animal products are produced in this age. And I’m the first one to tell you that it’s most probably wrong to buy animal products. The harm it inflicts on other parts of this complex system we live in is substantial. But so is the mass production of coconut products (famously used in the paleo lifestyle) or almonds, palm oil products and other plant products. They all affect the system.

This isn’t just about what you eat, it’s about where you buy your food, which legislation you vote on, the economy and the political system as a whole. If you think you make the world a better place by switching out one bad thing with another bad thing, nothing’s gonna change. All you did was create a bubble around your ideology that works in your belief system and off you go, booking your next intercontinental flight to fucking Bali to have a 2 week retreat in a Yoga resort or drive around with a VW bus that is “kinda hippy” but uses 10 times more gas per kilometer than any other semi-modern car . What. The. Fuck.

They all make points that are good. I’m not saying either is bullshit. But they all are, some more, some less, self-inflicted hypocrites.

Funny thing is, I can replace a few keywords of this text and it applies as much to nutritional lifestyles as to JavaScript frontend frameworks. Oh the irony.

Rule of thumb to select a JS frontend framework

This is the condensed version of my experience with JS frameworks from working on multiple different web apps built with different frameworks in the past 4-5 years:

  • Forget Angular if you are not willing to obey a strict set of opinionated ways of doing things, a number of sciencey approaches that sound really too complicated for the output it produces, dealing with build issues based on unstable tooling and instead, go for something like VueJS or generally with something that doesn’t encapsulate your way of thinking like Angular does. Maybe even React, but I don’t like Google nor Facebook, so .. 😉
  • For UI components, you can plug Quasar on top of VueJS to end up with an Ionic alternative. It’s not as mature, but taking into account that VueJS is much simpler to get started with and is a lot less dogmatised than Angular, you will be a lot more productive.
  • If you only need to add a bit of interactivity to a HTML form, use jQuery and don’t even think about setting up an MVVM(like) framework with all the moving parts and build procedures and thousands of npm modules.

I witnessed countless discussions circling around React VS Angular VS VueJS VS Knockout VS .. too many, I think. So many, that I actually think most developers get caught up in a technolgy discussion that has nothing to do with solving the actual problem of the client or the product they’re developing.


Complex systems

Everything is connected. That’s the simplified take-away from complex systems theory applied to biology or any other field of complex systems. Evolution, in itself, seems to be striving for complexity. In other words, complexity is the result of an evolutionary process.

I’m by no means an expert, but it’s fun to play with this idea. It seems as though this is a universal concept that flows through everything and everyone. Sounds kinda far fetched, but stay with me for a moment.

Technology seems to be bound to the same concept. Progress is only going to happen, if technology evolves, thus creating more complex systems to solve previously unsolved problems, creating further problems in the process (therefore requiring more complex systems to solve them.. and so on). That sounds suspiciously similar to a fractal. However, the side effect of this process is that simple problems then can require immensely complex solutions because it can be observed that systems of various complexity behave like organisms in an ecosystem. Ideas, technologies are as much part of survivalism as any other concept. They inherit functionality from their parents and, if thriving, create new offsping in the form of new ideas. Something sound familiar so far?

It’s fun to think about that, because we seem to detach our own existence so gravely from the system we are in fact a part of (“universe”), thus also remove the systems we create from it. Yet, we are technically a product of the universe, so then our creations are aswell part of that same progression of chords. And therefore, why shouldn’t they be depending on the same rules and patterns as much bigger concepts?

The thing is, if complex systems are in fact one and the same “progression of chords”, just being played in different octave, “being” evolution, biology and even the cosmos itself, then that would predict some of what is going to happen with systems we ourselfes created, too. We can already calculate tipping points of complex systems of a certain scale. We could therefore establish, that all systems have a tipping point, no matter how complex they are.

Is there something like a complex system that is too complex? In nature, the physical world, systems are bound to exist in certain boundaries. An ecosystem can only be so complex as the parts it’s made from. The interactions are limited, because there is a limited amount of subjects and objects. If we take the ecosystem on this planet as an example, it had millions of years to evolve and it eventually balanced itself out in a way to become a fertile ground for other complex systems to thrive in. That does, amongst other things, include us as a species. And still, it required a black swan – or a number of those – for us to be where we are now.

Thinking about it this way, it could be hypothesized that for a complex system to evolve, a cataclismic event is always required, that manifests itself as a black swan. A rock falling from the sky, causing an entire dominant set of species to go extinct, rapidly changing an entire set of variables. Thus allowing something to evolve that woudn’t have had a chance otherwise.

It’s a great exercise and mind-opener to try and find such tipping points for small and large scnearios in technology or human history itself.

Unfortunately, the amount of vocabulary available to me doesn’t provide me with enough options to put that into words. I leave that to the literary talented people.

Peter Sjöstedt-H, Philosopher

Interesting reading material (also check out the two books), especially if you’re dabbling with psychedelics. Also featured on this podcast on youtube. His writings seem to have been fundamental in creating (“moulding the character”) Karnak, a hero from an upcoming Marvel movie.

Concerning the self-help “spam” on Medium

Being great, being more, is a life struggle and telling people to follow these few simple steps, few simple mantras, to some epic greatness is the most irresponsible of lies.

Just when I started to include a daily scan on Medium in my morning coffee routine, I noticed the exact same thing. My newsfeed is populated (still to this day) with countless self-help articles. I can’t get rid of them. For one eventually insightful article, there’s 20 overly enthusiastic “You can do anything” articles. But I hate to be the one destroying this illusion, but no, you can not do anything. Not by mimicking Steve Jobs diet routine or combing your hair like Richard Branson. Nope.

Mercantilism / the reason you answer your work email on the weekend

But with mercantilism, one of the first major economic theories, how a person spent his or her time directly corresponded with the wealth of the entire country. According to economists of the time, any form of waking idleness lost a country money — and was declared a grave sin. The time between seasons and harvests, the time between anything at all, if not spent at work, was simply and suddenly a waste.

So, I’m technically a sinner since I spent half a year doing nothing. I get that. Honestly, that’s how a burn-out does make you feel. That is also why the UBI (unconditional basic income) sounds like you’re throwing money at a bunch of freeloaders. Our entire society is conditiond and indoctrinated with this – relatively young – concept.

The Brotherhood of Eternal Love

One could argue that these guys basically enabled what we look back at nowadays and call the summer of love. Interesting, yet tragic. Or maybe not enable – but they played a major role that probably no one really realised. Especially not here in Switzerland..

Should be readily available on your favourite torrent tracker. Just to keep the spirit alive of making stuff available for free for the sake of enlightenment. 😉

Probably the most tragic observation is that Leary felt in the sixties already that the system sort of doesn’t quite work. That there is an imbalance of power, to say it like that. And here we are, almost 60 years later and it feels weird to look at the world today with these things in mind.

The more I read about this specific period of history, especially about the psychedelic movement and it’s interaction with politics and the economy on a global scale, the more fascinated I become. This is so much more than a bunch of hippies going rogue. Something much bigger almost happened, ending with Leary being incarcerated and effectively silenced and removed from the stage, just before entering politics. And the subsequent dissolve of the movement without leaders.

Just thinking about how things might be different is interesting. Not implying it would be the solution to all problems.. certainly not. But reducing this movement and period of time to a best of album and a bunch of images of people with long hair and beards is a gravely oversimplified version of reality. This is when politics started to become lifestyle marketing in the US, when the war on drugs started, globalisation started to take off, banks became a force of the state for good, the beginning of the age of information and global mass media.. basically everything that put us on this track we see today. And no, I still don’t know wether that’s s good thing or s bad thing. Probably somewhere in between..

This was the last time in recent history the status quo has been questioned on such a deep level. Not like any other subculture. And the conformity machine has won.

I yet have to make a clear picture of this, but .. interesting, nonetheless.

The interactions of society, the movement, economy and politics of that era are very interesting. Or did you know that one of the first guys to promote the idea of cyberspace in the nineties (and thus subsequently VR) was a key figure and member of the  “acid test” movement in the sixties? The guys who made the “hippie bus” a thing? I think we probably owe a lot more to Albert Hoffmann in recent history than we allow ourselves to admit.

I think we need to dig a little deeper.