PHP 开发人员正在寻找等效于 Java EE 架构的解决方案 [英] PHP developer looking for solutions equivalent to Java EE architecture

查看:21
本文介绍了PHP 开发人员正在寻找等效于 Java EE 架构的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名 PHP 开发人员,我阅读了 Java EE 技术,我想用 PHP 和所有随附的东西(MySQL、Apache...)实现这些技术(n 层、EJB、JPA...).

I am a PHP developer, I read about Java EE technologies and I want to implement such technologies( n-tier, EJB, JPA...) with PHP and all what coming with (MySQL, Apache...).

推荐答案

不要.

PHP 不是 Java.像编写 Java 代码一样编写 PHP 代码是愚蠢并且适得其反.很可能让未来的代码维护者想要伤害你.

PHP is not Java. Writing PHP code like you'd write Java code is silly and counterproductive. It's very likely to make future maintainers of the code want to hurt you.

需要持久化一个对象?使用 ORM.

Need to persist an object? Use an ORM.

需要多层架构吗?如果您通过适当的关注点分离来设计代码,那么您已经完成了 9/10.

Need a multi-tier architecture? If you design your code with proper separation of concerns, you've already gotten 9/10ths of the way there.

EJB?每次我阅读维基百科文章时,对它们的描述都不一样.可重复使用的组件?具有用于什么、分布式应用程序和数据持久性的标准化接口?有用,是的,但这不是 PHP.ORM 和良好的消息/工作队列将完成工作.

EJBs? Every time I read the Wikipedia article, they're described differently. Reusable components? With a standardized interface for what, distributed applications and data persistence? Useful, yeah, but that's not PHP. ORMs and a a good message/work queue will get the job done.

底线:对于绝大多数 PHP 脚本,您不需要任何企业技术".如果您这样做,您就做错了:要么您已经过度架构了应用程序,或者您选择了错误的平台.

The bottom line: For the vast majority of PHP scripts, you will not need any "enterprise technologies." If you do, you're doing something wrong: either you've having overarchitected the application, or you've chosen the wrong platform.

首先选择 现代PHP 框架,并从那里构建您的应用程序.如果您来自 Java,那么 Zend Framework 似乎是最不陌生的.Kohana、Symfony 和 CodeIgniter 都是值得的.暂时避免使用蛋糕.

Start by picking a modern PHP framework, and build your application from there. If you're coming from Java, then Zend Framework will seem the least foreign. Kohana, Symfony and CodeIgniter are all worthwhile. Avoid Cake for now.

保持简单,你就不会出错.

这篇关于PHP 开发人员正在寻找等效于 Java EE 架构的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆