Search and Replace in MVC
Posted
by
danip
on Programmers
See other posts from Programmers
or by danip
Published on 2013-05-07T11:45:20Z
Indexed on
2013/11/11
16:16 UTC
Read the original article
Hit count: 164
What would be a good MVC/OOP/GRASP/SOLID structure for a search/replace functionality. Methods: search/searchNext/replace/replaceAll.
I'm interested only in the PHP arhitecture and how a professional developer would implement this in it's OWN FRAMEWORK.
What names would you use for the classes? What subfolders would you used in your MODEL folder? How would you connect the MODELS/CONTROLLER?
This is just a arhitecture question to understand better the principles of good OOP in practice.
My current implementation is very simplistic using a service model:
/controller/SearchReplaceController.php /models/services/SearchReplaceService.php
The problem with this is I know I'm breaking SRP in the service but I found this somehow acceptable. Also creating a service does not feel like the best solution for this.
© Programmers or respective owner