Click here to Skip to main content
15,914,398 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: I have a horrible feeling I've been using a pattern for years... Pin
OriginalGriff24-Nov-17 6:41
mveOriginalGriff24-Nov-17 6:41 
PraiseRe: I have a horrible feeling I've been using a pattern for years... Pin
Jeremy Falcon24-Nov-17 13:12
professionalJeremy Falcon24-Nov-17 13:12 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
BillWoodruff25-Nov-17 5:01
professionalBillWoodruff25-Nov-17 5:01 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
Marc Clifton24-Nov-17 8:59
mvaMarc Clifton24-Nov-17 8:59 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
CodeWraith25-Nov-17 1:54
CodeWraith25-Nov-17 1:54 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
BillWoodruff25-Nov-17 7:25
professionalBillWoodruff25-Nov-17 7:25 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
lopatir24-Nov-17 18:45
lopatir24-Nov-17 18:45 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
CodeWraith25-Nov-17 1:04
CodeWraith25-Nov-17 1:04 
OriginalGriff wrote:
I hope not, I might have to stop using it ... Unsure | :~
Bullshit! Smile | :)

Design patterns were never intended to be the last word and the answer for everything. There is no law against coming up with your very own way of doing something, no matter what some gurus want to have you believe.

The SOLID faction would condemn you for breaching the single responsibility principle and using something akin to global variables and singletons. So what?

My personal sin is a message broker that I use in almost any UI. When compared to awkward wasteful automatic routing in a large UI tree or fragile code bloating manual routing, having a message broker as a singleton is a blessing. Some object registers with the broker to be notified when a specific message is sent, another object sends the message at some time and the broker looks up all subscribers and calls their event handlers. This is reasonably fast (no searching the entire UI tree) and absolutely unproblematic. The only weak spot is that an object better unregister its subscriptions when it is being destroyed, otherwise the broker may get bogged down servicing dead subscriptions.

Yes, global variables or singletons may be problematic, but sometimes you can have all of the benefits without any complications. I would immediately redesign if any complications materialized, but not simply for the purity of some design philosophy's sake. Why throw away something that has proven itself to be useful often enough?

But that's just me. I have always been conservative with redesigning and been building libraries, even when that meant to store machine code routines on cassette tapes and manually relocating them into a new program.
I have lived with several Zen masters - all of them were cats.

GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
Mike Hankey25-Nov-17 2:15
mveMike Hankey25-Nov-17 2:15 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
BillWoodruff25-Nov-17 4:57
professionalBillWoodruff25-Nov-17 4:57 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
OriginalGriff25-Nov-17 5:23
mveOriginalGriff25-Nov-17 5:23 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
Dave Sexton26-Nov-17 21:11
Dave Sexton26-Nov-17 21:11 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
Gary Wheeler27-Nov-17 1:25
Gary Wheeler27-Nov-17 1:25 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
Gerry Schmitz27-Nov-17 3:14
mveGerry Schmitz27-Nov-17 3:14 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
jschell27-Nov-17 9:14
jschell27-Nov-17 9:14 
GeneralRe: I have a horrible feeling I've been using a pattern for years... Pin
Richard Deeming28-Nov-17 3:49
mveRichard Deeming28-Nov-17 3:49 
QuestionProgramming Question of the Week? Pin
megaadam24-Nov-17 0:34
professionalmegaadam24-Nov-17 0:34 
AnswerRe: Programming Question of the Week? Pin
theoldfool24-Nov-17 1:02
professionaltheoldfool24-Nov-17 1:02 
AnswerRe: Programming Question of the Week? Pin
CPallini24-Nov-17 1:42
mveCPallini24-Nov-17 1:42 
AnswerRe: Programming Question of the Week? Pin
lopatir24-Nov-17 1:46
lopatir24-Nov-17 1:46 
JokeRe: Programming Question of the Week? Pin
V.24-Nov-17 1:49
professionalV.24-Nov-17 1:49 
AnswerRe: Programming Question of the Week? Pin
super24-Nov-17 2:30
professionalsuper24-Nov-17 2:30 
AnswerRe: Programming Question of the Week? Pin
A_Griffin24-Nov-17 2:32
A_Griffin24-Nov-17 2:32 
GeneralRe: Programming Question of the Week? Pin
Jim_Snyder24-Nov-17 3:28
professionalJim_Snyder24-Nov-17 3:28 
GeneralRe: Programming Question of the Week? Pin
PIEBALDconsult24-Nov-17 4:53
mvePIEBALDconsult24-Nov-17 4:53 

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.