Building what’s in front of you

« »

Recently while working on an application I found myself asking a number of architectural questions. These were questions about things that I might consider “fundamental” – elements of the application, how many methods each class might receive, and how to put it all together into something cohesive.

You might have asked yourself some of the same questions.

I also found myself feeling bad for not following certain “best practices” that have been described recently. For example, I found myself not using event sourcing, and I rejected CQRS as too big and too cumbersome to use for my simple CRUD application.

But then I realized that I was looking at the problem from the wrong perspective.

Event Sourcing, full DDD, CQRS and middleware are great solutions that apply to applications that need them. Some applications will need a few, others will need all, and still others will need none.

It’s okay to decline certain patterns, even popular ones, in favor of doing things in a more old school or traditional way. Every application is different, and just like how we have different restaurants that serve different cuisine, we can have different applications that use different techniques.

There are certain bedrock principles, like object-oriented principles, that we simply cannot ignore in designing our applications. But advanced design patterns are optional, no matter how popular they become.

I needed to remember that in building an application, I need to build my application, rather than the application I hope to have or want to have some day. That’s what refactoring is for. As long as I follow the bedrock principles, I’ll be able to refactor, to test, and to deploy my code with ease.

So build your application, but build it the way you need it to work and the way it needs to be build.

Brandon Savage is the author of Mastering Object Oriented PHP and Practical Design Patterns in PHP

Posted on 7/2/2019 at 3:42 pm
Categories: PHP, Engineering

There are currently no comments.

« »

Copyright © 2023 by Brandon Savage. All rights reserved.