1
vote
1answer
185 views

Advice on refactoring PHP Project

I have a small SAS ERP that was written some years ago using PHP. At that time, it didn't use any framework, but the code isn't a mess. Nowadays, the project grows and I’m now working with 3 more ...
0
votes
1answer
65 views

testing: which code layers should I aim to test?

Say I have this code: Design { public function load() { $this->loadProduct(); $this->loadService(); ... } public function loadProduct() { ...
0
votes
1answer
150 views

Is there a Pattern or a Refactoring Method to pull data-loading out of existing Class

I am refactoring legacy codebase. Part of it is a loadProduct() function inside a larger "everything" class. loadProduct() loads data from a database. I want to move this loading-data part out of ...
7
votes
4answers
434 views

Would you refactor this and if so, would you charge your client?

I am working on a freelance job at home. The client wants me to write some new functionality for his CMS, but it is taking me a lot of time to figure out what the code is doing, because it is written ...
0
votes
2answers
350 views

Breaking up a large PHP object used to abstract the database. Best practices?

Two years ago it was thought a single object with functions such as $database->get_user_from_id($ID) would be a good idea. The functions return objects (not arrays), and the front-end code never ...
7
votes
4answers
172 views

Controllers and re-factoring for maintainability / sensibility

I have read many posts similar to this on the site: however I still am questioning what is best in my situation (also the answers are contradicting from question to question). I have a website ...
3
votes
1answer
112 views

How should I write new code when the old codebase and the environment uses lots of globals in PHP

I'm working in the Wordpress environment which itself heavily relies on globals and the codebase I'm maintaining introduces some more. I want this to change and so I'm trying to think how should I ...
12
votes
5answers
1k views

Why is my class worse than the hierarchy of classes in the book (beginner OOP)?

I am reading PHP Objects, Patterns, and Practice. The author is trying to model a lesson in a college. The goal is to output the lesson type (lecture or seminar), and the charges for the lesson ...
6
votes
3answers
859 views

How to explain your non-programmer boss you need to refactor a whole site?

First of all, is not a programming matter, is a programmer afair. I'm the new web programmer in my company. I'm here just for 2 weeks. And they want me to teach Wordpress, configure & install it, ...
6
votes
1answer
330 views

General approach to re-factoring an large, very badly written legacy system [duplicate]

Possible Duplicate: Techniques to re-factor garbage and maintain sanity? What is a good way to refactor a large, terribly written code base by myself? Really open question here. I'm not ...
4
votes
3answers
348 views

Refactoring Bittersweet PHP: How can I make this less painful?

I've just been assigned a large project. The client has had multiple developers across different companies working on their (intended to be) large, MySQL driven eCommerce site. The DB schema is ...
2
votes
2answers
1k views

What is the best way to work with DAL and BLL?

I'm currently refactoring my DLL and BLL and I need some advice on what is the best way to work with DAL and BLL. My current solution is like this: // DAL class only consists of SQL queries and ...
1
vote
3answers
301 views

How to convince a client to switch to a framework *now*; also examples of great, large-scale php applications

I'm about to start working on a very ambitious project that, in my opinion, has some great potential for what concerns the basic concept and the implementation ideas (implementation as in how this ...