4 ms·
Isn't this true of any OO language? I've seen former COBOL programmers write COBOL-like code in Java. As well as C-Like code in Java. Nothing stops you from hav
by logicalmind 17y ago
Isn't this true of any OO language? I've seen former COBOL programmers write COBOL-like code in Java. As well as C-Like code in Java. Nothing stops you from having a single java class with numerous functions at the same level and static/global variables.
- scott_s 17y agoBut you are forced to use classes and instantiate objects, even if the resulting program you write is procedural. Languages like, say, Python, don't force you to ever declare a class.
- logicalmind 17y agoI wouldn't recommend it, but you are only required to declare one class in a java program that contains the static "main" method. If you strictly use primitives and static methods there would be no instantiation needed. I think the only real difference is that in python your methods would be scoped at the global level. While in a single class java program your methods would be scoped within the class.
- scott_s 17y agoRight, but you are required to declare a class. You are required to acknowledge that the object system exists. Python has no such requirement. Mechanically, what can be accomplished in one language can be accomplished in the other. But that's not what this distinction is about.
- logicalmind 17y agoThe distinction I am making is based on this: "It lets you easily use objects and OO concepts when they are the best approach, but it does not force you to use them when the particular problem is more functional (or even more procedural for many short, simple scripts.)" I was disagreeing with the point that OO languages "force" you to use OO concepts. OO concept to me means encapsulation/inheritence/polymorphism. Java in particular does not force you to use any of these OO concepts. You do have to declare one class, but "class" in that sense is purely for scoping. You don't have to instantiate it or acknowledge its object-ness.
- scott_s 17y agoAnd my point is that while you are not forced to design an OO program, you are forced to use OO mechanics. Considering that other multiparadigm languages don't force this (C++, Python, Ruby, Perl, Objective C, Lisp), I think it's an important distinction.
- deleted 17y ago[deleted]
- timwiseman 17y agoPerhaps "OO Structure" or "OO Syntax" would have been a better choice of words. You can abuse java by declaring your class with a static main and then write things procedurally within that, but you have to have that class and its OO Structure. In Python, that is not needed. Objects are there when they make sense(such as most gui design), but not required, even in structure or syntax, when they do not make sense.
- timwiseman 17y agoPrecisely, and even if you do write it in a procedural fashion from that point forward you have the clutter of the OO code around it. (It is of course not clutter if you are actually writing in an OO fashion where it makes sense and is very useful.)
- Periodic 17y agoI cannot place the source of this quote, but to paraphrase: Judge a language not by what it makes hard, but what it makes easy.
- joe_the_user 17y agoUh, if a language makes some common, reasonable things hard, it's hard not to judge is harshly.
- mquander 17y agoIt depends on how dispensable those common and reasonable things are. There are a lot of ways to skin a cat, and one strong quality of a language is how well it gives you one overarching, consistent cat-skinning paradigm that is sufficient to skin cats. If it does, then it can be excused to some degree for not supporting other methods of skinning.