Click here to Skip to main content
15,909,546 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Song of the Week Pin
908236519-Feb-16 4:14
908236519-Feb-16 4:14 
GeneralMQOTD Pin
V.18-Feb-16 21:21
professionalV.18-Feb-16 21:21 
GeneralRe: MQOTD Pin
Herman<T>.Instance18-Feb-16 21:29
Herman<T>.Instance18-Feb-16 21:29 
GeneralRe: MQOTD Pin
HobbyProggy18-Feb-16 21:50
professionalHobbyProggy18-Feb-16 21:50 
GeneralRe: MQOTD Pin
Brittle161818-Feb-16 22:49
Brittle161818-Feb-16 22:49 
Generalnot quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project PinPopular
BillWoodruff18-Feb-16 11:43
professionalBillWoodruff18-Feb-16 11:43 
GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
Kevin Marois18-Feb-16 11:46
professionalKevin Marois18-Feb-16 11:46 
GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
Marc Clifton18-Feb-16 12:26
mvaMarc Clifton18-Feb-16 12:26 
BillWoodruff wrote:
with some of Marc Clifton's interesting articles here.


Smile | :)

Working with fluent implementations in MongoDB, I realized that there can be a huge pitfall -- it's 100% imperative, describing both how and what. So, when building something like an aggregator with MongoDB, it becomes really dangerous, in my humble opinion, because all that fluent code locks you in to a specific understanding of what your data looks like now.

Fortunately, the aggregator can still be built from declarative strings or by passing in a list of aggregators. But what if the designers didn't provide that option, and only provided a fluent interface?

Sure, you could rewrite:
RuleFor(customer => customer.Discount).NotEqual(0).When(customer => customer.HasDiscount);

as:
var step1 = RuleFor(customer => customer.Discount);
var step2 = step1.NotEqual(0);
var step3 = step2.When(customer => customer.HasDiscount);

But what a PITA, to have to fold in the declarative "what" with the imperative "how." For a rule engine, fluent is probably just fine, but for creating dynamic interfaces to databases, like MongoDB, fluent can be a death trap.

Besides, what if you want to change:

customer => customer.HasDiscount to customer => customer.HasDiscount || store.OffersPromotionDeal ?

Here is great example of having to change the business rule, rebuild the app, redistribute it, when the damn thing should have been specified declaratively from the get go.

Be very very careful of Fluent. Wink | ;)

Marc

GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
BillWoodruff18-Feb-16 18:37
professionalBillWoodruff18-Feb-16 18:37 
GeneralRe: not quite serendipity, but impressive: Jeremy Skinner's 'FluentValidation github project Pin
Marc Clifton20-Feb-16 8:13
mvaMarc Clifton20-Feb-16 8:13 
GeneralI'm as mad as hell and I'm not going to take this anymore! PinPopular
GuyThiebaut18-Feb-16 8:13
professionalGuyThiebaut18-Feb-16 8:13 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Manfred Rudolf Bihy18-Feb-16 8:25
professionalManfred Rudolf Bihy18-Feb-16 8:25 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut18-Feb-16 8:31
professionalGuyThiebaut18-Feb-16 8:31 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Manfred Rudolf Bihy18-Feb-16 8:43
professionalManfred Rudolf Bihy18-Feb-16 8:43 
PraiseRe: I'm as mad as hell and I'm not going to take this anymore! PinPopular
Duncan Edwards Jones18-Feb-16 8:26
professionalDuncan Edwards Jones18-Feb-16 8:26 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Cornelius Henning18-Feb-16 8:37
professionalCornelius Henning18-Feb-16 8:37 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut18-Feb-16 8:43
professionalGuyThiebaut18-Feb-16 8:43 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
Cornelius Henning18-Feb-16 8:57
professionalCornelius Henning18-Feb-16 8:57 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
BillWoodruff18-Feb-16 11:26
professionalBillWoodruff18-Feb-16 11:26 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut19-Feb-16 6:49
professionalGuyThiebaut19-Feb-16 6:49 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
JHizzle18-Feb-16 21:58
JHizzle18-Feb-16 21:58 
GeneralRe: I'm as mad as hell and I'm not going to take this anymore! Pin
GuyThiebaut19-Feb-16 0:38
professionalGuyThiebaut19-Feb-16 0:38 
GeneralDo You Think ASP.NET has a Future? Pin
User 1218466518-Feb-16 8:00
User 1218466518-Feb-16 8:00 
GeneralRe: Do You Think ASP.NET has a Future? PinPopular
Kevin Marois18-Feb-16 8:08
professionalKevin Marois18-Feb-16 8:08 
GeneralRe: Do You Think ASP.NET has a Future? Pin
ClockMeister19-Feb-16 6:10
professionalClockMeister19-Feb-16 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.