Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 框架VS自已!!想问一下自已写程序运行效率是不是没有框架高?

框架VS自已!!想问一下自已写程序运行效率是不是没有框架高?

Jun 23, 2016 pm 02:23 PM

框架VS自已!!想问一下自已写程序运行效率是不是没有框架高?

我看到好多人提到框架,为什么要用框架?就是为了开发速度快?

如果排除开发速度,协同原因,那自已写原生态代码运行效率上就没有框架的高吗?

困扰很久,不知是用框架还是不用框?观摩中国知名的CMS有那几个用ZD,YII,TP 等主流框架的,好象没有?

希望能解一个凝惑,(千万不要跟我说开发速度快协同好原因)


回复讨论(解决方案)

运行速度:
每个语句的执行都是要花费时间的
被执行的代码越少,速度越快!这是浅显的道理
框架有其固定套路,代码量一定比原生的多

运行效率:
对于常见功能,框架多做了优化处理
如果你的水平低于框架开发者,那就不好说了

适用范围:
原生态代码适合于小量、需求多变的场合
框架适用于批量、需求相对不变的场合


框架还有一个好处就是便于后期维护!(规则被定死了)
原生态的万一程序员走了(其实国内很多程序员的编写规范都不是很好),维护起来很麻烦!

是不是可以这样理解运行的代码越少效率就越高呢

任何语言当然是越少执行效率越高了。框架的作用只是将程序和页面等进行分层,提供单一入口,提供基本函数和方法以及一些公用类库,但程序功能还是需要自行编码实现的。往往,框架中的很多类库可能根本用不到或者不适用,还需要进一步改造。框架只是提供了一种开发的遍历,如果给你打好了房基,你只需要在这个基础上开始盖房子就好了。

自已写,成本比较高,用别人的框架,可以加快开发的进度,但同时也带来一定的风险,主要是安全问题

自已写,成本比较高,用别人的框架,可以加快开发的进度,但同时也带来一定的风险,主要是安全问题 你自己写的原生代码比别人的框架安全性更高吗?

如果主流框架不适合自己的需求,并且自己做的是小项目那就可以自己写框架的,这样可以避免很多不必要的代码,关注与自己的项目功能就行了


自已写,成本比较高,用别人的框架,可以加快开发的进度,但同时也带来一定的风险,主要是安全问题 你自己写的原生代码比别人的框架安全性更高吗?
框架的安全问题多主要是因为它是开放的,攻击者往往可以看到源码.而自己写的代码因为没有足够的测试可能漏洞更多一点,但是因为它不对外开放的原因,漏洞被发现的机会要小得多.(注:半吊子程序员写的包含常识性错误的代码除外)

。。。。。。。。。。。。。。。。。。这个主题的生命力真长久

如何最快的建网站,一般般的就行,现在连入门都没有机会

谢谢!各位的回答!那我还是决定用YII框架,网上说这个框架效率很高,是不是有这么一回事呢

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

HTTP Method Verification in Laravel HTTP Method Verification in Laravel Mar 05, 2025 pm 04:14 PM

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

Discover File Downloads in Laravel with Storage::download Discover File Downloads in Laravel with Storage::download Mar 06, 2025 am 02:22 AM

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

See all articles