GithubHelp home page GithubHelp logo

yolk-contracts's Introduction

Want to work for Gamer Network? We are hiring!

Yolk Contracts

Introduction

This package defines the interfaces and traits for the core services used throughout the Yolk framework. e.g. yolk\contracts\database\DatabaseConnection defines the contract for accessing a database, while the yolk\contracts\support\collections\Dictionary contract defines methods for operating on a collection of key/value pairs.

Each directory corresponds to a Yolk package that provides implementations of the interfaces defined in that directory. For example, the gamernetwork/yolk-log package contains implementions of yolk\contracts\log\Logger.

Why Contracts?

A separate contracts package provides two primary benefits:

  • A quick reference point for all available contracts.
  • A single, decoupled package that promotes loose-coupling by separating interfaces from implementations.

Quick Reference

Having all of the framework's services neatly defined within interfaces provides succinct documentation to available features.

Rather than tracking down which methods are available within a large, complicated class, you can refer to a simpler, cleaner interface.

Loose Coupling

Wikipedia Reference

Yolk packages provide default and usually basic implementations of each contract, that sometimes might not be sufficient or quite right for a particular project.

By specifying contracts, code is no longer coupled to these specific implementations and you may easily write alternatives that better suit your project.

Likewise, you can switch between implementations without modifying any consuming code. The classic example being able to switch caching backends (e.g. Memory/Redis/Memcache) without modifying any code that uses the cache.

Naming Conventions

Interfaces in this package are named in one of two ways:

  • As a singular noun (e.g. Dictionary, DatabaseConnection, Filter)
  • As a noun or verb suffixed with "-able" (e.g. Arrayable, Runnable)

The implementations of those interfaces with in Yolk components are usually prefixed with "Base-", although there are some variations - in particular some implementations still use the deprecated prefix "Generic-".

  • RequestBaseRequest
  • ResponseBaseResponse
  • DatabaseConnectionBaseConnection
  • ConnectionManagerGenericConnectionManager
  • ProfilerGenericProfiler

yolk-contracts's People

Contributors

simon-downes avatar

Watchers

Dave Hansen avatar James Cloos avatar  avatar  avatar Vicky Stephens avatar Faye Butler avatar Sam Hayes avatar Izzy Smillie avatar Igor 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.