The difficulty of programming depends on the layer and quality of abstraction
okossa.com
okossa.com
- When all you need is a function, don't make an object abstraction.
- Restrict your abstractions to at most 2 levels of depth (a base class and derived). It becomes more intimidating to figure how the flow goes if you have deep object hierarchies. This also helps to encourage forms of composition.
- Again, don't make an abstractions that provide little to no value to suit some orthodoxy or perceived 'best practice'.
I also love YAGNI - You Ain't Gonna Need It!
I still stick to two levels of inheritance max though, and most of the time I only use interface inheritance. Rarely do I want behavior inherited.
There are people who think they need a singleton all the time, imagine where similar definition would have brought them.
How a function is defined varies from language to language, but if we're talking about a globally accessible named function, this is in effect a singleton.
It means you can't configure this function (through construction parameters), or replace it, or mock it, etc. it's in effect a "singleton function".
BTW, abstraction != inheritance.
Once you get at that level, objects are life savers. Because then state is explicit on code rather then hidden in deep call stack and spread over various levels of it.
- don't use interfaces until you absolutely have to, and then try and find another way.
YMMV, but in my corporate experience with OO code, I find a lot of interfaces that have one implementation. It's a waste to plan for a future that doesn't come.
I feel we're lacking something like software mindfulness. Where you stay in the moment and just solve the problem.
The most striking thing that Asimov said about writing is about correctness. A good writer produces correctness the first time. They aren’t reliant upon tools, gimmicks, or editors to catch syntax or grammar violations because these trivialities aren’t the important concerns. Drafts are for revising ideas and distilling ideas down to a clearer thought. For good writers drafts don’t waste time or focus with correctness.
In addition to writing with correctness the first time entirely from the author without a bunch of bullshit helpers good writers know what they want to write. They simply write it. They may not have a clarity of vision on how best to order or describe a given subject for their given audience but then that’s what drafts are for. Just write it. In programming revising drafts if called refactoring.
Perhaps the greatest difficulty in any writing is simplicity which is far more challenging than mere mortals consider. The quality of a written work is directly attributable to it’s simplicity.
Simplicity only ever means fewer. Fewer is directly applicable to both form and substance. Does the author rely upon an excess of syntax decoration or do the directly solve the problem? Likewise did the author take the extra effort to fold similar ideas into a single abstraction thereby reducing the number of pieces and methods of approach while simultaneously increasing the potential number of solutions?
https://github.com/prettydiff/wisdom/blob/master/Simplicity....
In fact, writing is a core part of my workflow: I write to problem solve. A clear problem definition and potential solution makes building the solution much, much easier.
The linked article, unfortunately, buries the lede. When the headline is “Simple Writing”, it’d be a better piece if it started with that from the first sentence.
It took them 250+ words to write "simplicity is good".
If “simplicity is good” was the only thing you took away from the comment, you might want to re-read it.
Beware of unrelated claims that taint your message! Asimov, while a prolific writer, was certainly not the most productive. According to Wikipedia, he wrote or edited 500 books. Enid Blyton, mostly known for the Famous Five series, wrote more than 600. Even Georges Simenon had more than 500. The Guiness book mentions a little-known South-African author that wrote 904 books.
Beyond that, I'm not sure I agree with much else. Following the insightful introduction, the author smears Terry's definition of abstraction by claiming the concepts of "usefulness or power" are missing. Double downing on this claim we're then lead through a series of technologies the author has experienced through the lens of "power to cognitive load" ratio while neglecting to meaningfully connect with the ideas of Fred and Terry.
It was my undrrstanding at a time that the mindset one needed to play games, especialy those involving puzles and problem solving would have a somewhat natural attitude towards programmming.
And it is partially correct if you are a good tutor enough to make relations of one way of problem solving into what can be done in programing, which I found out I aint.
Where I was humbled in the attempt is when I was asked questions that I took for granted simply because of the years of programming, many things where just given, and while knowing then I had a very bad time properly expalining them to a absolute beginner.
This is what in my oppinion makes programming hard or easy, after that it is just layers of layers of that.
For me, now that I recall it, getters and setters in Java made no sense so much that I only got them after maybe a year, though I dont even know why didn't they make sense at the time.
I thing that a mentor has a lot of impact in how much programming is hard, be it a person, a course, or a book.
well they don't make sense :) 99% of the time they are just a pointless ritual to appease the OOP god.
I especially love when company mandates 90% test coverage and no lombok so I get to write tests for setters and geters :)
Programming requires reasoning about long chains of cause and effect in an abstract realm, expressed in a very terse, symbol-dense language (computer code). Writing even a short (but nontrivial) program in BASIC is beyond the reach of most people. This isn't because they're stupid -- they just haven't had training in the necessary abstract, sequential logic. A person can live a successful life and die leaving a comfortable inheritance to their children without ever having to develop that sort of logic skill -- and putting in the work to develop it requires enormous activation energy -- so most people don't. For them, "learning to code" is a skill so far out of reach and so removed from their daily experience that they may as well not try.
And learning to code well requires even more activation energy...
> Designing complex conceptual structure is basically what software engineering really is
You cannot quote Brooks and assume that you are going to do something complex anyway. Otherwise you fall for the most common form of accidental complexity: sloppiness. It doesn't have to be complex. Assuming it is going to be complex is the wrong default value.
But really what the author is talking about is API design. The only way for a library or framework to reduce the essential complexity is to skip on some aspects (not implementation details - this would be an abstraction). Like making variables constants so users don't have to fill in weird parameters only an expert of the domain would know what they are about.
This is precisely those choices that matter in API design. If you don't make those choices, you end up with a complex API through which you can see all the details (remember the trend of devices with transparent shells in the 90ies? That's the image). So you make choices. There's some things your users won't be able to do because your API fill in the annoying variables for them. But of course "One man's constant is another man's variable" (applies to women too) so may you'll have to present different interfaces or sub-APIs.
This is interface segregation.
that stuff can be pretty hard, sitting around all day getting nothing done, sweating, refusing to move from the computer you're trying to interrogate.
on edit: clarified a point in first sentence.
This is not programming, just like how following a recipe is not cooking.
I would call you a good typist.
EDIT: I never cook with a recipe and do everything by taste, feel, and instinct.
Following receipt is in fact cooking. You can go by feel, but you don't have to. Majority of cooking is following receipt, whether written or not.
what happens when you get a null pointer because you have no concept of exception handling?
Ok, then you didn't follow it.
And yes following a recipe is cooking otherwise chefs would never do it, it’s called standardization
Why is this important? Because how can one import a library for a problem that currently has no solution?
"The question of whether a computer can think is no more interesting than the question of whether a submarine can swim." - Dijkstra
We all stand on the shoulders of giants.
But maybe you create your own universe from scratch and program it without abstraction, who knows.
A chef creates recipes and sometimes follows them. He can also extemporise.
Is a group of 8 years old kicking a ball between two poles football? Or only world class teams playing the Champions League? What about everything in between?
I think that's a better way to frame it. I'm confident I could teach someone with no prior experience to cobble together code to do some simple tasks in a relatively short time. Will they be able to create production-ready code for a world class company? Not really.
For me the hard question is whether anyone has the potential to write that world class software, much like asking whether anyone has the potential to play the Champions League.
There is an entire industry of talent scouts that predict the performance of kids as young as 12, and many of them are good at what they do.
So even your example with kids is false, there’s a book talking about this fetishism called Late Bloomers. I encourage you to check it out.
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sor...