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

Fixing circular dependencies #73

Conversation

katelynienaber
Copy link
Contributor

@katelynienaber katelynienaber commented Nov 20, 2020

In this PR:

  • No circular dependencies
  • New interfaces for (almost) all classes
  • Changed name of SubSystem to Subsystem everywhere, for continuity
  • Renamed folder Model to Entities (because now we have Interfaces folder which serves as a model for most of the app...and Model isn't really a Model)
  • Moved createPathNodes and createEmptyNode into EndevorNodes.ts

I think that's everything...lmk what else should be changed :D

@katelynienaber katelynienaber changed the base branch from master to development November 20, 2020 14:30
@katelynienaber katelynienaber force-pushed the remove-circular-dependencies branch 2 times, most recently from 38bfab5 to 97d2230 Compare November 23, 2020 11:25
@zdmullen zdmullen linked an issue Nov 23, 2020 that may be closed by this pull request
Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
…ing extension

Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
…tion is used all over the extension)

Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
@katelynienaber katelynienaber marked this pull request as ready for review November 26, 2020 10:46
@Alexandru-Dumitru
Copy link

can you please also update linting to include circular dependency detection? It should look like this.
"lint": "concurrently -n \"typescpt,_cycles_,_eslint_,prettier\" \"tsc --noemit \" \"madge --circular --extensions ts ./\" \"eslint --ext .ts .\" \"prettier --check .\"",

Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
@katelynienaber
Copy link
Contributor Author

can you please also update linting to include circular dependency detection? It should look like this.
"lint": "concurrently -n \"typescpt,_cycles_,_eslint_,prettier\" \"tsc --noemit \" \"madge --circular --extensions ts ./\" \"eslint --ext .ts .\" \"prettier --check .\"",

Done!

Copy link
Contributor

@nickImbirev nickImbirev left a comment

Choose a reason for hiding this comment

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

Basically there 3 topics of my comments:

  1. Immutability of objects
  2. Encapsulation of object properties
  3. Missing the important properties for logical contract requirements

I suppose, they are not more invasive than interfaces introduction, so maybe we can fix them or they will be just discarded, if we decide to move on with this PR. Anyway, I suppose, this can a be good starting point to discuss the future contracts and how we will treat them.

getStages: () => IStage[];
}

export interface IRepository {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure, such repository declaration is valid, isn't it?

The repository itself doesn't make any sense without at least url, name, datasourse. I suppose accessors for such properties should return string literals without any undefined abilities? What do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Url, name, and datasource are all private properties of the repo class, therefore they are not included in the interface. We could make them public in the class, but that should be considered during a refactoring of that class, which is out of the scope of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I talked more about getters here. I suppose, the accessor 'getUrl' cannot return undefined and if it return - something went wrong with the entity, because the repository without url doesn't make any sense for me.

Ok, I agree, that the point is in more global scope...

sysName: string
) => IType | undefined;
findFilter: (uri: string) => IEndevorFilter | undefined;
setName: (value: string) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you create setters here?

I think, such domain interfaces can be immutable.

The best advantage of it - working in async flow, you always know, if entity is immutable, that you will get value from accessor even if some promise asynchronously works with the same entity now. What do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, I think this is out of scope...the setters are existing in the master branch. So if we remove them it should be considered during a refactoring of the whole class, which is not the goal of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree about it

src/interface/entities.ts Show resolved Hide resolved
src/interface/entities.ts Outdated Show resolved Hide resolved
Signed-off-by: Katelyn Nienaber <katelyn.nienaber@broadcom.com>
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.

Fix Circular Dependencies
4 participants