There isn't a perfect dictionary definition for "micro framework", but the python micro framework, Flask has a decent explanation here: what does micro mean.
As to whether or not it would be appropriate for a complex website, experience will guide you. As your project grows in complexity, you may find that you outgrow the micro framework, and may prefer something that promotes better code organization in a large project. But if this is a side project, don't let the fear of outgrowing it prevent you from starting with a micro framework that you're comfortable with.
A micro definition: To me, a micro framework does less for you and leaves more freedom on how you write and organize your code.
When using Rails, you pretty much have to use a relational DB and use the conventional naming and directory structure it builds on. It also includes much more functionality out-of-the-box.
Sinatra, on the other hand, lets you have the flexibility you want and pick-and-choose your functionality. For example, I used Sinatra to create a CouchDB-backed website/service while doing so in Rails would have been much more complex.
I'm a big fan of Sinatra and have used it on several small projects. If you don't have a lot routes or resources within the project, it is a good solution. There are also a lot of plugins and helpers out there that will help with the "cookie-cutter" code and reduce your workload (and keep the code-base smaller).
Keep in mind, you don't get things like migrations or models out-of-box. These features can be introduced to your project with ease but you may find yourself reinventing the wheel in a lot of cases.
As I am writing this I am actually porting a Sinatra based project to Rails 3.1. The project started small but slowly became to difficult to manage as I added features over time.
Well there isn't one true answer to this one. I've been around quite a bit and developped a couple of frameworks myself, so what I'd say is that a micro-framework is mostly a routing library coupled with a security lib and a bit of syntactic sugar and stubs to extend it later on. Lately micro-frameworks have been used a bases for bigger ones, like Silex and Symfony, so you cant really outgrow those anymore.
发布评论
评论(4)
“微框架”没有完美的字典定义,但是 python 微框架 Flask 在这里有一个不错的解释:微是什么意思。
至于它是否适合复杂的网站,经验会指导您。随着项目复杂性的增加,您可能会发现微框架已经无法满足需要,并且可能更喜欢能够在大型项目中促进更好的代码组织的框架。但如果这是一个副业项目,不要因为担心它会超出它的范围而阻止您从一个您熟悉的微框架开始。
There isn't a perfect dictionary definition for "micro framework", but the python micro framework, Flask has a decent explanation here: what does micro mean.
As to whether or not it would be appropriate for a complex website, experience will guide you. As your project grows in complexity, you may find that you outgrow the micro framework, and may prefer something that promotes better code organization in a large project. But if this is a side project, don't let the fear of outgrowing it prevent you from starting with a micro framework that you're comfortable with.
微观定义:对我来说,微观框架为你做的事情更少,并且在如何编写和组织代码方面留下了更多自由。
使用 Rails 时,您几乎必须使用关系数据库并使用其构建的传统命名和目录结构。它还包括更多开箱即用的功能。
另一方面,Sinatra 可以让您拥有所需的灵活性并选择您的功能。例如,我使用 Sinatra 创建一个由 CouchDB 支持的网站/服务,而在 Rails 中这样做会复杂得多。
A micro definition: To me, a micro framework does less for you and leaves more freedom on how you write and organize your code.
When using Rails, you pretty much have to use a relational DB and use the conventional naming and directory structure it builds on. It also includes much more functionality out-of-the-box.
Sinatra, on the other hand, lets you have the flexibility you want and pick-and-choose your functionality. For example, I used Sinatra to create a CouchDB-backed website/service while doing so in Rails would have been much more complex.
我是 Sinatra 的忠实粉丝,并在几个小项目中使用过它。如果您的项目内没有很多路线或资源,那么这是一个很好的解决方案。还有很多插件和帮助程序可以帮助您处理“千篇一律”的代码并减少您的工作量(并保持代码库更小)。
请记住,您无法获得开箱即用的迁移或模型之类的东西。这些功能可以轻松地引入到您的项目中,但在很多情况下您可能会发现自己在重新发明轮子。
当我写这篇文章时,我实际上正在将一个基于 Sinatra 的项目移植到 Rails 3.1。该项目一开始规模很小,但随着时间的推移,我添加了功能,慢慢变得难以管理。
I'm a big fan of Sinatra and have used it on several small projects. If you don't have a lot routes or resources within the project, it is a good solution. There are also a lot of plugins and helpers out there that will help with the "cookie-cutter" code and reduce your workload (and keep the code-base smaller).
Keep in mind, you don't get things like migrations or models out-of-box. These features can be introduced to your project with ease but you may find yourself reinventing the wheel in a lot of cases.
As I am writing this I am actually porting a Sinatra based project to Rails 3.1. The project started small but slowly became to difficult to manage as I added features over time.
好吧,这个问题没有一个真正的答案。我已经接触过很多次,并且自己开发了几个框架,所以我想说的是,微框架主要是一个路由库,加上一个安全库和一些语法糖和存根,以供以后扩展它在。最近,微框架已被用作更大框架的基础,例如 Silex 和 Symfony,因此您无法再真正超越它们。
Well there isn't one true answer to this one. I've been around quite a bit and developped a couple of frameworks myself, so what I'd say is that a micro-framework is mostly a routing library coupled with a security lib and a bit of syntactic sugar and stubs to extend it later on. Lately micro-frameworks have been used a bases for bigger ones, like Silex and Symfony, so you cant really outgrow those anymore.