Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • 3
    What if the idiomatic way is to use static methods? Commented Apr 18, 2016 at 22:44
  • 1
    Is there a reason you don't like objects that only hang out long enough to do their duty? Commented Apr 18, 2016 at 22:47
  • 4
    Seems like just a rant against OO. One thing you could do differently with OO would be to take the input in the constructor and then have the object represent the parsed state. There are probably a lot of useful things you could do by holding the final parsed state and writing member functions against it. Commented Apr 18, 2016 at 23:37
  • 1
    You can still use a single object with an instance method, without requiring that the object be reset each use (and is also thread safe, fwiw). Such a method simply holds no state in the object, using the stack (auto variables) instead. This way we can avoid some of the well-known problems with statics, namely around testability, tight coupling/substitutability, injection/inversion. Commented Apr 18, 2016 at 23:59
  • 2
    Oh, that's an easy one. Static methods exist precisely so that you don't have to do prototypical OOP in the usual OOP language suspects. Nothing prevents you from using static methods all day long to write procedural code, except perhaps irritating the OOP pedants. Most of the modern OOP languages are multi-paradigm anyway; C# is actually "object-functional." Commented Apr 19, 2016 at 3:57