FAQ Database Discussion Community


Mapping property values to conditions

c#,wpf,xaml,anti-patterns
I am new to WPF and C#. I have a button in my GUI that is presented as an image. However, the image displayed depends on certain conditions. Depending on the conditions, the button could be one of 5 images. I have coded it like this : View: <Button x:Name="bShow"...

Event handler has dependency on call order

c#,winforms,treeview,refactoring,anti-patterns
On WinForm there is TreeView control. In AfterSelect event is private field selectedFolder updated. For event OnKeyDown for Delete key is event handler implemented that interacts data access layer : selectedFolder is passed as parameter to method DeleteFolder. The selected node of TreeView is also removed Code has following issue:...

angularjs service calling $location.path is it against best practices?

javascript,angularjs,angular-ui-router,anti-patterns,angular-services
I am using a service in angularJS where I call $location.path inside one method in order to make a route change after a success or failure response from another service internally. Is this against Angular's best practices?

lisp: dynamic scope vs explicit parameter passing

design-patterns,coding-style,common-lisp,anti-patterns,dynamic-scope
I see two different patterns for "output" functions in (common) lisp: (defun implicit () (format t "Life? Don't talk to me about life!")) (defun explicit (stream) (format stream "This will all end in tears.")) (defun test-im-vs-ex-plicit () (values (with-output-to-string (stream) (let ((*standard-output* stream)) (implicit))) (with-output-to-string (stream) (explicit stream)))) Is using...

Publisher in Pub/Sub should be Synchronous or Asynchronous?

javascript,design-patterns,javascript-events,anti-patterns
My view on mechanism: Pattern wise publisher should just publish an event and should not care about listeners / subscribers for that topic / event. In case of JavaScript, lot of frameworks for Pub / Sub publishes event in Sync manner for example : framework just maintains map of event...