yegor256 / cactoos

Object-Oriented Java primitives, as an alternative to Google Guava and Apache Commons
https://www.cactoos.org
MIT License
742 stars 165 forks source link

Principles violation #1327

Closed Guseyn closed 4 years ago

Guseyn commented 4 years ago

As it's known from the principles it's prohibited to use getters and setters: https://www.yegor256.com/2014/09/16/getters-and-setters-are-evil.html

But as I see here https://github.com/yegor256/cactoos/blob/master/src/main/java/org/cactoos/map/MapEntry.java it's used:

    @Override
    public K getKey() {
        return this.key;
    }

    @Override
    public V getValue() {
        return this.value;
    }
0crat commented 4 years ago

@paulodamaso/z please, pay attention to this issue

paulodamaso commented 4 years ago

@Guseyn In this case we are implementing a java interface here, Map.Entry, which forces us to use these evil names. Do you have any proposal on how solving this?

Guseyn commented 4 years ago

@paulodamaso Nah, I am just pointing to a weak place(one of many) of your theory that cannot be practically and theoretically implemented. Because, see.. You're using getters here not only because some java interface forces you, but because you cannot do data structures like List, Map, Tree without getters and setters, because... well, they are data structures.

You can use no "evil" names, but the point is that they are still getters. Or maybe you can create data structures via "elegant objects" that are not supposed to expose internal data outside of them. But it's obviously impossible(or you can surprise me).

Just face the fact that you're lying to the people by saying that you are not using getters(https://www.elegantobjects.org/#principles). It's just a lie, why do you do that? Do you really think that people are so stupid and naive? Or maybe you are confused?

Let me explain you something, if you are telling that your library follows principles like no getters and you are using them there, it means that you're just not following them, it means that your theory is not practically possible. Of course you're trying to follow your principles, but then you should emphasize such fact, because it's not possible to follow them to full extend.

But again, even in the places where you are following them, you provide no alternative what so ever. You still write procedural code via objects(like other people). Because OOP does not allow you to write fully composable code as I explained it here https://guseyn.com/posts/eo-is-wrong?v=1.0.201

victornoel commented 4 years ago

@Guseyn I'm going to close this as wontfix

0crat commented 4 years ago

Job gh:yegor256/cactoos#1327 is not assigned, can't get performer