Design patterns and encapsulation for procedural programming?

I am working on a rather large PHP project written in procedural style (it was written before PHP 5), and I cannot help but feel that some of the things I do are a bit of a “hack”. “Modifying elsewhere can easily break the application. All the design patterns and best practices that I have seen seem to apply only to OOP. I could start writing some of my code using the PHP 5 OOP features, but I'm not sure all other developers are quite familiar with OOP.

Is only the procedure for procedural programming seeming “hacky” to people more familiar with OOP? Are there best practice books that discuss ways to save large procedural applications and reduce the likelihood of new errors?

I know that I could apply OOP principles / patterns in a procedural form, but if I was going to do this, I could just use the PHP OOP functions. Maybe I'm just not well versed in the procedural paradigm?

+3
source share
2 answers

, PHP, "" - , , . , , , , BAAAAAAD, , . , .

, . , .

- , , , . "", . , .

+6

OOish. , , . $. set_title ($ page, $title) $page- > set_title ($ title), . , , .

- . , , , . , , . , . , - - .

, . PHP3, . $HTTP_GET_VARS, . , , inderdependent code, .

PS: : - . ( , ). . .

0

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


All Articles