Giter Site home page Giter Site logo

brief-talks's Introduction

brief-talks

1-Singleton Design Pattern: is used when only one instance of a class can be initialized and can not have multiple instances of that class

it is used oftenly with database instance, when you need only one instance across the app and every one who will use the database has to use the same instance without creating one for its own.


2-Builder Design Pattern: is mainly used to build a complex object using simple smaller objects step by step until the Builder class returns the final complete object

used when have a complex object that can be broken down into a smaller parts (classes) each of them construct a step (stage) that can be added together to complete the final object for example building a House class that has Roof class , Floor class ,Basement class and so on, We can build each of them and add them together to finally construct the House.


3-we use dependency injection to inject the dependency into the dependent rather than have it in the dependent.

it has a several benefits like changing the dependency during run time, but the actual use can be represented by Car class which depends on several components like wheels , engine ,mirrors ,and so on.

so if we want to change let's say the wheels, we will have to change the car class to have the new wheels. But with DI you can inject the wheels to the Car class so the Car will not be concerned with the wheels creation and how to implement them.

The DI is like a middle man who the Car class asks him for wheels and he provides the car with the necessary wheels without having the car to be concerned of how the wheels will be created

brief-talks's People

Contributors

omarzer0 avatar

Watchers

 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.