-
Notifications
You must be signed in to change notification settings - Fork 164
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
Code in ctors #62
Comments
@Englishman I'm not managing this repo, remove the webhook or contact me in Slack //cc @yegor256 |
@Englishman I've never tried before this approach (only |
@g4s8 basically the idea is from here |
@Englishman yes, I've read it, but I thought this rule is less strict. Like do not put a lot of code in contructor but one or two method calls is ok. |
@g4s8 yes, I guessed so. But look on this part of discussion |
@Englishman yes, we must avoid any code in constructors. So, these static method calls are evil, but if you look at what's inside them, you will see that they are actually just making new objects. But I agree that we should create substitutes for them. Feel free to submit PRs. |
@Englishman is this ticket still actual? I believe we can close it |
@yegor256 @Englishman please close this issue as it's actually a number of issues: |
@ashtonhogan why me? |
@Englishman please close this issue |
@Englishman can we close this? |
@Englishman closing |
The job is not in WBS, won't close the order |
In some ctors we have method calls for JDK's standard
static
methods. E.g.https://github.com/yegor256/cactoos/pull/22/files#diff-537f42dacf5c41ee51d8dc12c8560ce5R51
or
https://github.com/yegor256/cactoos/pull/22/files#diff-537f42dacf5c41ee51d8dc12c8560ce5R73
Also look on ctors in
https://github.com/yegor256/cactoos/blob/master/src/main/java/org/cactoos/text/FormattedText.java
in
master
branch.Sometimes we even have some non static JDK calls. E.g.
#20 (diff)
Question: have we avoid all of such method calls at all? So, literally,
rule everywhere?
It yes, have we avoid usage standard
Arrays.asList
andCollections.unmodifiableSet
and create substitute for them?The text was updated successfully, but these errors were encountered: