
From Procedural to OO: My First Step Toward Software Architecture
Introduction This project marks the beginning of my transition to software architecture. I refactored a procedural PHP e-commerce into a well-structured OO codebase, applying design patterns and SOLID principles. Although I had seen these concepts before, this was my first time applying them systematically in a real project structure. In this article, I'll cover: The problems with procedural code How I applied Strategy, Factory, and Repository patterns How interfaces reduce coupling and enable testing The final architecture and folder structure The Problem with Procedural Code The procedural code has a lot of problems including mixed responsibilities, SQL injection vulnerability, difficulty adding new types, harder testing, and high coupling. For example, a single function might validate data, build SQL queries, and execute them directly - all mixed together. Strategy Pattern (explica o que é, onde usou, por que) Factory Pattern (explica o que é, onde usou, por que) Repository Pattern
Continue reading on Dev.to Beginners
Opens in a new tab

