All Projects → tk3369 → Binarytraits.jl

tk3369 / Binarytraits.jl

Licence: mit
Can do or not? It's easy. See https://tk3369.github.io/BinaryTraits.jl/dev/

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Binarytraits.jl

Java-Programs
Java Practiced Problems including concepts of OOPS, Interface, String , Collection.
Stars: ✭ 51 (+70%)
Mutual labels:  interface, design-patterns
Python Patterns
A collection of design patterns/idioms in Python
Stars: ✭ 29,869 (+99463.33%)
Mutual labels:  design-patterns
Jet Bridge
Jet Bridge – Admin Panel Framework for your application
Stars: ✭ 904 (+2913.33%)
Mutual labels:  interface
Typescript Type Generator
Generate interfaces on the go! Network request? Then generate interfaces for response!
Stars: ✭ 11 (-63.33%)
Mutual labels:  interface
Crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (-26.67%)
Mutual labels:  interface
Jerryslide
Jerry's Knowledge repository - cut down on 2017-02-04 15:26PM
Stars: ✭ 12 (-60%)
Mutual labels:  design-patterns
Haproxy Wi
Web interface for managing Haproxy, Nginx and Keepalived servers
Stars: ✭ 823 (+2643.33%)
Mutual labels:  interface
Happysocialmedia
Microservices Social Media / Network / Chatt, with .net core 2.2, Docker, Implement with Domain Driven Design with all best practices design and architetural patterns as DDD, CrossCutting IoC, SOLID, etc
Stars: ✭ 28 (-6.67%)
Mutual labels:  design-patterns
Russian
🇷🇺 translation [WIP]
Stars: ✭ 14 (-53.33%)
Mutual labels:  design-patterns
Element
Programmatic UI for macOS
Stars: ✭ 855 (+2750%)
Mutual labels:  interface
Feign
Feign makes writing java http clients easier
Stars: ✭ 7,681 (+25503.33%)
Mutual labels:  interface
Javastudspringmvcweb
This is annotation based on Spring and Hibernate Version 4 project.
Stars: ✭ 24 (-20%)
Mutual labels:  design-patterns
Wordpress Admin Style
Shows the WordPress admin styles on one page to help you to develop WordPress compliant
Stars: ✭ 871 (+2803.33%)
Mutual labels:  design-patterns
Upboard ros
ROS nodes for upboard usage
Stars: ✭ 22 (-26.67%)
Mutual labels:  interface
Awesome Scalability
The Patterns of Scalable, Reliable, and Performant Large-Scale Systems
Stars: ✭ 36,688 (+122193.33%)
Mutual labels:  design-patterns
Choo
🚂🚋 - sturdy 4kb frontend framework
Stars: ✭ 6,637 (+22023.33%)
Mutual labels:  interface
React Planner
✏️ A React Component for plans design. Draw a 2D floorplan and navigate it in 3D mode.
Stars: ✭ 846 (+2720%)
Mutual labels:  interface
Tui
A text-based user interface library for golang based on termbox
Stars: ✭ 12 (-60%)
Mutual labels:  interface
Headfirstdesignpatternscpp
An implementation of examples from "Head First Design Patterns", written in C++.
Stars: ✭ 28 (-6.67%)
Mutual labels:  design-patterns
Design Patterns For Humans
An ultra-simplified explanation to design patterns
Stars: ✭ 32,376 (+107820%)
Mutual labels:  design-patterns

BinaryTraits.jl

Dev Docs Build Status codecov.io Project Status

BinaryTraits focuses on usability - traits should be simple to understand and easy to use. For that reason, every trait is binary. An object either has the trait (positive) or does not have the trait (negative).

The design is heavily influenced by the Holy Traits pattern as explained in my Holy Traits book excerpt as well as in Julia manual's trait-based dispatch section. If you think about Holy Traits as the powerful manual transmission, then BinaryTraits gives you automatic transmission. The machinery is the same but it is a lot more pleasant to use.

NOTE: This package is under active development and we may introduce breaking changes. Please follow the issues list if you would like to contribute to the project or have a stake in the design.

Motivation

Just a quick example below. More details can be found in our documentation.

# Use package and import desired positive/negative trait type aliases
using BinaryTraits
using BinaryTraits.Prefix: Can

# Define a trait and its interface contracts
@trait Fly
@implement Can{Fly} by fly(_, destination::Location, speed::Float64)

# Define your data type and implementation
struct Bird end
fly(::Bird, destination::Location, speed::Float64) = "Wohoo! Arrived! 🐦"

# Assign your data type to a trait
@assign Bird with Can{Fly}

# Verify that your implementation is correct
@check(Bird)

# Dispatch for all flying things
@traitfn flap(::Can{Fly}, freq::Float64) = "Flapping wings at $freq Hz"

Main Features

Current features are listed below. Additional features are planned and logged in the issues list.

  • Define traits and assigning them to your own data types
  • Define composite traits that exhibits all of the underlying traits
  • Define interface contracts required for a trait
  • Verify that your data type fully implements all interface contracts
  • Define traits/interfaces in one module and use them from another module
  • Define trait dispatch functions easily

Credits

  • Klaus Crusius for his ideas, articulation, and significant contributions to this project
  • Jānis Erdmanis for his proposal of a new design based upon parametric types

Related Projects

There are quite a few traits libraries around. If this package isn't for you, take a look at these others:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].