this post was submitted on 26 Feb 2024
189 points (95.7% liked)
Programming
17540 readers
74 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I found it useful when explaining programming to lay people to try to put various programming paradigms in everyday terms.
Imperative programming is like a cooking recipe. You need specific ingredients in certain amounts and you need to perform actions in a very specific order, or the recipe won't turn out right.
OOP is like a bicycle. Lots of pieces interconnected and working together, hopefully interchangeable and standardized. It can also be used to explain unit testing to juniors. Clock mechanisms or engines can also work but people tend to relate better to bicycles.
Declarative programming (SQL) works like ordering at the restaurant. You still need to know how restaurants work and about meal courses and how to read the menu etc. but you don't need to know how the sausage was made, only if it's good or not.
SELECT food FROM menu WHERE name LIKE 'Fried %';
Lemme
cat menu | grep Fried
real quickYou don't want to order from the cat menu.
grep -i fried < menu
grep -i fried menu
Of course! It's amazing how this stuff just flows from the keyboard when you're typing in a shell window, but feels awkward when typing in a Lemmy comment.