有关框架的一般问题

发布于 2024-12-11 18:13:42 字数 492 浏览 0 评论 0原文

好吧,我已经用 PHP 编程好几年了。我总是喜欢从头开始构建内容系统以进行实践(论坛、博客、漫画、通用 CMS 等),但是在过去的几个月中,我得出的结论是,我花费了太多时间在做多余的工作上,例如构建每次都使用基础内容系统 - 从数据库获取信息,在引入任何有价值的内容管理之前使基本布局实际工作,等等。现在,我知道诸如 Zend、CakePHP 等开发框架;但我与他们的合作总是不能令我满意,并且似乎很快就放弃了他们。

所以我的问题是:

  • 这些框架的可定制性如何?一旦我学会正确使用它们并开始研究实际功能,而不是浪费数周时间来建立和运行简单的基础,我真的可以完全自由地使用它们吗?
  • 我可以编写自己的函数在后台做多少事情?
  • 结果通常很快吗?或者框架是否提供缓慢而繁重的代码?
  • 真正让它们对我有利的工作有多直观?超越基础知识并处理真正重要的事情有多容易?

我希望有关于这个主题的任何见解。我也很想知道你们中是否有人有任何首选的框架可以使用。提前致谢!

Ok so I've been programming in PHP for several years now. I always enjoyed building content systems from the ground-up for practice (forums, blogs, comics, general CMSs etc), however in the past few months I have come to the conclusion I am focusing too much time in doing redundant work like building the base content system every time - fetching information from databases, making the basic layout actually work before bringing any valuable content management to it, etc. Now, im aware of development frameworks such as Zend, CakePHP, etc; but I've always failed to work with them to my satisfaction, and seemed to give up on them rather quickly.

So my questions are:

  • How customizable are those frameworks? Can I really get full freedom with them once I learn to use them properly and get to work on actual features instead of wasting weeks on getting a simple base ground up and running?
  • How much can I write my own functions for doing stuff in the background?
  • Are the results usually fast? Or do the frameworks provide slow and heavy code?
  • How intuitive is it to really get them working in my favor and how easy is it to get past the basics nd working with what's really important?

I'd love any insights in this subject. Also I'd love to know if any of you have any preferred frameworks to work with. Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

離殇 2024-12-18 18:13:42

这些框架的可定制性如何?我真的能得到完全的自由吗
一旦我学会正确使用它们并开始实际工作
功能,而不是浪费数周时间来建立一个简单的基础
并运行?

这取决于。如果您获得一个包含所有内容的框架,您将花时间找出使用它的正确方法。
我可以推荐的一种方法是获取一个微框架并自行添加您需要的所有内容。 IE。你会得到像 SlimGlue,提供路由,添加您最喜欢的 ORM,如 propel、doctrine、red bean 或 Pear DB,添加您最喜欢的视图引擎,如 smarty、twig 或其他,添加您在应用程序中需要的 Zend 模块,或者梨类,添加第三方工具。这是一种更长但更灵活的方法。

我可以编写自己的函数来完成多少工作
背景?

这种方法允许您编写您无法找到的所有内容以供您的工作使用。

结果通常很快吗?或者框架是否提供缓慢且
繁重的代码?

因此,性能完全取决于您。这不太取决于您无法控制的因素。

真正让他们按照我的意愿工作有多直观以及如何
超越基础知识并使用真正的东西很容易
重要吗?

这取决于您计划项目的复杂性。当您需要更多功能时,您可以添加部件。

How customizable are those frameworks? Can I really get full freedom
with them once I learn to use them properly and get to work on actual
features instead of wasting weeks on getting a simple base ground up
and running?

It depends. If you get a framework that have everything included you'll spend time to find out the right way to use it.
One approach I could recommend is to get a micro framework and to add everything you need by yourself. I. e. you get microframework like Slim or Glue, that provide routing, add you favourite ORM like propel, doctrine, red bean or Pear DB, add your favorite view engine like smarty, twig or anithing else, add Zend modules that you need in your application or Pear classes, add third party tools. This is a longer, but more flexible approach.

How much can I write my own functions for doing stuff in the
background?

This method allows your to write everything that you cannot find ready for your work.

Are the results usually fast? Or do the frameworks provide slow and
heavy code?

Thus performance completely depends on you. It does not much depend on the factors that you cannot control.

How intuitive is it to really get them working in my favor and how
easy is it to get past the basics nd working with what's really
important?

It depends on the complexity of your planned project. You can add parts as you need more functionality.

无所的.畏惧 2024-12-18 18:13:42

前段时间我写过一个类似问题的答案;

首先你要问自己一些问题;

  • 你真的需要使用框架吗?如果你正在开发一个小型的
    项目,使用这样的框架只会让你的网站
    页面的运行速度比平常慢。他们有太多
    您可能不需要的功能以及最终需要的功能
    你甚至不使用也会使用资源。
  • 您真的想阅读所有用户指南吗?甚至不要忘记
    对于您想要进行的简单查询,您必须读取用户
    指导。安全措施、查询、URL、表单、模板等......等等。
    有时你可能想拯救自己,但最终你会
    首先必须抽出一些时间来学习如何使用它们。

如果您想使用框架,请将其用于更大的项目。这可能会节省您的时间(考虑到您的库中没有他们提供的所有功能)。确保您将要使用的框架能够比您做得更好。

一般来说,他们的要求会匹配许多主机。要求额外的运行要求会降低它们的受欢迎程度,因此您不会遇到托管问题。

我从未使用过框架,而是编写了自己的代码,但我查看了 CodeIgniter。如果你想使用框架,我不建议使用CakePHP。我听说它占用了太多内存。我相信 CodeIgniter 是后起之秀。

尽快回答您的问题;它们易于安装。你可以及时快速地学习。 CodeIgniter 有非常好的文档。如果您想在小型项目上使用它,它们只会使页面比平常更重。为此类项目编写自己的小型框架是实现这一目标的最佳方法。无需两次发现一块土地。如果他们提供并且他们的代码比你的更好(一般来说)那么为什么不使用它呢?如果您有时间和知识,我建议您开始构建自己的。

A while ago I wrote an answer to similar question;

Firstly you have to ask yourself some questions;

  • Do you really need to use Framework? If you are working on a small
    project, working it with such frameworks will just make your web
    pages work slower than they normally would. They have too many
    features which you might not need and eventually those features which
    you don't even use will use resources.
  • Do you really want to go through all user guide? Don't forget even
    for the simple query you want to make, you have to read the user
    guide. Security measures, queries, URLs, forms, templates etc.. etc..
    You might want to save yourself sometime but eventually you would
    have to spare some time first to learn how to use them.

If you want to use framework, use it for bigger projects. This might save you time (considering you don't have all the features they offer in your library). Make sure Framework you are going to use can do better than you can.

Generally their requirements will match many hosts. Asking for extra requirements to run, will decrease their popularity so you won't have problems with hosting.

I never used framework, instead I coded my own but I took a look at CodeIgniter. If you want to use framework, I wouldn't suggest to use CakePHP. I heard it is using too much memory. I believe CodeIgniter is rising star.

To answer your question shortly; They are easy to install. You can learn quickly in time. CodeIgniter has very well documentation. If you want to use it on small projects, they will just make the page heavier than it normally would be. Coding your own small framework for such projects is the best way to approach it. No need to discover a land twice. If they offer and their code is better than yours (generally speaking) then why not to use it? If you have time and knowledge, I would recommend you to starting building your own.

你的他你的她 2024-12-18 18:13:42

谷歌和 stackoverflow 上有很多可用的框架和大量站点,讨论每个框架的细节。

就我个人而言,我更喜欢准系统类型的框架,例如 kohana 或 codeignitor,它们为您提供基础知识,并且重量相当轻。因此,您最终会得到一些基础知识的帮助,但很大程度上您只能依靠自己的设备来创建网站。

There are lots of frameworks available and tons of sites on google and here on stackoverflow that discuss the in's and out's of each framework.

Myself personally, I prefer a barebones type framework like kohana or codeignitor, they do the basics for you and are fairly lite weight. So you end up with some help doing the basics, but largely you are left to your own devices to create a website.

你在看孤独的风景 2024-12-18 18:13:42

这些框架的可定制性如何?

工具箱的可定制性如何?
不要将框架与 CMS 混淆。框架只是一个工具箱。还有某种应用程序的框架。

我真的能得到完全的自由吗?

绝对
框架主要是一种意识形态。你必须接受特定框架的宗教洗礼,并按照它建议的方式做事。

我可以编写多少自己的函数来在后台执行操作?

我听不懂这个问题。

结果通常很快吗?或者框架是否提供缓慢而繁重的代码?

框架通常提供缓慢而繁重的代码。
但代码本身很少成为瓶颈。

从问题提出的方式来看,我建议学习一些框架,然后继续创建自己的框架。

How customizable are those frameworks?

How customizable is a toolbox?
Do not confuse framework with CMS. Framework is a merely a toolbox. And some sort of application carcass too.

Can I really get full freedom.

Definitely NO.
Framework is mostly an ideology. You will have to be baptized into particular framework's religion and do things the way it propose.

How much can I write my own functions for doing stuff in the background?

I can't get the question.

Are the results usually fast? Or do the frameworks provide slow and heavy code?

frameworks usually provide slow and heavy code.
but the code itself is very seldom being a bottleneck.

From the way the question asked, I'd suggest to learn some framework and then proceed to create your own one.

南烟 2024-12-18 18:13:42

我一直认为使用成熟 PHP 框架的人是懒惰的人(或者是非常匆忙的人)。从长远来看,使用框架不会再增加你的知识基础,因此它对你的时间有好处,但对你没有好处。我必须同意 David Parker 的观点,使用你从头开始构建的东西,这样你就不必再这样做了,无论你做什么,都不要停止学习,因为一个不开发自己的开发人员就不是开发人员,对吧?

I always think of people who use matured PHP frameworks as lazy people (or in a major hurry). In the long run, using frameworks will not increase your knowledge base anymore and therefore it's good for your time, but not good for you. I have to agree with David Parker, use something you've built from ground-up so you wouldn't have to anymore and whatever you do, do not stop learning because a developer who doesn't develop himself is no developer, right?

维持三分热 2024-12-18 18:13:42

好吧,你在抱怨 php 框架。但是java和.net呢?

你认为人们知道关于他们的一切,甚至知道它是如何运作的吗?并不真地!

要点是,大多数时候人们都在努力完成工作。

在我看来,zend 是一个很棒的使用 php 的框架,特别是当你将它与 smarty 集成时。是的,你可以扩展它。

well you are complaining about php frameworks. but how about java and .net?

do you think people know everything about them or even how it works. not really!

Point is that, most of the time people are trying to get their job done.

IMO, zend is great framework to work with php especially when you integrate it with smarty. and yes you can extend it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文