Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C chouette-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 36
    • Merge requests 36
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • chouette-core
  • Wiki
  • Coding Conventions

Coding Conventions · Changes

Page history
Updated Coding Conventions (markdown) authored Nov 24, 2017 by Robert Dober's avatar Robert Dober
Hide whitespace changes
Inline Side-by-side
Showing with 41 additions and 1 deletion
+41 -1
  • Coding-Conventions.md Coding-Conventions.md +41 -1
  • No files found.
Coding-Conventions.md
View page @ e5edd7e4
# Coding Conventions # Coding Conventions
\ No newline at end of file
## Do not use _Class Instance Variables_
They are not doing what one would expect and they violate the [Liskov Principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle)
Example:
```ruby
[136] pry(File):1> class A
[136] pry(File):1* cattr_accessor :a
[136] pry(File):1* end
=> [:a]
[137] pry(File):1> class B < A
[137] pry(File):1* cattr_accessor :a
[137] pry(File):1* end
=> [:a]
[138] pry(File):1> class C < A
[138] pry(File):1* cattr_accessor :a
[138] pry(File):1* end
=> [:a]
[139] pry(File):1> C.a
=> nil
[140] pry(File):1> A.a = 42
=> 42
[141] pry(File):1> C.a
=> 42
[142] pry(File):1> A.a
=> 42
[143] pry(File):1> B.a
=> 42
[144] pry(File):1> B.a = 84
=> 84
[145] pry(File):1> A.a
=> 84
[146] pry(File):1> C.a
=> 84
[147] pry(File):1>
```
\ No newline at end of file
Clone repository

Coding Conventions