Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce code duplication down to 16 lines per piece #2920

Merged
merged 7 commits into from Mar 11, 2024

Conversation

c71n93
Copy link
Member

@c71n93 c71n93 commented Mar 5, 2024

Related to #2863


PR-Codex overview

This PR updates Simian configuration and improves logging in EOlang codebase.

Detailed summary

  • Updated Simian threshold to 16 from 25
  • Improved error messages in EOrust.java
  • Refactored printing logic in EOstdoutTest.java
  • Enhanced logging in DataizedTest.java

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@yegor256
Copy link
Member

yegor256 commented Mar 7, 2024

@c71n93 what's up with this one? still a draft?

@c71n93
Copy link
Member Author

c71n93 commented Mar 7, 2024

@yegor256 still working on it

@c71n93
Copy link
Member Author

c71n93 commented Mar 8, 2024

@maxonfjvipon could you check this one, please?

1 similar comment
@c71n93
Copy link
Member Author

c71n93 commented Mar 11, 2024

@maxonfjvipon could you check this one, please?

Copy link
Member

@levBagryansky levBagryansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c71n93 I am not sure that uniting of these lines is real solution of the duplication problem

String.format(
    "Object inside %s has wrong class %s",
    src,
    result.getClass()
)

Copy link
Member

@maxonfjvipon maxonfjvipon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c71n93 looks good. Even if you're not sure, the final result speaks for itself

@c71n93
Copy link
Member Author

c71n93 commented Mar 11, 2024

@c71n93 I am not sure that uniting of these lines is real solution of the duplication problem

String.format(
    "Object inside %s has wrong class %s",
    src,
    result.getClass()
)

@levBagryansky Yes, but I don't see any other options. This methods are located in different independent subprojects (eo-maven-plugin and eo-runtime).

The only solution I see is to create a dependency between subprojects (or create some eo-util which all subprojects will depend on). But as I know, this option is unacceptable. Maybe you have any other ideas?

@maxonfjvipon
Copy link
Member

@c71n93 eo-runtime must stay independent of any other libraries at all, here is why

@c71n93
Copy link
Member Author

c71n93 commented Mar 11, 2024

@yegor256 could you please check this one?

@c71n93
Copy link
Member Author

c71n93 commented Mar 11, 2024

@c71n93 eo-runtime must stay independent of any other libraries at all, here is why

@maxonfjvipon I see

@levBagryansky
Copy link
Member

@maxonfjvipon As for me, it's not so bad to create a component on which eo-runtime and eo-maven-plugin would depend. It's just that when implementing it, we should not allow cyclic dependencies(Acyclic dependencies principle) and that it should be more stable than components dependent on it (Stable Dependencies Principle).

@maxonfjvipon
Copy link
Member

maxonfjvipon commented Mar 11, 2024

@levBagryansky in the process of compilation eo program we download eo-runtime as jar package, but we don't download its dependencies (fat jar). It's by design. That's why it should be independent.

src,
result.getClass()
)
String.format("Object inside %s has wrong class %s", src, result.getClass())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c71n93 maybe it's better to slightly change the message?

"File %s contains invalid data",
src
),
String.format("File %s contains invalid data", src),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c71n93 same here: maybe it's better to slightly change the message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c71n93 same here: maybe it's better to slightly change the message?

@yegor256 done

@levBagryansky
Copy link
Member

@maxonfjvipon Such architecture violates SRP: Maintaining of the map deserialization is in different classes, even in different modules. Whatever tests we write here, this code will fall off the user in production one day and we will all be fired.

@c71n93 c71n93 force-pushed the 2863-reduce-code-duplication-16 branch from 54c603b to 9f46272 Compare March 11, 2024 13:20
@maxonfjvipon
Copy link
Member

@levBagryansky then I can ask, why are they in different modules? Maybe it's the main problem? Because you're offering to sacrifice eo-runtime independence (which has highest priority) for the sake of the SPR and your convenience

@levBagryansky
Copy link
Member

@maxonfjvipon That's how they should be in the same module. The architecture does not allow this to be done.

@c71n93 c71n93 force-pushed the 2863-reduce-code-duplication-16 branch from 9f46272 to 6b317f8 Compare March 11, 2024 13:50
@yegor256
Copy link
Member

@rultor merge

@rultor
Copy link
Contributor

rultor commented Mar 11, 2024

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 74d04a4 into objectionary:master Mar 11, 2024
16 checks passed
@rultor
Copy link
Contributor

rultor commented Mar 11, 2024

@rultor merge

@yegor256 Done! FYI, the full log is here (took me 22min)

@c71n93 c71n93 deleted the 2863-reduce-code-duplication-16 branch March 20, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants