DCSIMG
Design Patterns,Anti-Patterns - Uri Lavi

Browse by Tags

All Tags » Design Patterns » Anti-Patterns (RSS)

API Best Practices

During our last Software Craftsmanship meeting I have delivered a short (about 14 min) talk on API best practices (in Hebrew). You can find it here:

Code Smells

If you like practicing in identifying code smells, then you can find below a short class called TimerManager . public class TimerManager { public delegate void TimerCallback ( object data); private static readonly object _sync = new object (); private readonly Dictionary < int , Timer > timers = new Dictionary < int , Timer >(); private readonly Dictionary < int , TimerCallback > callbacks = new Dictionary < int , TimerCallback >(); public void SetTimeout( TimerCallback timerCallback...

Writing Readable Code - Complex Object Construction

Once upon a time, there was a class called Invoice. Its responsibility was to calculate a final price being presented to the customer. Time went on; The autumn passed, the winter fade out and the spring was already at the door and our class started to rust . Each time a developer found a new set of relevant parameters (that should have been passed to the Invoice class) he added a new constructor, to support them. And so it happened, that after a while, two fellows stumbled on the class: "What's...

One pattern to rule them all

Well, there is none... Simply to put, there is no silver bullet . Yet, while designing an application, there are several well known extremes: "Heavy weighted design" - Such a design will use almost each and every pattern described in the bible of "Design Patterns" - by the Gang of Four. However, squeezing as much as possible patterns into your design has a bad smell . Here is what Erich Gamma has to say on the matter: "Trying to use all the patterns is a bad thing, because...