TIL, 2019-09-22
Coding is not the new literacy
- Literacy is not just interpreting and making marks on a sheet of paper (reading and writing).
- Reading and writing are the physical actions we use to employ something far more important: external, distributable storage for the mind. Being literate isn’t just a matter of being able to put words on the page, it’s also about solidifying our thoughts such that they can be written.
- Writing if statements and for loops is straightforward to teach people, but it doesn’t make them any more capable. Just like writing, we have to know how to solidify our thoughts and get them out of our head.
- Reading and writing gives us external and distributable storage. Coding gives us external and distributable computation. It allows us to offload the thinking we have to do in order to execute some process. It seems like all we need is to show people how to give the computer instructions, but that’s teaching people how to put words on the page.
- We build mental models for everything, and with these, we make decisions, predictions, and understand our experiences. If we want computers to be able to compute for us, then we have to accurately extract these models from our heads and record it.
- Modeling is the new literacy - this is about creating a representation of a system that can be explored or used. If we understand something, then we can break it down until you arrive at ideas that a computer understands and actions it knows how to do. In either case, we have to specify our system and we do so through a process of iterative crafting.
- Software: Matlab, Excel can be used to model their lives. Outside of the Internet, the spreadsheet is the single most important tool available to us on a computer.
- When more people learn about programming, we don’t want people to focus on things like Unicode, we want people that can leverage computers.
Code smells in CSS
- Undoing styles: Any CSS declarations like
border-bottom: none;
,padding: 0;
,float: none;
,margin-left: 0
, are probably bad.- You probably applied them too early.
- Ideally, you should only be adding styles, not taking away. If you find yourself having to undo styling, chances are you started adding too much too soon.
- You end up writing more CSS to achieve less styling.
- Magic numbers:
- If you can do a thing like
top: 100%
, then much better than thetop: 37px
thing.
- If you can do a thing like
- Qualified selectors like
ul.nav
etc. Because you can just do something like.nav
and then that would be reusable in another class. - Brute-forcing is bad - stuff like
z-index: 9999
. - Dangerous selector: selectors like
div
. !important
should be used proactively, not reactively. Using!important
reactively is just a way of circumventing problems caused by ill-formed CSS.- IDs: You’ll never want to use this because they almost always be more than 1.
- Loose class names like
.card
- they are hard to understand.