Giter Site home page Giter Site logo

dependency-diagrams's Introduction

Dependency Diagrams

References:

Essential Developer - Caio and Mike

Dependency Diagram



Solid line, empty head = "Inherits from" / "Is a"


Inherits From


This denotes that a class is inheriting from another class. In the example below, the NewsFeedViewConroller is inheriting from UIViewController, a class within the UIKit module. In this specific example, it is highlighting a modular dependency upon UIKit.


import UIKit

class NewsFeedViewController: UIViewController {}



Solid line, closed head = "Strong dependency on" / "Has a"


Depends On


This denotes that a class has an instance of another class that is created upon point of initialisation or is injected. It is best practice to inject this dependency using property or constructor injection.


class NewsFeedVieController {

  private let loader: NewsFeedAPI
  
  init(loader: NewsFeedAPI) {
    self.loader = loader 
   }
}



Dashed line, open head = "Conforms to" / "Implements"


Depends On


This denotes that a class conforms to or implements a protocol/interface. In the example below, the APIService implements the NewsFeedAPI protocol.


class APIService: NewsFeedAPI {

  //Protocol Methods.

}



Dashed line, filled head = "Weakly depends on"


Depends On


This denotes a weak dependency on another object. This is commonly seen in dependency that are passed straight to methods but not stored as properties in the containing class. In the example below, the APIService can be initialised without any strong concrete dependencies, however, the class itself has a weak dependency upon HTTPClient as it is required for one of it's methods. I don't like this approach as it is an implicit dependency.


class APIService {

  func load(using client: HTTPClient)
  
}

dependency-diagrams's People

Contributors

james-jasenia 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.