Harry Roberts @ #btconf
Written by Jan Beck on in Düsseldorf, Germany.
“Architecting Scalable CSS” - notes from Harry Roberts talk at Beyond Tellerrand 2013.
The LEGO Analogy:
- Lots of blocks are far more versatile than whole strutcures.
- Blocks can be combined with all other types of block.
- Break code into the smallest little blocks possible.
House vs. Website
- Built in months, lasts for years.
- Numerous workers with different skills.
- Built by some, maintained by others.
Breaking things down
Harry shows how Subway breaks down a sandwiches into small pieces. This allows for millions of different combinations of sandwiches.
- Everything should do one thing, one thing only and that one thing well.
- Allows for greater amountes of combination in steps.
- Lots of smaller, single instances.
Shows UNIX piping: Bits can be added or omitted with ease. Can easily be combined with different results.
- Use multiple classes instead of few. They can be renamed faster, than CSS can be refactored.
- Split the load between HTML and CSS.
- Use hashed classes instead of IDs like
<ul class="nav #main-nav">to identifiy unique objects.
Music is the space between the notes.
→ «CSS is the space between classes.» Perfect.
Comments & Clean Code
Clean house, clean mind.
You do your future self a favor when keeping code well maintained.
Add in extra time for maintenance when estimating how much time a new feature takes to implement.
- Nothing is 100% right the first time.
- Things get worse as time progresses.
- You can’t do better than your best.
- Stop caring too much; it’s just code.
If a nasty stylesheet is your only problem you are luckier than most people.
- one job, one job only, one job well.
- keep specificy low.
- run a tight ship.
- keep on keeping on.