Takes: Java web framework without static methods or annotations
github.com
github.com
https://www.yegor256.com/2014/05/13/why-null-is-bad.html
https://www.yegor256.com/2014/05/05/oop-alternative-to-utili...
Apparently he replaces null with null objects or throwing exceptions, and creates objects for every static method. Go figure.
Actually, there are a few gems:
> The Map interface (no offense to its authors) has a design flaw.
> It is a good practice to make your code as fragile as possible, letting it break when necessary.
> 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.
That's what Optional was introduced for in Java 8. If you want to be absolutely null-safe, using it makes sense. But if you want to optimise performance, going with the slightly more risky route is still the better choice.
Here's a talk "Optional - Mother of all Bikesheds" by Stuart Marks, the guy who added it to OpenJDK: https://m.youtube.com/watch?v=Ej0sss6cq14
It was mostly just meant to cover the zero or one case on fluent-style interfaces like the Streams API, so check as getFirst() or getAny(). In hindsight, the name Optional was a poor choice if they didn't want the idiom coming over.
[0] http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom...
that's just adding sequential coupling for no good reason
There's also the issue of people seeing OO as the goal not the tool, which I think might be the case here too.
int max = new Max(10, 5).intValue();
over
int max = Math.max(10, 5)
Yeah, think I am going to pass.
That said, I don't know if this library uses the practice of immutable-only objects.
It’s a good exercise though!
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);
}
was "That looks just like Haskell".> public class Max implements Number
uhm
1: Reminds me of Golang, which likes to define itself as a set of 'negative liberties' (No exceptions, no inheritance, no polymorphism, no ...).
main?
It's like saying that a program in Java can be completely object oriented. Of course it can't because the innards still contain pieces of procedural code and they still use primitives which may not be actual instances of objects. What counts is how it presents itself on the outside.