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

Add a "code consistency" chapter #1

Closed
4 tasks
rstegg opened this issue Apr 13, 2017 · 9 comments
Closed
4 tasks

Add a "code consistency" chapter #1

rstegg opened this issue Apr 13, 2017 · 9 comments
Milestone

Comments

@rstegg
Copy link

rstegg commented Apr 13, 2017

Code consistency is crucial for readability and maintainability:

  • What is consistency? (is it the look of the code? is it the structure?)
  • What isn't consistency? (e.g. does using class and function declarations cause inconsistency?)
  • Why consistency matters
  • How consistency can bring about better development practices

Consistency patterns:

@bebraw
Copy link
Member

bebraw commented Apr 14, 2017

Yeah, good idea. I wonder if a part of this belongs to the linting chapter.

@rstegg
Copy link
Author

rstegg commented Apr 14, 2017

I think linting is one way to attempt to solve consistency, but linting can't solve your whole codebase.

@bebraw
Copy link
Member

bebraw commented Apr 14, 2017

Yup, that's true. This needs more fodder to show examples which cannot be captured by linting.

@rstegg
Copy link
Author

rstegg commented Apr 14, 2017

I can think of two consistency types ATM:

  • "Style" consistency - linting
  • "Completeness" consistency - e.g. every class with a getter should also have a setter

@bebraw
Copy link
Member

bebraw commented Apr 14, 2017

Ok, http://eslint.org/docs/rules/accessor-pairs covers latter. 😄

@rstegg
Copy link
Author

rstegg commented Apr 14, 2017

Oops! I didn't know. Perhaps there isn't a need for this extra section then? 😄

@bebraw
Copy link
Member

bebraw commented Apr 14, 2017

Yeah, let's leave this open for a while to gather ideas.

@dcarral
Copy link

dcarral commented Apr 22, 2017

As food for thought, there are a bunch of inconsistencies which can't be handled by means of static analysis. Naming consistencies are the first ones I can think of, e.g.:

  • Entity/abstraction named ThingThatLoadsFoo vs another one named BarLoader. We can use one pattern or the other (in case of this stupid example, perhaps we might wanna use the latter), but mixing both of them in the same project would be inconsistent.

@bebraw
Copy link
Member

bebraw commented Apr 24, 2017

@dcarral Great point. Maybe this is where custom linting rules could come in? Naming tends to be more project specific than other rules. Pushing towards automation and showing how to do that might work here.

bebraw added a commit that referenced this issue Oct 11, 2017
@bebraw bebraw added this to the v1.0 milestone Oct 11, 2017
bebraw added a commit that referenced this issue Oct 12, 2017
* feat: Add a section about code consistency

Closes #1.

* chore: Add examples of code consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants