About Jeremy
Jeremy Keith is a man of many talents and large intellect. He focusses mostly on the ways people create websites and why they do what they do.
He is a website builder, book writer, podcast host and event speaker. Currently he works for Clearleft.
Declarative Design
The topic Jeremy talked about was the different types of programming. He compared it to music. for example:
- Mozart: Very precise instructions on how to play.
- David Minus: Improv style, without instructions.
Programming
Programming languages can be divided in 2 types.
Imperative programming
Imperative programming works with step by step instructions. You need a good understanding of the code to work with it. Here is an example of the logic of imperative programming.
- create an array of items
- Loop through each item
- Test if a condition is true
- Return the result
Imperative programming is a lot harder compared to declarative programming, but it does come with a lot more options. They are strict so your life is easier, for example in debugging it shows you where the problem is.
Declarative Programming
With declarative Programming you need to specify the outcome you want in simple language. For example some SQL:
- SELECT Items FROM table WHERE condition IS TRUE
This is way simpler to do but also comes with some limitations. This way works for almost everyone but cannot be used to be as specific as imperative programming.
Declaratie languages are forgiving making it easier to learn and friendlier. but dont give you as much power.
What we use
In our study we mostly use Html, CSS and Javascript. Jeremy explained to us what types these languages are.
- Html = Declarative ( domain specific language)
- CSS = Declarative ( You give suggestions to the browser by writing css not commands )
- Javascript = Imperitive ( You have more power but also more responsibility, Mistake make everything go wrong. )
Mindset
Even in a declarative language you can have an imperative mindset, and also the other way around.
“JavaScript should only do what only JavaScript can do”
The question Jemery asked himself and others was: Why do people use javascript when it can be done with html
- Control, You can control every aspect of the element yourself (Imperative over Declarative)
Usability
Giving up some control for usability isnt a bad thing. For example:
- You can set the font size from 16px to 1rem, so people who set their default font-size larger can see it larger.
- You can have Padding-left be replaced by padding-inline-start;
Using this on your whole page can make a good looking responsive website.
/* Good: */
font-size: calc(0.5rem + 0.666vw);
/* Better: */
font-size: clamp(1rem, 0.5 + 0.666vw, 1.5rem);
We design the big and the small viewport sizes, The computer does the middle part.
Calc()
Clamp()
min() and max()
fit-content()
min-content and max-content()
“Be the browsers mentor, not it’s micromanager”
Jeremy also gave us a site to look at. It shows the best practices: utopia.fyi
declarative > imperative ?
Is declarative better than imperative? Well that depends on a few things:
-
On Culture (environment of the designers)
- Imperative Management (getting tracked and measured makes it hard to be imperative).
- Declarative Management (Getting freedom to do it your way and on your time).
-
On Design Systems
- Imperative Design Systems (needs computed values to work properly: #928343)
- Declarative Design Systems ( doesnt need any computed values: The border needs to be 10% lighter than the button )
-
On the Teams
- The kind of team you are on makes a big impact on your work, Is your team working imperatively, You should too
-
On the Medium
- On what device or platform you are working
- Although most of the mediums you work on on the world wide web demand you to be flexible.
- “The more you tighten your grip, the more the world wide web will slip through your fingers.”
Thinking:
There are 2 ways people think:
-
Analytical Thinking
- Breaking something down into its parts and looking at those parts.
-
Systematic Thinking
- Take a step back and look at the whole system.
Css has grown significantly. It works very well with a declarative mindset
Reflection
The lecture Jeremy gave was at the beginning a little boring because i didn't see what he was trying to say. But the longer it went on the more i understood. When he started talking about how the different mindsets work in the workfield it really sparked my interest. He knew what it was like to work for a company that had a different mindset to his. When he was talking about declarative vs imperative thinking i also thought about it myself. I see myself as more of an imperative thinker. I like to take my thoughts and divide them up into their parts.
For my selfimprovement
The things i will be using from this lecture are:
- Try thinking a little more declarative some times. Just to get a larger scope.
- Whenever you are working at a company, Try to look at what way they all think. This will help you figure out if that company is good for you