3 ms·
A common sentiment expressed in threads like this is that people can write bad code in any language, therefore language doesn't matter. While that may be true,
by yen223 9y ago
A common sentiment expressed in threads like this is that people can write bad code in any language, therefore language doesn't matter. While that may be true, I don't think judging a language by the worse parts is a useful exercise. I'd rather judge a language by its best parts.
To that end, can someone point to me an example of object-oriented code that they feel is elegant?
- krylon 9y agoAt work, I am currently working a program that needs to read XML messages from a message queue, and depending on the type of message extract several pieces of data from it and write them to a specific list in a SharePoint server. I wrote an abstract base class that contains all of the boiler plate code for dealing with SharePoint, and then one subclass for each type of message I need to deal with; those subclasses only need to override a few methods to deal with the fields from the XML message and with the specific SharePoint list they need to write to. It is not great (the task is just too dull for that), but I am happy with the approach I have chosen because I can add support for new message types fairly easily. That being said, I do not think OOP is the answer to all (programming) questions, nor is it the worst idea ever. Some programs can be expressed in terms of objects and inheritance very easily, just as some can be expressed in functional terms very easily.
- sukruh 9y agoThe discrete event simulator and the circuit simulation using it in Odersky's book[1] had caught my attention as neat. [1] http://www.artima.com/pins1ed/stateful-objects.html http://www.artima.com/pins1ed/stateful-objects.html
- scroot 9y agoI think a lot of the "standard" objects in Smalltalk-80 are very elegant. In particular, have a look at the implementations of Boolean, True, and False (it has been posted to HN before). Clever.
- abecedarius 9y agohttp://erights.org/elib/capability/ode/index.html http://erights.org/elib/capability/ode/index.html