GithubHelp home page GithubHelp logo

objectorientedprogramming's Introduction

Studying Object Oriented Programming and SOLID

#Chapter-02 - SRP and Cohesion

  • Calculate Salary Discount depending on job role. Three ways to solve it and switching between implementations.
  • Solution-01 Based on book using EnumType and Interfaces
  • Solution-02 Using Reflection
  • Solution-03 Using Dictionaries

#Chapter-03 - Coupling and DI

  • Examples for low coupling and how to abstract implementation behavior
  • Solution-01 Based on book using Interfaces
  • Solution-02 Using EventHandlers
  • Solution-03 Using Actions

#Chapter-04 - Open Closed

  • Example using open closed principle and Unit Test with MOQ

#Chapter-05 - Encapsulation and propagation of changes

  • Tell, Don't ask - If you need to ask with a IF statment what you should to do when a object has a value, probably probably you'll be hurting the encapsulation principle. The rule of implementation must be encapsulatated on a method of this object.
  • "Demeter's Law" - If you have to chain methods, encapsulate this behavior in the class which really needs to use this behavior and expose just one method, doing it you'll have less code to modify if necessery a change in the future.

#Chapter-06 - Inheritance Vs Composition "No code, I only wrote some considerations for the chapter."

  • A son class should not be tighten pre condition or loosen the post condition. The pre condition are the inputs and the post condition are the outputs. For example, if the main class knows how to work with 1 to 100, your son's pre condition could bigger than it, creating a new behavior as so the value will be treat inside the son class. However, if the main class knows how to return 1 to 100, your child's the pos condition must be between these values, and not bigger. The reason is, if some class in the system already is using the abstraction of the main class, it's wont have a problem because it's already prepared to work with the max value.
  • With composition it's easier to change the implementation while receiving it on constructor than just implementing the methods from a interface or just using the inherited methods.

#Chapter-07 - Thin Interfaces and ISP

  • Examples for create cohesive interfaces and how to simplify parameters into methods.

#Chapter-08 - Consistency, small and big objects

  • Builder and Factory to create valide objects
  • Tiny Types, Immutable types

References

  • Orientação a Objetos e SOLID para Ninjas

objectorientedprogramming's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.