Skip to content

Commit

Permalink
shortened the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanvalyavskiy committed Mar 19, 2024
1 parent 037e3b5 commit d1b58bf
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 66 deletions.
78 changes: 12 additions & 66 deletions README.md
Expand Up @@ -34,78 +34,24 @@ Install manually:

## Motivation

I watched [the speech](https://youtu.be/75U9eefFYoU)
and was struck by the beauty of an elegant object-oriented
code in comparison with the procedural one.
One of the main ideas is that classes should not have many methods,
there should be many classes with a minimal set of methods.
The proposed approach involves using composed decorators
(instead of methods) to configure the Object.
[See more](https://www.elegantobjects.org/) about Elegant Objects approach.

The Maintainability of such design is undoubtedly several times higher.
However, code maintainability consists not only of its design,
but also of tools that allow you to quickly and conveniently work with it.
[Elegant Objects approach](https://www.elegantobjects.org/) proposes using composed decorators
instead of utility classes with a bunch of static methods.

Modern IDEs as IntelliJ IDEA have completions for methods.
Developers should only type a dot to get completions in a few milliseconds.
Completions list contains all methods with their arguments and return type.
What about composed decorators?
Will IDEA complete me, if I want to provide new functionality
by decorating my Objects, instead of adding new methods?
No, it isn't.

So an absolutely reasonable [question](https://youtu.be/75U9eefFYoU?t=2498) was asked.
Developers do not have to remember the names of methods, but can rather quickly find them using completions.
This gives the utility class based approach a great advantage.
But neither IDEA nor other IDEs won't complete you with decorators.
To use [EO approach](https://www.elegantobjects.org/) you will have to remember the names of all existing decorators for each type.

Here is `Decorate.me` Intellij IDEA plugin tha eliminates the tooling difference between using methods and decorators.
Just type a dot after an object, just like you would to call a method, then `Ctrl+Shift+Space`,
and you will get all existing decorators bounded by a type that can be inferred from the context.
Choose one and press `Enter`.

Loose translation:

> What simplifies maintainability here if IDEs have completions
with methods and their descriptions,
but if I use small classes, I should learn all existing decorators?

> Very good question. IDEs are to blame
for the convenience of working in a procedural programming style.
Probably after a while IDEs will make some new completions.

This guy is absolutely right. So we have to deal with it!
I still don't want to pack dozens of methods
in utility classes only because IDE gives me suggestions and completions.
On the other hand, Developers, including myself,
are so spoiled by good development environments(IDEs)
that they don’t want to give up such powerful features.
Sure, No one wants to manually search for methods that can be called.
Not to mention decorators, which, unlike methods,
can be scattered on the project in a more chaotic order.
However, there is no place for Tools-Driven Development.
Don't let the IDE decide how your code looks! RESIST!
I offer our weapon in the struggle for Elegant Objects.
With it, we can elegantly design classes and at the same time
use all the conveniences of modern tools.

If you still find the problem a bit abstract and are looking for a
more concrete example, that's [it](https://youtu.be/LPLqLaSwSsI?t=6739)(in Russian).

It's easy to find and choose method, which you need,
when they are packed in one utility class.
You only have to type dot, and you instantly see all methods.
Also, you can have a look at its documentation or definition in a same tab.
Isn't it beautiful? Sure It is!
But what does then our class looks like?
At least it's just huge, not to mention other issues.
It seems like a trade-off - the uglier the class, the easier it is for us
to work with it in the development environment.
This is no longer the case.
Let's have a look at object-oriented Java framework [Cactoos](https://github.com/yegor256/cactoos).
Consider its interface [Text](https://github.com/yegor256/cactoos/blob/master/src/main/java/org/cactoos/Text.java).
It's only can be converted to string by contract.
There is the Text [package](https://github.com/yegor256/cactoos/tree/master/src/main/java/org/cactoos/text)
which contains all implementations of Text interface.
They all are quite small.
If you want to do some operation with your text,
you should use decorators instead of methods inside this class.
Here is `Decorate.me` Intellij IDEA plugin tha eliminates the tooling difference between using methods and decorators.
Just type dot after a constructor, then `Ctrl+Shift+Space`, and you will get all decorators suggestions.
Choose one and press enter. That's it!
[More detailed description of the problem](problem.md)

## How It Works

Expand Down
37 changes: 37 additions & 0 deletions problem.md
@@ -0,0 +1,37 @@
[The main take against EO, which had no answer](https://youtu.be/75U9eefFYoU?t=2498).

Loose translation:

> What simplifies maintainability here if IDEs have completions
with methods and their descriptions,
but if I use small classes, I should learn all existing decorators?

> Very good question. IDEs are to blame
for the convenience of working in a procedural programming style.
Probably after a while IDEs will make some new completions.


The question is unanswered, since
I still don't want to pack dozens of methods
in utility classes only because IDE gives me suggestions and completions.
On the other hand, Developers, including myself,
are so spoiled by good development environments(IDEs)
that they don’t want to give up such powerful features.
Sure, No one wants to manually search for methods that can be called.
Not to mention decorators, which, unlike methods,
can be scattered on the project in a more chaotic order.

It seems like a trade-off - **the uglier the class, the easier it is for us
to work with it in modern IDEs.**

However, there is no place for Tools-Driven Development.
Don't let an IDE decide how your code looks!
Instead, make an IDE work in a way you want.
I offer you a weapon in the struggle for Elegant Objects.
With it, we can elegantly design classes and at the same time
use all the conveniences of modern tools.

**Thus, this plugin is the ultimate answer to this trade-off.**

If you still find the problem a bit abstract and are looking for a
more concrete example, that's [it](https://youtu.be/LPLqLaSwSsI?t=6739).

0 comments on commit d1b58bf

Please sign in to comment.