3 ms·
"Is this OOP?" Okay, that's beyond my pay grade. I could argue that either way. OOP is the grouping of data and functionality into units called types or classe
by DanielBMarkham 14y ago
"Is this OOP?"
Okay, that's beyond my pay grade. I could argue that either way. OOP is the grouping of data and functionality into units called types or classes. So yes, technically, but I know what you mean.
I agree that Java is a bad way to start, but I wonder if I wouldn't come at it from just the opposite angle. Start with C, move to structs, then move to something like the class you show, then to more complex type creation. After all, C++, probably the most widely-used OOPL on the planet, started with the problems of scaling C.
The problem here is the confusion between "the way things work in language X" and "the way things generally are". I think you need a few OOP languages, and perhaps some functional ones too, under your belt to be able to understand that.
What I think you're getting at is problem-solving strategies. There is a certain problem-solving strategy available in OOP that doesn't make much sense in FP. Many functional guys look at OOP and say something like "It all looks like just a bunch of wiring" -- which is true but misses the point. It works the same in FP, they have ways of solving problems differently than the OOP guys, but that's for another day.
In either case, starting with Java is not so good, if for no other reason than you end up in namespace-land with even the simplest code. Start simple, either with Smalltalk or with C, and work in the more complex pieces.
Note: I _do_ think that any OOP learning experience should end with creating your own robust type system, just like I think any FP learning experience with creating your own parser and compiler. But this also is a topic for another day.
- SiVal 14y agoInstead of C, I would suggest something like Python, where you don't have to learn to make your own shoes before you can start experimenting with fashion. With Python, you can forget about the computer and just think about programming. (I'm talking about pedagogy here, not production, where C is often a better choice.) The fact that OOP was really bolted onto Python as an afterthought means you can learn simple straightline code, then start clustering it into functions as it starts to get more complex then, eventually, start clustering functions and data into simple classes where it (occasionally) helps to manage the growing complexity, followed by your own modules. You don't have to start with packages and class hierarchies just to print "hello, world" as in Java, but you also don't have to reinvent the string, as in C.
- bad_user 14y ago> you don't have to learn to make your own shoes before you can start experimenting with fashion I love this. Coffee was spilled :-)
- Zak 14y agoyou don't have to learn to make your own shoes before you can start experimenting with fashion I think what you and DanielBMarkham are approaching from opposite sides is that it's useful for a student to learn both how computers work and how computation works. C is pretty close to the computer. Learning C will teach a student how computers work. That's important for the same reason that a fashion designer should have some understanding of what shoes are made out of and how they're assembled. Making shoes that are nice to look at, but that fall apart when worn is not especially useful. Python (or Smalltalk, or Scheme, etc...) is closer to how computation works, and closer to how many of the problems people want to solve using computers work. It lets students explore what they can do with computers without getting mired down in the details of how the computer will accomplish the task. Java is somewhere between, and from an educational perspective, has the disadvantages of both sides without gaining many of the advantages.
- toddh 14y agoPrograms are just wires. We just pretend some of the wires are different.