specification 0.0.2

  • README.md
  • Installing
  • Versions
  • 26

#Specification.dart

##Dart implementation of the Specification pattern in Domain Driven Design.

Build Status

What is the specificaiton pattern?

the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic.

"Specification pattern." Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc. 15 April 2013. Web. 27 April 2013.

Examples

import 'package:specification/specification.dart' as spec;

main () {
  var spec1 = spec.expr((value) => value.length > 2);
  var spec2 = spec.expr((String str) => str.startsWith("abc"));
  
  var conjunction = spec1 & spec2;
  print(conjunction.isSatisfiedBy("a"));      // false
  print(conjunction.isSatisfiedBy("abb"));    // false
  print(conjunction.isSatisfiedBy("abcde"));  // true
  
  var disjuction = spec1 | spec2;
  print(disjuction.isSatisfiedBy("a"));       // false
  print(disjuction.isSatisfiedBy("abb"));     // true
  print(disjuction.isSatisfiedBy("abcde"));   // true
  
  var negation = ~spec1;
  print(negation.isSatisfiedBy("a"));         // true
  print(negation.isSatisfiedBy("abb"));       // false
  print(negation.isSatisfiedBy("abcde""));     // false
  
  var exclusiveDisjunction = spec1 ^ spec2;
  print(exclusiveDisjunction.isSatisfiedBy("a"));     // false
  print(exclusiveDisjunction.isSatisfiedBy("abb"));   // true
  print(exclusiveDisjunction.isSatisfiedBy("abcde")); // false
}

Licence

see LICENSE

Author

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  specification: "^0.0.2"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:specification/specification.dart';
        
Version Uploaded Documentation Archive
0.0.2 Jul 1, 2013 Go to the documentation of specification 0.0.2 Download specification 0.0.2 archive
0.0.1 Apr 26, 2013 Go to the documentation of specification 0.0.1 Download specification 0.0.1 archive

Analysis

This feature is new.
We welcome feedback.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Dec 6, 2017
  • Dart: 2.0.0-dev.8.0
  • pana: 0.7.3+1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
85
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall score:
Weighted score of the above. [more]
26

Platforms

Detected platforms: Flutter, server, web

All libraries agree

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

Dependencies

Package Constraint Resolved Available
Dev dependencies
unittest any