小弟我现在知道类 对象 接口 但小弟我不知道一个项目应该如何构架类 行为 属性请教小弟我应该看那方面的书呀~
我现在知道类 对象 接口 但我不知道一个项目应该怎么构架类 行为 属性请问我应该看那方面的书呀~~
我现在知道类 对象 接口 但我不知道一个项目应该怎么构架类 行为 属性请问我应该看那方面的书呀~~
如题~~很是迷惑~
------解决方案--------------------
我觉得应该看系统设计的相关书
------解决方案--------------------
软件工程的书, 尤其是面向对象设计的,
名字看起来象"面向对象程序设计"这类的都可以
------解决方案--------------------
《深入PHP面向对象,模式与实践》先看十遍
------解决方案--------------------
老师在黑板上画个圆
老师在黑板上画个三角
老师在纸上画个圆
------解决方案--------------------
------解决方案--------------------
4楼的书目前不推荐,因为那个不是面向对象入门书. 大部分OO分析/设计/编程的书是用java/c++等写成,php的有,但是不推荐. 所以,去找java的书
你7楼的问题, "请问 画(圆)这个行为 在那个写 应该是人,还是黑板呀 还是圆"
我的回答是: 都可以
因为"画"这个动作,它们3方都有参与,而且都不可缺. 在任何一方实现都是可以的写法.
这个是你在设计阶段要决定的,而且也有可能在重构时改变.
放在哪里能让你的设计更容易理解,更简单等等...就更好
同时, 应该在设计时保持一致性, 比如一般不应该"老师"里也有一个"画","圆"里也有一个"被画",
这样让人疑惑,而且很可能是重复的代码, 同样的, 如果"圆"里有"被画","正方形"里也应该有个"被画",
这时你可以将这个"被画"抽象到他们的抽象父类"形状"里去....
当你面对不同的需求的时候,你会发现不同的设计会带来不同的感觉和后果,
所以,相比于这样比较"虚"的例子,你不如去直接写一个小小的实际的项目,(比如一个小bbs?)
那样更容易让需求具体化,可以写出实际的代码,也就能更好地体会.

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











JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

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 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 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.

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.
