by noelwelsh · 11y ago · 0 comments
To learn to code is to learn to model systems. Programs are built from components -- abstractions -- and good programmers know a wide variety of abstractions and understand how to combine them to achieve the desired effect. A good program is one that accurately models the phenomena of interest, whether that phenomena is something as simple as "display the user's profile" or a complex simulation like a game.
Now I would agree that many of the current curriculums are terrible, and teach no great insight into modelling. But that is the fault of the curriculum designers -- often people who have neither great experience in teaching or in programming. That doesn't mean there isn't good work being done, such as the Program by Design team (http://www.programbydesign.org/).
In short, I think the blog post builds a straw man argument. I agree it absolutely belts crap out of that straw man, but that is beside the point.
One of the things this program hammers in early is fundamental programming principles like OOP. A lot of MOOCs skirt around these topics, forcing you to 'build' non-functional apps first. I've taken those courses and learned nothing of real value.
This program, where I've been forced to learn algorithms, OOP, etc. has been of much higher value. It's been harder, but I feel like I'm actually learning the fundamental principles of programming.
I'll echo your sentiments: to learn how to program is to learn how to model systems.
"...fundamental programming principles like OOP."
The key word here is "like". OOP is actually falling out of favor as a successful way to express models. Make sure you investigate alternatives to OOP (functional, procedural etc). As a graduate of OOP myself, it's interesting and exciting to approach different paradigms. Experience tells me that the best practices obsess over what things "do" rather than what things "are" (which is a fluffy concept at best).
Anyway, tit for tat, YMMV. Glad you're doing something though.
In fairness, a lot of us never truly embraced OOP anyway. I've always avoided objects unless I'm managing state. Even in OOP languages, much of my code essentially repurposes objects as modules for storing functions. The fact that they are implemented as methods is incidental. This is not an uncommon pattern.
It doesn't help that it's easy to overdo your taxonomy, or try to model objects after the "real world" (rather than your domain model). Examples in some textbooks are pretty bad... if "dog" inherits from "animal" then you should throw the book out.
It's happening on the front-end as well, with things like React.
This is like saying:
"Noun-based writing is falling out of favor as a successful way to express stories. Experience tells me that the best practices obsess over what things "do" rather than what things "are" (which is a fluffy concept at best)."
If a writer didn't use verbs and nouns when appropriate, nobody would read their writing. You would consider such a writer to be almost illiterate.
Of course it's useful for a writer to experiment with focusing on verbs or nouns, and there are situations where one may be so much more useful that the writer should eschew the other entirely. But a dogmatic approach that tries to eliminate all of one or the other universally is bound to lead to bad writing.
And the same goes for coding. Focusing dogmatically on one methodology is only going to limit what you can do.
I am, as things stand, still in the process of learning the rules.
Once I've mastered them, perhaps I can think of breaking them.
Which, in the meantime, might mean learning things that have gone out of favor.
OOP is not a fundamental programming principle. Its a recently popular programming paradigm. The idea that OOP is a fundamental programming principle is a harmful concept to internalize (though lots of programmers trained in the last ~20-25 years have internalized it.)
It's not the only way, and it's not always the best way. But I think you do a disservice to the English major you are replying to by suggesting he or she is learning something "harmful" to their future development.
I'm not saying your point is invalid or incorrect. I just think someone new to programming will be best served by learning how to write useful programs in one paradigm, before exploring multiple paradigms, or worrying about whether they are using the "right" one.
I would say the same thing to someone being taught the functional paradigm as a beginner. It will make more sense to compare with other paradigms in the future, once you have some mastery of one paradigm.
Genuine question.
Right now, for instance, I'm learning about different data structures. Recently, I learned about different sorting algorithms.
Would you say these are fundamental to understanding programming?
- Modularity/Separation of concerns: The different functions a program needs to accomplish should be uncoupled as much as logically possible, to the point where you could easily swap out one with another way of accomplishing the same objective without affecting anything else.
- Don't repeat yourself: Any time you're writing nearly the same thing over and over, that whole pattern should be abstracted away.
- "I've only proven it correct, not run it.": You should be able to test the software in an environment that shows you what it would do, without affecting the thing you really want to operate on.
- Write in a way that other humans can easily understand what you're doing. (e.g. name variables after what they're being used for, write comments help the code make sense and convey any tradeoffs)
Learn you a Haskell for great good instead.
Functions and types are fundamental. OOP not so much. Computation is fundamental, state not so much. Higher-order functions are not quite fundamental (depending on your point of view) but pretty close.
This means we needn't fully specify a system to get
started, we can simply craft new pieces as we go. We end
up exploring the system as we create it and don't have to
get a "complete" model to gain value.
This is an essential part of the article, and why the author has a valid point.The problem with most current approaches to programming is that they don't provide good support for this partial, incremental way to build models - either your abstractions are fully developed, or they don't work at all and the program crashes during execution; there is no middle ground.
Professional developers eventually learn how to build systems incrementally through testing (by building placeholders for yet-to-build components) and debugging (by exploring how the program behaves under different inputs), but these tools are complex and not really part of the programming language, and thus not adequate for basic literacy.
Excel and Hypercard fall out of this requirement for perfect modelling, allowing partial execution of parts of the program, and intermixing data with the code that works on it, lowering the abstraction barrier; thus these tools work better for exploratory modelling than conventional programming languages, which keep data and commands wholly separate and require an exact specification to work.
They have shortcomings, but the article is right that a tool for the wide public needs to reduce the level of formalism required to build models, and that "the computer revolution" based on that "lightweight modelling" approach has yet to come. There is an emerging movement for "live programming" that has created environments closer to that approach. This is still in its early stages, though we think we're finally close to achieve that vision.
*Edit: format