Implications for working with clean code

At my workplace, we are planning a major refactoring on our main product, a web application with several “modules”. I quoted this because one of our main problems: modules are not really modules, all of this is monolithic. The application is written in PHP with a template template and using Pear to access the MySQL database. We are not very interested in the independence of the database, although it would be nice if it did not take months to implement.

Our main problem is that development time / cost increases exponentially due to errors that occur in unrelated places and do not have a common common architecture in order to rely on the most common functionality (each module basically copies / pastes one from the previous one, then adapt).

I have some experience with the principle of web MVC, mainly in ASP.NET MVC. I like the clean separation it offers and verifiability. However, when trying to use this on a local machine, the application is simply much slower than it should be.

Ok, enough introduction to the questions: - Do I have to rely on caching modules? Does this eliminate most of the overhead using a good architecture? Something like APC.

  • The application is mostly readable. Record mostly single values ​​(change one field in the record). Any OR / M for PHP that is good at this?
  • Also looking for a flexible MVC environment. I know Zend, CakePHP, maybe Symfony?

The hard part is that we don’t have the luxury to be able to completely rewrite. We will have to gradually improve the currently very dirty code base. This should be done when writing new code or fixing bugs. One thing that I really would like to, REALLY wish to do, is to write a regression test for a new error before correcting it so that it does not appear later (sometimes this happens).

The stack I'm looking at now contains:

  • MVC Choice
  • Logging (log4php?)
  • OR / M of choice (it’s not necessary to be dynamic, code generation is fine too)
  • IoC Container Selection
  • Smarty Templating, , , , .
  • ( , , )

, , - PHP. , , - - .NET/Java, ( ) .


. Retag, , .

+3
5

, . , .

, , , , (, XDebug ZendDebugger) .

, 0,01% "" . , "" , .

+3

:

  • , . , , , , .
  • , . , " " .

, ; , 1% 50%, , , , , bugfixing.

+2

MVC , . , , - docroot MVC (Zend Framework ), :

:
http://site.com/data.php
http://site.com/other.php

: http://site.com/app/controller/action/...

, . , login.php script MVC, , , , GET. .

, XDebug, , . .

+2

, - , sapghetti php -, . , , .

+1

( ) .

, , , , - DRY.

, , .

0

Source: https://habr.com/ru/post/1724112/


All Articles