I was reading through one of the linked articles of why the author doesn't like using null or static objects:<p><a href="https://www.yegor256.com/2014/05/13/why-null-is-bad.html" rel="nofollow">https://www.yegor256.com/2014/05/13/why-null-is-bad.html</a><p><a href="https://www.yegor256.com/2014/05/05/oop-alternative-to-utility-classes.html" rel="nofollow">https://www.yegor256.com/2014/05/05/oop-alternative-to-utili...</a><p>Apparently he replaces null with null objects or throwing exceptions, and creates objects for every static method. Go figure.<p>Actually, there are a few gems:<p>> The Map interface (no offense to its authors) has a design flaw.<p>> It is a good practice to make your code as fragile as possible, letting it break when necessary.<p>> The method is basically asking the object about its… race. Black objects go right while white objects go left. That’s what this instanceof is doing, and that’s what discrimination is all about.
I don't understand why the names are so bad. FtFoo, TkBar, XyBaz. Not pronounceable, meaning not inferable. I like Yegor's stuff mostly, but the naming just kills me.
Not trying to knock the work, but why is no static methods a selling point? How does one do utility classes instead? And do you eschew static factory methods entirely?
So from the OOP Alternative to Utility Classes on the site<p>int max = new Max(10, 5).intValue();<p>over<p>int max = Math.max(10, 5)<p>Yeah, think I am going to pass.
So instead of static, you’re using fixed classes. No difference there. What’s next, a classfactory? One inner platform effect coming up!<p>It’s a good exercise though!
I write very annotation/static method heavy Java at work, and I write Haskell for fun at home, and my kneejerk reaction to seeing this code in the "Why are static methods bad" link:<p><pre><code> void transform(File in, File out) {
Collection<String> src = new Trimmed(
new FileLines(new UnicodeFile(in))
);
Collection<String> dest = new FileLines(
new UnicodeFile(out)
);
dest.addAll(src);
}
</code></pre>
was "That looks just like Haskell".
Ok, so we know the framework does not contain all these supposedly bad things¹, but what does the framework <i>do</i> exactly?<p>1: Reminds me of Golang, which likes to define itself as a set of 'negative liberties' (No exceptions, no inheritance, no polymorphism, no ...).