Reputation
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
1 23 52
Impact
~479k people reached

Jan
29
comment Are classes with only a single (public) method a problem?
@KonradMorawski: If a factory is polymorphic (e.g. you dependecy-inject it) and/or stateful, then it's using object oriented techniques. But if it's just a container for a method, then there is nothing object oriented on it. That is not a problem, the fact that object oriented idioms are useful does not mean every idiom has to be object oriented, but in languages that don't require class for everything you should not use it if it does not add anything.
Jan
29
comment Are classes with only a single (public) method a problem?
@KonradMorawski: I can imagine cases where it does, but then it probably does have more than one method or at least has a constructor with bunch of parameters. But a class with just single method (and trivial constructor) does not have any content and what does such instance represent?
Jan
29
answered Are classes with only a single (public) method a problem?
Jan
29
comment Are classes with only a single (public) method a problem?
@DocBrown: Agree here.
Jan
29
comment Are classes with only a single (public) method a problem?
@DocBrown: Private methods are not relevant to this question. They can be put on internal helper class or whatever.
Jan
29
comment Are classes with only a single (public) method a problem?
@gbjbaanb: There are other methods. But they are not relevant, because you can handle them like this.
Jan
29
comment Are classes with only a single (public) method a problem?
@DocBrown: It is a very core of the question. Modules using namespaces having just one "external" method are perfectly fine when the function is sufficiently complex. Because namespaces don't pretend to represent anything and don't pretend to be object-oriented. Classes do, but classes like this are really just namespaces. Of course in Java you can't have a function, so this is the result. Shame on Java.
Jan
29
comment Are classes with only a single (public) method a problem?
@delnan: Of course they can. Obviously I chose wrong terminology. It's more like some functions make sense for specific combinations of arguments rather than being associated with one or the other. See also gotw #84 about functions not really tied to particular class.
Jan
29
comment Are classes with only a single (public) method a problem?
@DocBrown: C++ has namespaces for that. In fact in modern C++ you often use free functions for methods, because they can be (statically) overloaded for all arguments while methods can only be overloaded for the invocant.
Jan
29
comment Are classes with only a single (public) method a problem?
@DocBrown: At which point it however is no longer an object oriented design, because the VideoCompressor does not represent an object. There's nothing wrong with that, just shows the limit of object oriented design.
Jan
29
comment To store data or not?
@rucamzu: A database might be used for much more than just persistence. At work we have a tool that processes some data and the operations each involves more or less complex query that does significant part of the task.
Jan
28
comment To store data or not?
@IdanArye: The later on and right away is not important. The important difference is that a Command object is created by one component to be executed by another component and as such it's interface is public, while here the object is just a collection of parameters that need to be passed through several steps of a complex calculation inside one component and as such implementation detail of the component.
Jan
28
comment To store data or not?
@IdanArye: Sorry, I don't see any relation to command pattern whatsoever. Command pattern is for preparing an action to be executed at later time, but nothing is being deferred here. You are right about the state though. I have renamed it, though I am not sure about good generic name; it should be named simply according to the operation it is implementing.
Jan
28
revised To store data or not?
rename the class; it is not state
Jan
28
comment To store data or not?
@rucamzu: It makes sense to attempt to separate the concerns, but they may not always be separable. If the function operates on the data or if it writes a lot of data, there is no other reasonable way to represent the results than in the database.
Jan
28
revised To store data or not?
added 235 characters in body
Jan
27
answered To store data or not?
Jan
23
comment Are there any ultra high level languages out there?
I've had the dubious pleasure of working with Rhapsody (I wonder why IBM bought another similar tool and have two similar sets of applications under the IBM Rational brand) and my experience from it is that it does not scale. Multiple people working on the same piece of code is a well studied and solved problem, but multiple people working on the same piece of UML just does not work.
Jan
23
comment Are there any ultra high level languages out there?
@david.pfx: C# is rather late to that party and I find it's syntax backwards (it uses SQL keywords, but the order is different where everybody else uses the SQL order and simpler keywords/symbols). The way they can compile it to SQL is however better than what most languages can do.
Jan
21
revised Should I fork a fork (on Github)?
added 59 characters in body