Advantages of Java’s enum over the old “Typesafe Enum” pattern?

“cannot be subclassed” isn’t a restriction. It’s one of the big advantages: It ensures there there is always only ever exactly the set of values defined in the enum and no more! enum correctly handles serialization. You can do that with type-safe enums as well, but it’s often forgotten (or simply not known). This ensures … Read more

Zero SQL deadlock by design – any coding patterns?

Writing deadlock-proof code is really hard. Even when you access the tables in the same order you may still get deadlocks [1]. I wrote a post on my blog that elaborates through some approaches that will help you avoid and resolve deadlock situations. If you want to ensure two statements/transactions will never deadlock you may … Read more

What are the main advantages of MVC pattern over the old fashioned 3-layer pattern

The separation of concerns that’s quoted as being an advantage of MVC is actually also an advance of a 3-layer/3-tier system. There too, the business logic is independent and can be used from different presentation tiers. A main difference is that in classic MVC the model can have a reference back to the view. This … Read more

Simple Dependency Resolver

DI Containers are complex libraries. Building them takes years and maintaining them decades. But to demonstrate their working, you can write a simplistic implementations in just a few lines of code. At its core a DI Container would typically wrap a dictionary with System.Type as its key and, the value would be some object that … Read more

Design Methodology: use case driven vs. domain driven

Use Cases focus on Users, Actions, and Processes. This is great from a business perspective, because everyone can see an abstracted view of what the system will provide. DDD focuses on creating software that solves problems. The ‘Who can solve this?‘ and the ‘What process will they follow?‘ come afterwards. DDD really gets to the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)