DEV Community

Elliot Derhay
Elliot Derhay

Posted on

Design Patterns Discussion


It's been a while since I've written a post, but I figured I'd ask about something I don't remember learning in college (and also because I've only encountered it while learning Laravel).

Laravel implements a flavor of a design pattern called MVC (at least, its own flavor of the one common in the PHP world from my basic understanding). I had sort of been following this early on learning Laravel. But when asking for help with part of it (just for the sake of sticking to the pattern), it was mentioned to me that what's called "MVC" typically in PHP projects isn't really MVC.

At this point, I was recommended to learn the Action-Domain-Responder pattern instead and pointed to this reading material.

To the point...

I'm planning to look into ADR again this week and wanted to ask others for input.

So what design patterns are you familiar with, and which do you prefer?

P.S. (not to be confused with PowerShell)

The reading material I mentioned earlier links to some MVC history, including how today's "MVC" came about. This definitely was interesting to read for a design patterns newbie like me (that and I just like learning about software development in general).

Discuss away!

Top comments (2)

smartcodinghub profile image
Oscar • Edited

Well, if you are using a frontend separated from the backend, you can use an MVVM + DDD approach.

Use MVVM only in your frontend (React, Angular, JQuery, Vanilla). This way helps to separate concerns and easily create logic only for the U.I.

Use DDD on PHP. You will need to use an MVC framework for creating, i.e., REST services. But using an MVC framework doesn't mean to follow an MVC pattern fully, and you can add all the DDD functionalities with an Onion, Hexagonal, or N-Tier architecture.

I suggest you dig in these patterns too if you find them helpful.

P.D.: To clarify, this kind of patterns are known as architecture patterns. There are other kinds of patterns known as design patterns.