Giter Site home page Giter Site logo

mtumilowicz / java15-design-patterns-made-functional-workshop Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 127 KB

Implementations of basic GOF design patterns in a more functional way, using function and streams.

License: GNU General Public License v3.0

Java 68.63% Groovy 31.37%
design-patterns functional-design functional-java first-class-functions first-class-citizens stream

java15-design-patterns-made-functional-workshop's Introduction

Build Status License: GPL v3

java15-design-patterns-made-functional-workshop

preface

  • to refresh knowledge about design patterns please refer: https://github.com/mtumilowicz/designPatterns
  • goals of this workshop
    • show some design patterns in a more functional way
    • introduction to basic functional programming structures enabling neat design
      • functions as a first-class citizen
      • streams
  • workshops: /lambda/<Name>Workshop
  • answers: /lambda/<Name>

introduction

  • Single Abstract Method (SAM) type
    • another name for @FunctionalInterfaces
      • functional interface is also known as Single Abstract Method Interface
    • example: Runnable, Callable, etc
    • provide target types for lambda expressions and method references
  • first-class citizen
    • is an entity which supports all the operations generally available to other entities
    • operations typically include being passed as an argument, returned from a function, modified, and assigned to a variable
  • programming language is said to have first-class functions if it treats functions as first-class citizens

mapping

Pattern Lambda
Chain of Responsibility Stream of functions
Decorator Functions composition
Interpreter Map of functions
Iterator Stream
Strategy SAM
Template SAM
Visitor Map of functions
  • note that many more patterns from GOF could be rewritten in a more functional way by simply using SAM conversion
    • example: Observer

java15-design-patterns-made-functional-workshop's People

Contributors

mtumilowicz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

whisper-bye

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.