Visitor Pattern in Scala

Yes, you should probably start off with pattern matching instead of the visitor pattern. See this interview with Martin Odersky (my emphasis): So the right tool for the job really depends on which direction you want to extend. If you want to extend with new data, you pick the classical object-oriented approach with virtual methods. … Read more

How to pass context in golang request to middleware

If you look at the first example at that Go Concurrency Patterns blog post, you’ll notice that they’re “deriving” their contexts from the Background context. That, combined with the Context and WithContext methods on your Request object, gives you what you need. I just figured this out (and it wasn’t my first run at reading … Read more

What is the difference between Strategy pattern and Dependency Injection?

DI and Strategy work in the same way, but Strategy is used for more fine-grained and short-lived dependencies. When an object is configured with a “fixed” Strategy, for example when the object is constructed, the distinction between Strategy and DI blurs. But in a DI scenario it is more unusual that the dependencies of objects … 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

How far do you go with YAGNI? [closed]

I wholeheartedly agree with the YAGNI principle, but you still want to plan for success. If an application needs a complete rewrite when it suddenly has more than ten users, then it’s YAGNI taken too far. Some things You Are Gonna Need. From my perspective, the two most important points: Don’t shoot yourself in the … Read more

Best Design for a User/Role Management System? [closed]

Because every organization has different needs, you should adapt your design while designing and building a dynamic and flexible user management system. Role Based Access Control (RBAC) is a common approach. In this model, users are assigned roles, and the roles have corresponding permissions. As a result, instead of granting permissions directly to users, permissions … Read more

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