Thoughts On Programming Paradigms
I have some question about the usage of php.
As I am more to a design guy, I prefer class oop design than function oriented design, however there are some design pattern you can implement without oop, but maybe is optimized. For example, drupal should be a good cms framework, but the use of class oop is not widely used in the framework.
Do you have any thought on this?What is the current practice used by your company in php project? oop or functional, or mixture or both? What’s the benefit in the perspective?
IMHO, people develop software to solve problems. Your client has a problem,
and he/she express problems in terms feature specifications. You analyse the
problem, model the solution, and implement the solution model. OOP,
Imperative Programming, Functional Programming, and Logical programming are
just alternative ways of analyzing problems and modeling solutions. In
another words, different programming paradigms use different approach to
analyse problems and model solution.I personally disagree when people said that certain paradigm is better that
others. I also don’t think that there is a direct relationship between
performance and programming paradigms. For example I am developing a chess
game and I need to implement the AI engine. Programming the AI engine using
Prolog and Scheme may result in a more efficient software than
C++/Java/Python. If I use Java, I have to construct the whole rule-based
reasoning engine, and then provide data structure to capture the game rules.
For Prolog, this two features is natively built into the
Prolog interpreter and optimized. Implementing AI engine using Prolog may
result in shorter development time.I don’t think that Drupal/Wordpress/Linux is not OO because of legacy
reason. I think the community chose that. OOP started in 1960s, and has
already gone mainstream in the 1980s. If you are a good/experienced software
architect, you can design a good (i.e. maintainable, flexible) software
using imperative programming. We attend schools that tells us how OOP is
better than other paradigms, yet everyday we see bad “OO” design that is
worse than WP’s and Linux’s design.In my company, we performed OO analysis (UML modeling). As for the
implemented code, it is far from what is considered OO design (from a OO
purist perspective). I think the software I wrote has elements from
different programming paradigms.