Skip to content
Andre Baltieri edited this page Nov 7, 2017 · 9 revisions

What is Flunt?

Every app has business rules and validations, and you probably will need to keep all the errors and notifications that happened and send it to somewhere, maybe to your UI.

Flunt implements the Notification Pattern and helps you to track everything that happend, consolidating your notifications and making it easy to access and manipulate.

What is in this package?

There are a few things you can do with Flunt, let's check them. Remember you can find samples on this wiki!

Notifications

Do you want to keep track of everything that happened on your classes? Simple! Just inherit from Notifiable class and you'll be able to AddNotifications and check if your class Isvalid.

Please check the Notifications Wiki for more details and examples.

Design by Contracts

Every time you add a condition (IF) to your code, you increase it's complexity, and if we take a look, there are a few conditions we could avoid, conditions that check if string is empty for example. So why don't we move it to a function, test it and re-use it? That is what we did!

You can use the Contract class to specifify that some property is required, has a max len, or even to compare values. If any specification of your contract fails, it will automatically add a notification to your class.

Please check the Design By Contract Wiki for more details and examples.

Specifications

Don't want to mess your code with stupid but necessary validations? Just create specifications. With this, you can specify which validations are necessary to create a new customer for example, to edit an order, and goes on.

Please, check Specifications Wiki for more details and examples.

Fail Fast Validations

Don't want to let anything bad arrive in your Domain? Fail Fast Validations is a way to validate the inputs as soons as your data arrives, failing immediately.

You can use the IValidatable contract to ensure your class will be validated.

Please check Fail Fast Validation WIki for more details and examples.