|
Mixing (up) function(s) and actions.
ReadTextFile is some clumsy rewording of a "TextReader" class.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
In this case it was part of an assignment to read phony medical records from a CSV.
A more horrible name I could scarcely fathom. I was helping with their homework, and trying to teach them what their prof wasn't.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
I would say TextReader is the superclass of ReadTextFile. Text doesn't always come in files.
|
|
|
|
|
Personally I can't make a bridge between ReadTextFile and the car...
Anyway you example shows a classic thing, that classes are usually not 'stand alone' and in a certain way 'connected'/'depended'
Your examlpe:
Engine.Start() does depend on the state of the Gear. Either Engine asks the gear for 'I'm ready to start' or the gear sends a message to the engine 'hey, I'm at gear 1 (without pressed clutch), not really good to start at the moment' and so on and on and on...
Abstracting the reality is usually very hard.
Only my two cents.
|
|
|
|
|
Of course, but I was simplifying and glossing over details to simply get to the larger point, to wit: In my mind, a class is a noun, not a verb, essentially.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: a class is a noun Not really, since a class encapsulates properties (nouns), and actions (verbs); so it could be an ablative gerund.
|
|
|
|
|
Holy ...
Dear Richard, you know me now for a longer time as an English non native. Can you please describe 'ablative gerund' in _very simple words_ for me?
Thank you very much in advance
|
|
|
|
|
lol
Apparently it does mean something. I googled it just to be sure. But I still didn't understand what it means.
|
|
|
|
|
=> Conclusion: You are not native English, at least not british native
modified 6-Nov-23 18:35pm.
|
|
|
|
|
English has gerunds (a verb ending in -ing that also functions as a noun) but no ablative case[^].
|
|
|
|
|
Thank you Sir. But is this also available in easy words
|
|
|
|
|
I believe ablative gerund belongs to latin grammar, and there is no such thing as easy latin.
But I'm probably wrong though, as I never learned latin.
|
|
|
|
|
Awesome rabbit-hole
|
|
|
|
|
Ha ha! I remember "ablative" and "gerund" from my Latin classes back in the 1950s. So I just put the two words together as a joke. But the joke, it appears, is on me, as there realy is such a thing. But I am not sure exactly what that thing is.
|
|
|
|
|
|
I think I would rather read a PHD research article on string theory.
|
|
|
|
|
LOL.
So I am not the only one.
|
|
|
|
|
honey the codewitch wrote: In my mind, a class is a noun, not a verb, essentially For me, a class may be either a noun or a verb.
As a noun, the concept represented by the class is a thing, and the class provides information and operations for that thing.
For a verb the concept is a process, and the class supports that process. I guess 'process' can be thought of as a noun, but thinking of it that way adds indirection to my thinking.
Software Zen: delete this;
|
|
|
|
|
That's a good point. I was trying to get to the essence of it and simplify, but obviously I missed the mark in terms of covering every eventuality.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Keeping in mind of course that a school class is intended to teach concepts not practice.
So in general one can think of it as a noun but if someone insists that every single class must always follow some rule about that then it is going to be a problem.
|
|
|
|
|
An engine on a stand doesn't need a gear box to "start" or "run". It needs fuel and / or a battery.
"Moving" is accomplished through the addition of a transmission, axels and wheels.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
0x01AA wrote: Abstracting the reality is usually very hard.
Abstracting reality may be difficult but its absolutely essential. If you see a chair that you've never seen before and you don't have an abstract concept of what a chair is, how would you ever know its a chair?
It sounds like this professor had a difficult time with the abstract concept of a class. It can be a difficult concept but I would think it would be a prerequisite to being an IT professor.
But what do I know? I'm self taught and assume there a plenty of abstract concepts I'm just not aware of.
|
|
|
|
|
That's the way I learned it also, of course I taught myself but every reference I came across explained it that way.
I don't think before I open my mouth, I like to be as surprised a everyone else.
PartsBin an Electronics Part Organizer - Release Version 1.3.0 JaxCoder.com
Latest Article: SimpleWizardUpdate
|
|
|
|
|
It's complicated.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
honey the codewitch wrote: But I'm hearing that professors are teaching that classes are effectively a single action like ReadTextFile and it makes me a lot more irritated than I probably should be.
This could be the beginning of a in-depth discussion on Communication.
I have to parse the beginning of your sentence very closely and pull out "I'm hearing..." part.
You are hearing that from a beginning student, I believe.
Now, we can't be sure
1.if the Professors are actually teaching this (that a class is one action / functionality)
2. if it is the way the student is understanding it
Let's say it is the latter ( choice 2 above).
Now, that may simply mean that the Professor is teaching a concept poorly -- actually doesn't believe that a class is just one action but has somehow inadvertently used words that create a students understanding to be that.
From what I remember about Professors and coding, it seems likely that the Professor is actually teaching OOP wrong. Few colleges have Professors which actually program or have been on large teams which have implemented large systems using OOP.
However, I could also see that the student learning about OOP sees a simple example (because all University examples are far too simple (because anything large requires too much work on the Professor's part) and assumes that because there is only one functionality in the class along with a phrase the student has heard (Single Responsibility Principle) leads the student to believe that a class must have only one action.
So, here we are back at the beginning.
We don't know if:
1. The professor is wrong
2. the professor is confusing and the learning lands improperly
3. The student misunderstands on her own.
We're down at the bottom, writhing in the Communication pain.
The best thing to do is: Redirect!!
And that seems to be what you are doing. Tell the student the proper use of Classes and why they can have more actions.
Good luck with Communication.
I'm sure that I too have added some form of communication problem while writing this up.
|
|
|
|