In this video we’re going to talk about tortures, endurance and perseverance
- Just because your language is widely used doesn’t mean it is any good.
There are also progressive web apps, which have the biggest support from Google. One example is the YouTube Music website. If you open it in Google Chrome, it will suggest to you to download the website as an app. And that’s the progressive part of it — that it progresses from being a website to an app.
So what are the problems with this standard? It follows a thorough bureaucracy. There is a committee and many phases a feature has to go through to be added. So it’s slow to add new features. Plus, all the concerned parties are enormous in numbers. So yeah, it is slow. Then this standard at the end of the day is just a suggestion to companies like Apple and Microsoft.
So they may postpone implementing certain features of the standard forever. They may deviate slightly from the standards or they might develop their own features that are not part of the standard at all.
And it also shows you how many users worldwide will have no problem with this feature. So here, for example, 96% of users worldwide will be able to use your website with this feature. Then the community of enthusiasts took it even further and implemented a set of transpilation tools whose aim is to make your code compatible with older versions. So essentially you provide a config and you select which browser versions you want to target. So here:
- not Internet Explorer
- the latest two versions of of every other browser and
- every browser version that has more than 5% usage worldwide
And then you write whatever code you want using the new features or old ones and the set of transpilation tools will do their best to make your code compatible with these versions.
So three lines of code may become an abomination like this, but it will work. This set of tools is so good actually that the internet giants like Facebook and Google include it in their major frameworks, Angular and React.
Let’s talk about the design that was established in the beginning, the way I see it.
But there is tech to bring order to this chaos.
- Then you can also add the code linter to your development process and get a uniform code style across your app: spaces, semicolons etc,. But also, you will get a complexity warning wherever your code is too complex and you will have to simplify somehow, which is a good practice to make your code more readable.
- And the first problem is sharing data between threads is not easy. Imagine that one thread is processing some data and then the second thread changes this data midway. And now the data is corrupted for the first step because of processing. So yeah, there are ways to prevent this, obviously, but it’s not easy for sure.
- The second issue is that when a thread needs some data from an external data source, it has to send the request and wait and stay idle until this data source returns something. That’s not super optimized.
- And then also there is always a limit to the number of threads on any given CPU. So threads are limited, and then some of them just stay idle, which is not optimized.
Let’s look at one example here, again, button click and key press programs need to run at the same time. But since it’s a single thread only the Step 1 of button click can run right now. So that’s what it does. And at the end of Step 1 there is a request to a server, for example, to get some data.
And while it’s occupied, Step 2 gets put into the task queue, because the response from the server finally comes. Step 2 cannot be picked up by the thread yet because it’s thread busy with Step B.
It finishes and moves on to Step C, again, occupying the thread. And so Step 2 yet again cannot be picked up so it becomes inpatient. Finally, Step C finishes as well. And now two can be picked up by the thread. And you see, Step 2 is very happy about this.
Step 2 finishes and Step 3 finishes as well, and we’re done. So that’s how it works. And the sharing of the data is easy here because no two steps access data at the same time, they don’t run at the same time ever.
Tech to kick it up a notch, to improve parallelism.
Workers are additional threads that you can start. And the limitation is that these web workers cannot access cookies or HTML elements. So the use case is pretty narrow in my opinion. You can send messages to it and you can receive messages back. They are great for heavy mathematical computations, for example, Bitcoin mining. If you ever want to do that, web workers would be the choice.
Then there is a special kind of web workers called service workers and the idea is that they can work even if a website is not open. So they are great for push notifications and pre-caching when you download a new version of a website beforehand and then when the user visits the website, the new version is already there so it loads faster.
Inheritance is very funky and it is more powerful, but also a lot more confusing and error prone in my opinion than in Java.
Now HTML and CSS.
You need new CSS features because they simplify hard problems. The websites become even more beautiful every year. So really you need a solid technology behind it to make it look good. And also I don’t like the fact that HTML and CSS are looked down upon as if they’re not, like programming languages, or whatever. I think it’s very hard to write a good frontend and it takes skill and creativity. Just wanting to say that, and my personal recommendation which helped me a lot: Flexbox is amazing.
Once I learned it, I could solve 90% of the issues I had with positioning and responsiveness. So I recommend.
- It has the largest developer community because of that, I think.
- And if you’re a frontend guy, just pick one of VueJS, React, or Angular frameworks, because they are completely safe to work with. They have rich ecosystems and an enormous amount of recipes for every kind of situation.
- Some cool concepts from those frameworks are:
- Virtual DOM
- Ahead of time compilation and
- Reactivity via proxies in VueJS.
They’re all worth learning.
So, yeah, with this context, I feel very secure about reading memes like the one I mentioned in the beginning, and I do appreciate them still, and will always laugh at them, and will always share them.
So keep on making those. I hope this was interesting. And thank you very much, make sure you check out our kayzen.io/careers page because we are hiring.
Thank you very much. See ya.