1,038 reputation
511
bio website
location
age
visits member for 3 years, 4 months
seen 18 hours ago

Dec
19
comment How to define “or” logically
I think this is the "purest" approach in certain mathematical sense. The OR-operator is a function after all, and the truth table is really the essence of that function as a relation and a set. Of course this could be written in an amusing OO manner too: BinaryOperator or = new TruthTableBasedBinaryOperator(new TruthTable(false, true, true, true));
Dec
12
comment Design of a datamodel in a OO way
Neural networks? So you could have objects representing neurons or nodes, connections and networks?
Dec
10
comment Why isn't software abstract on a grander scale?
I think your question is somewhat hard to grasp. You believe that software "should be more abstract". Which software? How abstract that software is now and how abstract it should be? Why exactly it should be more abstract? I think finding a working level of abstraction is always a balancing act, and not only in software design. Now your question seems a little bit too abstract and vague. It should probably be less abstract and more precise. Just like some code I've seen and written too.
Dec
9
revised Is Singleton enough for a EMailUtil or there is any better implementation?
edited body
Dec
9
answered Is Singleton enough for a EMailUtil or there is any better implementation?
Dec
2
comment Collections, relationships and tracking changes (in DDD)
I think the question needs more information about the design. It's hard to see why adding or removing Authors would be error-prone and why the business method needs to detect new or removed Authors. Does your Author have an identity? What is the "additional data related to a book and author"?
Nov
28
revised Why 'String' objects are immutable with an explicit constructor in java?
deleted 9 characters in body
Nov
28
revised Why 'String' objects are immutable with an explicit constructor in java?
deleted 9 characters in body
Nov
28
comment When should I refactor a private class into a package-private class?
Thanks for the edit. I am not a huge fan of Java's inner classes either and I guess excluding them is a well thought design choice in C#. Now that your answer doesn't (accidentally) advocate using them, I give it +1
Nov
28
answered Why 'String' objects are immutable with an explicit constructor in java?
Nov
28
comment When should I refactor a private class into a package-private class?
Since this is a Java question, shouldn't you edit the answer? Your answer could mislead some developers as your definition of "static class" does not correspond to a static class in Java.
Nov
27
comment When should I refactor a private class into a package-private class?
It seems that C# does not have inner classes like Java does. Perhaps that is the root of this confusion? In Java terms all C# nested classes are "static"... :)
Nov
27
comment When should I refactor a private class into a package-private class?
Note that all package level classes are just like static nested classes in the sense that they don't have an implicit reference to an instance other than themselves like an inner class does. Inner class (non static nested class) is the exceptional case really. It can be hard to refactor an inner class into a static nested or into a package level class. References to the enclosing instance need to be solved in the process. A static nested class can't have such implicit dependency and thus it's generally safer (IMHO).
Nov
27
comment When should I refactor a private class into a package-private class?
My point is that a static class can and usually it should be instantiated. Just call the constructor: new NestedStatic(). If you call it twice, you get two separate objects with separate states. I think you're confusing static classes with classes that have only static members.
Nov
25
comment When should I refactor a private class into a package-private class?
I don't quite understand your point. What do you exactly mean by "static private class"? A static nested class? If the nested class has static fields, they should be immutable just like all visible static fields of any class should be. The static nested class should be instanced and used just like an inner class (non-static nested class). It just doesn't need an implicit reference to an instance of the enclosing type.
Nov
24
comment When should I refactor a private class into a package-private class?
Why would data in a static nested class be a problem?
Nov
21
answered What should an object be called that contains only setters and getters?
Nov
20
comment Algorithm for rating books: Relative perception
I would ask the same question as SpoonerNZ: on what basis the book deserves 8.5? If you wish to avoid the influence of relative overrating and underrating then you could ignore top and bottom 10% of all ratings for instance.
Oct
14
comment Design - Parser.hasInfo(MyClass) vs MyClass.hasInfo()
I think answering your question requires a little bit more information. What is a Document and what kind of information it holds? Are all Documents PDF documents? How a Document object gets created? Why the DocumentParser processes Files, not Documents? (Option 2 seems a safer choice. At least it decouples a third party library from an entity.)
Sep
18
comment Given a number X, how do I find from an array of numbers, a unique combination that adds up to X and has the lowest sum of squares?
How about just picking numbers 1, 2, 3, ... until the sum exceeds the given number n. Then drop the largest number and choose the second largest number so that the sum equals n. Isn't this sufficient since since the finest "partitioning" produces always the lowest sum of squares? (a + b = c --> a^2 + b^2 <= c^2)