John Farrar关于COOP ColdFusion框架

tech2024-03-20  62

COOP is the new kid on the framework block, and was designed to help developers get full-featured prototypes up and running quickly. Here, John Farrar shows off his baby.

COOP是框架框架中的新手,旨在帮助开发人员快速启动功能齐全的原型。 在这里,约翰·法拉尔(John Farrar)炫耀他的孩子。

SitePoint: John, can you give us your elevator pitch for COOP?

SitePoint:John,您能给我们您的COOP电梯间距吗?

The idea behind COOP is "inspirational simplicity" — the separation of the designer’s presentation from the developer’s logic. The technology starts with powerful prototyping and finishes with "preDOM" object coding and clean versatile logic. The API makes it possible to write code with features not standard in the built-in ColdFusion tags.

COOP背后的想法是“鼓舞人心的简单性”-将设计师的演示文稿与开发人员的逻辑分开。 该技术始于强大的原型,最后以“ preDOM”对象编码和干净的通用逻辑结尾。 使用该API,可以编写具有内置ColdFusion标记中非标准功能的代码。

SP: Okay, can you tell us more about the main features?

SP:好的,您能告诉我们更多有关主要功能的信息吗?

We believe COOP is simple to learn and code. You won’t have to go out and buy a book to understand how to build good applications using this framework. Of course, you still can do that, but writing good code shouldn’t require making things so complex that a CF developer will get stuck. This simplicity means you can get faster ROI and bring developers up to speed without enrolling them in "book of the geek" club just to keep up.

我们相信COOP易于学习和编写代码。 您无需外出购买一本书即可了解如何使用此框架构建良好的应用程序。 当然,您仍然可以这样做,但是编写良好的代码不需要将事情变得如此复杂以至于CF开发人员会陷入困境。 这种简单性意味着您可以更快地获得ROI,并让开发人员紧跟潮流,而无需将他们加入“怪胎之书”俱乐部以跟上潮流。

One of the great features of COOP relates to the proper encapsulation and separation of design and program logic. One of the things that’s causing a big stir in the AIR/Flex community is the Thermo project (which allows designers to create interfaces for Flex applications in a visual environment). Regardless of how it’s done, this lets the developer and designer work on the same pages without touching each other’s code — or without breaking each other’s code. They both work on separate files, but they can work in parallel. It takes more than CSS to properly separate the design from the logic, and COOP makes the task incredibly easy. Let me explain how.

COOP的一大特点是设计和程序逻辑的正确封装和分离。 在AIR / Flex社区引起轰动的一件事是Thermo项目(该项目使设计人员可以在可视环境中为Flex应用程序创建界面)。 无论如何完成,开发人员和设计人员都可以在同一页面上工作而不会碰到彼此的代码,也不会破坏彼此的代码。 它们都在单独的文件上工作,但是它们可以并行工作。 要正确地将设计与逻辑分离,需要花费比CSS更多的时间,并且COOP使得任务变得异常简单。 让我解释一下。

The user requests a page. The page contains ColdFusion/COOP markup code in tags. Before the code is run the co-processor, a CFC that runs in parallel with the page is called to manage the logic. This is a controller and it allows the page tags to be treated like objects, which means you can set the data and any attribute other than the ID of tags from the co-processor. The co-processor is called again after the markup code is executed, and then the content’s sent back to the user. So the markup forms the view portion of the request. If your model (data) is needed, it’s called through the co-processor. Yes, for those who care about such things, it does work as an MVC methodology.

用户请求页面。 该页面在标签中包含ColdFusion / COOP标记代码。 在代码运行协处理器之前,将调用与页面并行运行的CFC来管理逻辑。 这是一个控制器,它允许将页面标签视为对象,这意味着您可以设置数据和除协处理器中标签ID以外的任何属性。 在执行标记代码后,再次调用协处理器,然后将内容发送回用户。 因此,标记构成了请求的视图部分。 如果需要您的模型(数据),则通过协处理器调用它。 是的,对于那些关心此类事情的人,它确实是一种MVC方法。

Also, the framework is very flexible. We strongly promote prototyping. When developers are prototyping, they’ll often bury lots of "bad code" in the markup page — code that we’ll re-factor into the co-processor later. It’s okay to do this while we’re prototyping. The process could be compared to the logic of not creating an engine block mold just for a prototype of a car. It means we can use all the attributes that we’ll be setting in the co-processor right inside the markup. Sure, it’s not elegant, but it’s much more productive during the prototype phase! This is how COOP allows developers and designers to achieve higher productivity — designers can pass in a simple string list of data for the prototype’s use, and when the prototype is approved, the developer can replace or override the string list with real data from the co-processor.

而且,该框架非常灵活。 我们大力提倡原型设计。 当开发人员进行原型设计时,他们通常会在标记页面中埋藏很多“不良代码”,这些代码稍后我们会重构为协处理器。 在我们制作原型时可以这样做。 可以将此过程与不仅仅为汽车原型创建发动机缸体模具的逻辑进行比较。 这意味着我们可以在标记内使用将在协处理器中设置的所有属性。 当然,它并不优雅,但是在原型阶段它的生产率更高! 这就是COOP如何使开发人员和设计人员实现更高的生产率的方法-设计人员可以传递简单的字符串数据列表供原型使用,并且在批准原型后,开发人员可以用来自合作伙伴的真实数据替换或覆盖字符串列表。 -处理器。

Last on the top features list would be the value of using COOP to integrate AJAX libraries and encapsulate custom markup and processing. COOP is extensible and it’s open source. There are templates for building your own tags. There are features of the core CFC co-processor and some additional CFCs that make integration easier still. Bottom line is that this is a great way to package AJAX libraries into ColdFusion.

最后,最重要的功能是使用COOP集成AJAX库并封装自定义标记和处理的价值。 COOP是可扩展的,并且是开源的。 有用于构建自己的标签的模板。 核心CFC协处理器的功能以及一些其他的CFC使集成更加容易。 最重要的是,这是将AJAX库打包到ColdFusion中的好方法。

SP: How did COOP come about? Why was it created it?

SP:COOP是如何产生的? 为什么创建它?

Well, we have the same bad history as most programmers. Once upon a time we programmed with procedural programming. After that, other companies came to SOSensible and asked us to pick up the pieces of other projects that were created with procedural programming. The simple concept doesn’t require spaghetti code, but it just starts to happen. We also wanted to help many of our customers who don’t have staff trained in the finer aspects of design patterns and every other thing that makes a developer a super-geek. We wanted to leave projects a .NET or PHP or Java or common CF developer could jump right in and "get".

好吧,我们和大多数程序员一样都有糟糕的历史。 曾几何时,我们使用过程编程进行编程。 在那之后,其他公司来到了SOSensible,要求我们选择使用过程编程创建的其他项目。 这个简单的概念不需要意大利面条式的代码,但是它只是开始发生。 我们还希望为许多没有经过设计模式和其他方面的开发人员培训的客户提供帮助。 我们想让一个.NET或PHP或Java或普通的CF开发人员可以直接进入并“获得”项目。

SP: How are you involved?

SP:您如何参与?

I’m the creator of COOP. I began programming software around 1977. I have worked on many platforms and with many code languages. Perhaps this broad view of development drove me to provide structure without complex, hard-to-understand coding methodologies. Please don’t misunderstand me — I think design patterns work great. It just isn’t going to be the way most guys write code. The pastor who performed my wedding ceremony said, "Greatness is profundity wrapped in simplicity," and to me, this is what COOP is about. It was actually designed more for my company. It was designed so it could be used to replace single pages for clients with messed up sites and to build entire sites that are a pleasure to build and revisit. We thought it was so exciting we just wanted to share it with the rest of the ColdFusion world.

我是COOP的创建者。 我于1977年左右开始对软件进行编程。我曾在许多平台和多种代码语言上工作过。 也许这种广阔的发展前景驱使我提供了没有复杂且难以理解的编码方法的结构。 请不要误会我-我认为设计模式效果很好。 但这绝不是大多数人编写代码的方式。 参加我的婚礼的牧师说:“伟大就是深厚的朴素包裹”,对我而言,这就是COOP的意义。 它实际上是为我的公司设计的。 它的设计使其可以用来用混乱的网站替换客户端的单个页面,并构建整个网站,使您能够愉快地进行构建和重新访问。 我们认为它是如此令人兴奋,我们只想与ColdFusion世界的其他人分享。

SP: When should a developer seek out COOP? What does it have going for it?

SP:开发人员什么时候应该寻求COOP? 它有什么用呢?

Well, as a developer, wouldn’t you like to program the presentation elements like they were objects? This means you can do things like assign a data collection to the ID of a markup page element from the business logic, then set the default or current ID of that element. This is what we mean by "preDOM". Let’s say we had a group of radio buttons and we used the <coop:radiobuttonlist id="idOption"/> tag on the markup page. In the onPageStart() method in our coprocessor, we could set the data for the element using a using the api domain variable _init. It would look like this: _init.idOption.data = getOptions(). Internally, COOP tags can handle things like radio lists. They smartly spot if the data is a list, array, or a query-based recordset, and process it accordingly.

好吧,作为一名开发人员,您是否不想像对象一样对表示元素进行编程? 这意味着您可以执行一些操作,例如从业务逻辑中将数据集合分配给标记页面元素的ID,然后设置该元素的默认ID或当前ID。 这就是我们所说的“ preDOM”。 假设我们有一组单选按钮,并且在标记页面上使用了<coop:radiobuttonlist id="idOption"/>标记。 在协处理器的onPageStart()方法中,我们可以使用api域变量_init为设置元素的数据。 看起来像这样: _init.idOption.data = getOptions() 。 在内部,COOP标签可以处理诸如广播列表之类的事情。 他们可以聪明地发现数据是列表,数组还是基于查询的记录集,然后进行相应处理。

The other cool features of COOP include ICE (Integrated COOP Element) libraries that package domains of COOP extensions for things like jQuery plugins, timyMCE and so on. COOP uses the sosContent tag to make sure JavaScript and CSS integrate more easily for the developer and designer. The core is open source and it’s designed so that customization doesn’t normally conflict with core upgrades. COOP also has KIT power that allows developers to package common elements and place a single tag on a page rather than pasting large blocks of code.

COOP的其他出色功能包括ICE(集成COOP元素)库,该库打包了jQuery插件,timyMCE等功能的COOP扩展域。 COOP使用sosContent标记确保开发人员和设计人员更轻松地集成JavaScript和CSS。 核心是开源的,其设计目的是使自定义通常不会与核心升级冲突。 COOP还具有KIT功能,该功能使开发人员可以打包常见元素并在页面上放置单个标签,而无需粘贴大量代码。

There are also advantages from the designer’s viewpoint, which works out to be an advantage for developers because it creates a better work environment. Designers we interviewed have told us over and over again that they don’t like to program. The issue is that even when they don’t program an automated web application they have to wade through our code without messing it up. COOP lets designers concentrate on the presentation while we concentrate on delivering the content and business logic.

从设计人员的角度来看,还有一些优势,这对开发人员来说是一个优势,因为它可以创建更好的工作环境。 我们采访的设计师一再告诉我们,他们不喜欢编程。 问题是,即使他们不编写自动化的Web应用程序,也必须遍历我们的代码而不会弄乱它。 COOP让设计师专注于演示,而我们专注于交付内容和业务逻辑。

SP: What are the pre-requisites for using COOP? Is there any prior knowledge that would help new users? Does it use any other frameworks that could simplify or complicate things?

SP:使用COOP的前提条件是什么? 是否有任何有助于新用户的先验知识? 它是否使用其他任何可以简化或复杂化的框架?

COOP will work with other frameworks but it doesn’t require any. You can use COOP inside other frameworks, and use things like database frameworks or IOC frameworks inside of COOP. The bottom line is that it integrates and allows integration.

COOP可与其他框架一起使用,但不需要任何框架。 您可以在其他框架内使用COOP,并在COOP内使用数据库框架或IOC框架之类的东西。 最重要的是它可以集成并允许集成。

SP: What sets COOP apart from other frameworks?

SP:是什么使COOP与其他框架不同?

If you like ColdFusion, we think you’ll gravitate to COOP. We like to say COOP thinks more like ColdFusion than any other framework out there. This doesn’t take anything away from many other great works out there — in fact, we would like them to get the concept and create some of the same things for their users also. It’s probably the easiest framework if you wish to integrate an Ajax library and do it ColdFusion style. Check out some of our ICE libraries and you’ll see the simple power of Ajax libraries mixed with object-like interaction of the markup. The tags can be updated. New tags can be added. There’s no need to wait for the next version of ColdFusion to ship! This is a truly open-source solution that works as well on shared hosting as it does in the enterprise.

如果您喜欢ColdFusion,我们认为您会喜欢COOP。 我们要说的是,COOP比其他任何框架都更像ColdFusion。 这与其他许多出色的作品并没有任何区别-实际上,我们希望他们理解这个概念并为他们的用户创造一些相同的东西。 如果您希望集成Ajax库并采用ColdFusion样式,则它可能是最简单的框架。 查看一些我们的ICE库,您将看到Ajax库的简单功能与标记的类对象交互混合在一起。 标签可以更新。 可以添加新标签。 无需等待下一版ColdFusion的发布! 这是一个真正的开源解决方案,与企业中的共享主机一样,可以很好地工作。

SP: Are there any great examples of COOP "in the wild"?

SP:在“野外”有没有出色的COOP范例?

Well, we don’t have any Amazons or Googles just yet…

好吧,我们还没有亚马逊或谷歌……

SP: Sure. Well, can you give us look at some of the code?

SP:好的。 好吧,您能给我们看看一些代码吗?

No problem. Here’s how we could build a simple segment of a COOP page.

没问题。 这是我们如何构建COOP页面的简单片段的方法。

OLD SCHOOL (Procedural code at its finest)   <cfoputput>   <select id="myFruit" name="myFruit">   <cfloop list="apple,blue berry,cherry,mango,orange" index="iFruit">   <option value="#iFruit#">#iFruit#</option>   </cfloop>   </select>   </cfoutput>  STAGE 1: Prototype   <!--- Notes:   We're passing in a list but coop can spot   if the data is a list, array of structures or   a query and knows how to handle that internally.   --->   <coop:selectlist id="myFruit"   data="apple,blue berry,cherry,mango,orange">  STAGE 2: Refactor   (in the word of one developer, the markup page gets "elegant")   <coop:selectList id="myFruit">   (the co-processor page now adds this...)   <cfscript>   /* The init is the base for the page object modeling.   * The myFruit is the ID of the object we are programming   * before creating it. A.K.A. preDOM.   */   _init.myFruit.data = "apple,blue berry,cherry,mango,orange";   </cfscript>  STAGE 3: Enhance   <cfscript>   /* Enhancing the code to real data and control   * by setting attributes in code rather than   * inside the markup.   */   _init.myFruit.data = getFruit();   _init.myFruit.valueField = "fruit_ID"; // id field in recordset   _init.myFruit.displayField = "fruit"; // fruit name in recordset   </cfscript>

There is much, much more that has been built in, and simplified in, COOP. Programming sites with this technology and lets designers do their job without the if…then…else, loop, and all that stuff we developers enjoy. It lets us control the page without touching the design, so we don’t get blamed quite so often for messing up the look and feel! And if you’re working on a site alone, it lets you concentrate on one thing at a time, which is great.

COOP内置并简化了许多功能。 使用这种技术对站点进行编程,使设计人员可以在没有……那么……循环,循环以及我们开发人员喜欢的所有东西的情况下完成工作。 它使我们能够在不影响设计的情况下控制页面,因此我们不会经常因为弄乱外观而受到指责! 而且,如果您仅在一个网站上工作,它可以让您一次专注于一件事,这很棒。

SP: What about licensing, community, support, and documentation?

SP:许可,社区,支持和文档呢?

Our licensing model is listed on at http://coop.riaforge.org/ — basically as COOP is our creation, and there’s no liability for its use, others are welcome to use it for any project. If users have any questions, they can just ask, and we’ll let them know how it works in your scenario. For community support, we have a Google group set up, and initial documentation is available from our site.

我们的许可模式在http://coop.riaforge.org/上列出-基本上是因为COOP是我们的创造,因此对它的使用不承担任何责任,欢迎其他人将其用于任何项目。 如果用户有任何疑问,他们可以提问,我们将让他们知道它在您的情况下如何工作。 为了获得社区支持,我们建立了一个Google小组 ,并且可以从我们的网站上获得初始文档 。

SP: What’s coming up in the future for COOP?

SP:COOP将来会发生什么?

Firstly, we’re working on version 2.0, but we’re going to do a 1.5 release, paving the way. The changes include simple things like a full Unit Test on the back end to test all of the COOP CFCs and tags. We’ve re-factored our code base so that it’s more portable, and isn’t locked to the root of the site. We now handle structure of arrays, and it’s possible to use XML as a data source. On the documentation front, we’re working on YouTube videos for each tag and aspect of the platform.

首先,我们正在开发2.0版,但是我们将准备发布1.5版,为未来做准备。 所做的更改包括简单的事情,例如在后端进行完整的单元测试,以测试所有COOP CFC和标签。 我们已经对代码库进行了重构,以使其更具可移植性,并且不会被锁定在网站的根目录下。 现在,我们处理数组的结构,并且可以将XML用作数据源。 在文档方面,我们正在针对平台的每个标记和方面来制作YouTube视频。

In the future, we’ll implement ICE libraries (TinyMCE, jQuery Grid, Flot, YUI Editor, and much more to follow). These are COOP-style libraries ("ColdFusionified", if you like), collections that have been re-factored to work more easily and integrate more effectively through the power of ColdFusion.

将来,我们将实现ICE库(TinyMCE,jQuery Grid,Flot,YUI编辑器以及其他更多内容)。 这些是COOP风格的库(如果需要,可以使用“ ColdFusionified”),这些集合经过重构可以更轻松地工作,并通过ColdFusion的功能更有效地集成。

SP: Where can people find more information about COOP?

SP:人们在哪里可以找到有关COOP的更多信息?

The base site for COOP is http://coop.riaforge.org and the wiki there, at http://coop.riaforge.org/wiki/, offers a lot of information.

COOP的基础站点是http://coop.riaforge.org ,那里的Wiki, http://coop.riaforge.org/wiki/提供了很多信息。

Our initial docs can be found on our site — they should get most people started.

我们的初始文档可以在我们的网站上找到 -他们应该使大多数人开始使用。

Again, check out the upcoming YouTube videos to get more detail on how to use all the great features of COOP. If you’d like to get in on the 1.5 beta, go to our forum, which is located at RIAForge. There’s also an online presentation on Charlie’s UGTV from the time when the product went to version 1.0.

同样,请查看即将推出的YouTube视频,以获取有关如何使用COOP的所有出色功能的详细信息。 如果您想获得1.5 beta版, 请访问RIAForge上的论坛 。 从产品升级到1.0版以来,Charlie的UGTV上也有在线演示 。

翻译自: https://www.sitepoint.com/coop-coldfusion-framework/

最新回复(0)