淘宝资深架构师微博的一句话,小弟我来问问
淘宝资深架构师微博的一句话,我来问问
淘宝资深架构师在微博上说了这么一句话,内容如下
“做Web,前端还是PHP(或者Ruby, Python,Perl)起步快,发展到一定阶段后再分层,中间层再用C/C++, Java,Go这类的语言实现高性能,分布式服务。所以学好两门语言还是有必要的。”
链接在此
请问这个前端是怎么定义的?或者这个前端指的是什么?
因为就我目前的水平,我理解的前端是html css js之类的
------解决方案--------------------
N,应该更广义一些,泛指直接面对使用者的表现/接收层
------解决方案--------------------
一般把与用户交互的层称为前端,php这类脚本也是在与用户打交道。后端是指数据存储或计算的层。比如db,比如日志,日志分析等等。
不过我个人认为php这类脚本的定位也应该是中间层,就像mvc模型中的c属于前端与后端的桥梁。
------解决方案--------------------
淘宝的前端不是php做的吗?底层可能就是c,c++,java
------解决方案--------------------
当涉及到 高性能 分布式的前提下 PHP就到了前端了...这里说的前端可能泛指了一些,因为在一些项目里PHP很多时候也在处理输出,而不是抛出数据.大约才有这么一说吧.
这个东西没有科学标准,所以楼主也不需要纠结,怎么说都对。
------解决方案--------------------
他说的前端不是我们平时所理解的前端,同5楼意见
DAO以下据说一般是C++或者JAVA了
------解决方案--------------------
不一定要跨语言的,用接口就可以,把数据传到其他语言的接口,就像接力赛,各自跑一段
我做这个事情已经多年,只要格式化一段数据在最短时间扔给下家接收,所以有很长时间没”接触“数据库了
------解决方案--------------------
DAO还是可以用PHP来写的,跨语言的时候换一个DAO类就可以,这个DAO类实现REST模式的数据操作,而JAVA那边就提供REST服务
我也没实际玩过,但手上的项目已经准备进入这一阶段了.然而其实由于我不精通JAVA,当然不会用JAVA搞REST,还是用PHP做REST服务平台的(主要是为了做分离,不是为了实现跨语言),以后再看情况要不要换JAVA吧...公司也没有意思请PHP以外的技术人员的样子,比如员工抽空学一下,了解一下.NET都表现出不高兴呢

------解决方案--------------------
不同语言的交互,最简单的方法可以采用i/o输出的接口来进行。比如java请求一个php的接口返回一段json,java拿到这个json然后去做自己的处理,得到结果后再post给.net。
不过也有别的办法,比如Apache Thrift。先前是facebook开发的,这个东西充当一个翻译的角色。它会把源语言的数据结构转换为自己的一种中间语言(DSL),然后再转换为目标语言可以识别的数据类型。不过这个东西有点庞大,需要一定的学习成本。
也有一些比较轻量级的,google的protocolbuf。
------解决方案--------------------
他说的没有错,那并不算跨语言。那就是我说的第一种方法。
真正的跨语言,需要php可以读取或引用java或.net的数据类型,这需要一定的转换工作。再比如c要读取c++的class数据时,需要将其转换为struct,因为c没有class。Thrift和protocolbuf就是类似这样工作的。
第一种方法所有语言使用的都是第三方的数据类型:json、xml等。
------解决方案--------------------
嗯,不是真正的跨语言,除了JSON,XML,还有BSON,要求不是非常非常高的话相信这些数据格式通过REST就已经能满足了.但是REST是基于http协议的,一般用于Web开发领域
非Web开发或者Web底层模块可能就是真正的跨语言翻译数据与对象了吧.
------解决方案--------------------
淘宝网的主页,商品页面等等一些 用户常用的web应用用php来做。效率比java,c++要高。
淘宝中中和支付有关的功能,用c++或php去做。
因为涉及到钱,这样的功能实在太重要了。考虑到安全性等等因素。所以不用php。
还有,php中可以调用java 手册中有
这是我的理解

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.
