Timeline for Why OOP is enforced in Java and C#?
Current License: CC BY-SA 2.5
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 21, 2011 at 17:21 | comment | added | user7043 | @Billy: If I accepted this as the reasoning, I'd assume that the language designers (1) didn't realize that you can write garbage code in any language, and/or (2) though non-object oriented programming is "easy to shoot yourself in the foot with", and/ or (3) thought the language's users are too stupid to do any OOP without being forced into writing out the letters class... | |
| Feb 21, 2011 at 17:20 | comment | added | Filip Dupanović | But if it's under a meaningful package namespace, part of a class with a meaningful name, with a meaningful name for the static class method itself--it can be quite elegant and self-explanatory. It's when you take a look around how badly types and utility classes are designed and organized that you think almost any rubbish can pass, as long as it's legal. | |
| Feb 21, 2011 at 17:18 | comment | added | Billy ONeal | @delnan: You can write garbage code in any language. However, with some language features are easy to shoot yourself in the foot. (I'm not defending the decision, I'm saying that David's answer is correct; that is the thinking behind the language design in that manner. Whether or not you agree with the language designers is a whole different matter.) | |
| Feb 21, 2011 at 17:16 | comment | added | user7043 | @Billy: In which case the language is out of play - as already noted, even Java and C# can do little more than enfore classes-based code organization, not decent - let alone sound, OOPy - design. | |
| Feb 21, 2011 at 17:11 | comment | added | Billy ONeal | @delnan: It's not about how easy it is to read a single function. It's about how easy it is to understand your overall design. | |
| Feb 21, 2011 at 16:47 | comment | added | user7043 | If that's the motivation, perhaps the language shouldn't have static methods. What's easier to read, class XyzUtil { static T doStuff(...) { ... } } and then XyzUtil.doStuff or simply T doStuff(...) { ... } and then doStuff()? If you want to write procedural code (and sometimes that's really the best way, and more often than you'd think it's a valid approach), Java etc. only add cruft, not simplicity. | |
| Feb 21, 2011 at 16:14 | history | answered | David Thornley | CC BY-SA 2.5 |