coldfusion
Rather than succumb to the many premature rumors of its impending demise, ColdFusion continues to thrive, even more so under the auspices of its new owner, Adobe. With the release of ColdFusion 8, Adobe has reaffirmed its commitment to ColdFusion by releasing the most feature-rich version in years.
ColdFusion并没有屈服于即将灭亡的许多过早的谣言,而是继续蓬勃发展,在其新所有者Adobe的赞助下更是如此。 随着ColdFusion 8的发布,Adobe通过发布多年来功能最丰富的版本来重申其对ColdFusion的承诺。
Whether you’ve never used ColdFusion before, you’re considering coming back to the fold, or you’re looking for a good reason to upgrade, ColdFusion 8 definitely deserves your consideration. Indeed, ColdFusion 8 represents a major release, with more new features than I could possibly cover in a single article. In short, now is a very good time to be a ColdFusion developer, and in this article we’ll look at my favorite reasons why.
无论您以前从未使用过ColdFusion,还是正在考虑回归,还是正在寻找升级的充分理由,ColdFusion 8绝对值得您考虑。 实际上,ColdFusion 8代表了一个主要版本,其新功能超出了我在一篇文章中可能涵盖的范围。 简而言之,现在是成为ColdFusion开发人员的好时机,在本文中,我们将介绍我最喜欢的原因。
What’s that you say? Speed is not a feature? Well, when the improvement is as dramatic as it is in ColdFusion 8, it can definitely be considered a feature. The ColdFusion team analyzed over 100 actual customer applications to find and eliminate bottlenecks. This resulted in an overall improvement that makes the server up to 4.25 times faster than ColdFusion 7.0.2. In fact, some specific areas and tags are 39 times faster than prior versions. In particular, if you’re undertaking object-oriented development using ColdFusion components (CFC), you’ll notice a marked improvement.
你说什么 速度不是功能吗? 好吧,当改进与ColdFusion 8一样显着时,绝对可以认为它是一项功能。 ColdFusion团队分析了100多个实际的客户应用程序,以发现并消除瓶颈。 这导致了整体改进,使服务器的速度比ColdFusion 7.0.2快了4.25倍。 实际上,某些特定区域和标签比以前的版本快39倍。 特别是,如果您要使用ColdFusion组件(CFC)进行面向对象的开发,则会发现明显的改进。
The best part is that you don’t need to do anything to take advantage of this feature other than install ColdFusion 8. Without changing a single line of code, your existing ColdFusion application will see a huge performance boost. So, here’s the plan…
最好的部分是,除了安装ColdFusion 8外,您无需执行任何其他操作即可利用此功能。无需更改一行代码,现有的ColdFusion应用程序将获得巨大的性能提升。 所以,这是计划...
Spend four weeks improving your ranking on World of Warcraft.
花四个星期来提高您在《魔兽世界》中的排名。
If you aren’t already developing with ColdFusion, it’s important to keep in mind that ColdFusion has long since outgrown the accusations of being slow or unscalable. As a developer at The Economist who recently upgraded to ColdFusion 8 noted, “…the whole thing is ridiculously stable.”
如果您尚未使用ColdFusion进行开发,请务必牢记,ColdFusion早已超越了缓慢或不可扩展的指责。 正如最近升级到ColdFusion 8的《经济学人》的开发人员指出的那样,“……整个过程非常稳定。”
Sometimes, when diagnosing application performance issues in previous versions of ColdFusion, it felt like you were a doctor trying to diagnose an internal injury without access to an x-ray machine. You knew something was generally wrong inside, but you had no way of seeing (and therefore, of treating) the issue. Well, the good news is that ColdFusion 8 (Enterprise and Developer versions) comes with an x-ray machine … er … a server monitor that allows you to peer at the internals of your ColdFusion server on which you’re running your application.
有时,当诊断以前版本的ColdFusion中的应用程序性能问题时,感觉就像您是一位医生,试图在没有使用X射线机的情况下诊断内部伤害。 您知道内部总体上有问题,但是您无法查看(因此无法处理)该问题。 好吧,好消息是ColdFusion 8(企业版和开发人员版)配备了X射线机……或者……一个服务器监视器,使您可以查看正在运行应用程序的ColdFusion服务器的内部。
The ColdFusion Server Monitor is a Flex application that allows you to examine a variety of statistics related to the overall health of your server. It provides you with details about specific applications, sessions, requests, and queries. For example, you can get reports on slow requests, and drill-down into those requests to see variable memory usage for each request, as well as the performance of any includes, custom tags, and components within the request. This can help immensely when you’re trying to locate bottlenecks within a slow request. In my opinion, this feature alone will have a huge impact on how developers will build and debug ColdFusion applications going forward.
ColdFusion服务器监视器是一个Flex应用程序,使您可以检查与服务器整体运行状况有关的各种统计信息。 它为您提供有关特定应用程序,会话,请求和查询的详细信息。 例如,您可以获取有关慢速请求的报告,并深入到这些请求中以查看每个请求的可变内存使用情况,以及请求中任何包含,自定义标签和组件的性能。 当您尝试在缓慢的请求中查找瓶颈时,这可以极大地帮助您。 我认为,仅此功能将对开发人员今后构建和调试ColdFusion应用程序的方式产生巨大影响。
In addition, the Server Monitor offers customizable alerts that allow you to receive notification when certain undesirable behaviors occur, such as low JVM memory or excessively long-running threads. You can even customize the response that the Server Monitor implements when this behavior occurs, configuring it either to send an email, create a snapshot, kill threads running longer than a specific timeframe, or even execute a set of custom code from within a ColdFusion component that you specify.
另外,服务器监视器还提供可自定义的警报,当发生某些不良行为(例如,JVM内存不足或线程运行时间过长)时,您可以接收警报。 您甚至可以自定义服务器监视器在发生此行为时实施的响应,将其配置为发送电子邮件,创建快照,杀死运行时间超过特定时间范围的线程,甚至从ColdFusion组件中执行一组自定义代码您指定的。
With the release of version 7.0.2, ColdFusion added Flex integration, which made it the language of choice for building Rich Internet Applications (RIAs) using Adobe’s Flex. This was great for those of us who love Flex (as I do!). However, building RIAs with Ajax required the integration third-party open-source libraries if you wanted to work natively with ColdFusion data types and JavaScript. It also meant that you had to include and learn the syntax of one or more external JavaScript libraries like Ext, Spry or the Yahoo User Interface library (YUI). With ColdFusion 8, this is no longer the case.
随着7.0.2版的发布,ColdFusion添加了Flex集成,这使其成为使用Adobe的Flex构建富Internet应用程序(RIA)的首选语言。 对于那些喜欢Flex的人(就像我一样!),这很棒。 但是,如果您想在本机上使用ColdFusion数据类型和JavaScript,则使用Ajax构建RIA时需要集成第三方开源库。 这也意味着您必须包括并学习一个或多个外部JavaScript库(例如Ext , Spry或Yahoo User Interface库(YUI))的语法。 对于ColdFusion 8,情况不再如此。
ColdFusion 8 has added a long list of new tags and features that have been designed specifically to allow you to rapidly build Ajax-based Rich Internet Applications using a comfortable and familiar tag and function syntax. In fact, the libraries that I mentioned above are built into ColdFusion 8, making it possible, for example, to create an Ajax grid using Ext simply by using the cfgrid tag. You can even bind this grid to a dataset that’s returned by a CFC method simply by putting a reference to the cffunction into the bind attribute of the tag. ColdFusion 8 really does make it incredibly simple and intuitive to add some glitz to your application by integrating rich user interface elements.
ColdFusion 8添加了一长串新标签和新功能,这些标签和功能经过专门设计,可让您使用舒适且熟悉的标签和函数语法快速构建基于Ajax的Rich Internet Applications。 实际上,我上面提到的库是内置在ColdFusion 8中的,例如,可以通过使用cfgrid标签使用Ext创建Ajax网格。 您甚至可以将该网格绑定到CFC方法返回的数据集,只需将对cffunction的引用放入标记的bind属性中即可。 通过集成丰富的用户界面元素,ColdFusion 8确实确实使添加一些浮雕到您的应用程序变得异常简单和直观。
Even better, in my opinion, is that the Ajax integration in ColdFusion 8 goes much deeper than simply adding fancy UI elements to your application. ColdFusion added tags and functions that allow you to easily move data back and forth between JavaScript. For example, with the cfajaxproxy
tag you can make functions that reside within a CFC callable directly from your page, using JavaScript. This feature will even automatically convert data types (such as a ColdFusion query object) into a type that’s usable within your JavaScript block, such as an array or as JSON packets. The created proxy also contains built-in methods for setting a callback handler for the asynchronous method calls. All of this makes working with Ajax and ColdFusion feel completely seamless.
在我看来,更好的是,ColdFusion 8中的Ajax集成比向应用程序中添加简单的UI元素要深入得多。 ColdFusion添加了标签和函数,使您可以轻松地在JavaScript之间来回移动数据。 例如,使用cfajaxproxy
标记,您可以使用JavaScript直接在页面上调用驻留在CFC中的函数。 此功能甚至会自动将数据类型(例如ColdFusion查询对象)转换为JavaScript块中可用的类型,例如数组或JSON数据包。 创建的代理还包含用于为异步方法调用设置回调处理程序的内置方法。 所有这些使使用Ajax和ColdFusion感觉完全无缝。
The following example code shows how the cfajaxproxy
tag can be used to create a class based upon a component that can be used within JavaScript:
以下示例代码显示了如何使用cfajaxproxy
标记基于可在JavaScript中使用的组件来创建类:
<cfajaxproxy cfc="path.to.cfc" jsclassname="MyClass" /> <script> function myFunction(id) { var myClass = new MyClass(); myClass.setCallbackHandler(populateWindow); myClass.getSomeData(id); } function populateWindow { // this function can be used, for example, to populate the returned data into a javascript window generated with the cfwindow tag } </script>
A long time ago, ColdFusion had its own IDE called ColdFusion Studio, which included a step debugger. When that tool moved on from this world, ColdFusion programmers became experts at trying to debug through the cfdump
/cfabort
method, which basically entailed dumping the value of a variable on-screen and aborting the request. While this was effective, it has some major drawbacks, the primary one being that it was an extremely slow and tedious process to debug an entire page this way. Nonetheless, many ColdFusion programmers like me grew accustomed to the drudgery and forgot what we were missing … Well, we’re without a serious debugger no longer!
很久以前,ColdFusion有自己的IDE,称为ColdFusion Studio,其中包括一个逐步调试器。 当该工具从世界上移开后,ColdFusion程序员成为尝试通过cfdump
/ cfabort
方法进行调试的专家,该方法基本上需要在屏幕上转储变量的值并中止请求。 虽然这很有效,但是它有一些主要的缺点,主要的缺点是,用这种方法调试整个页面是一个非常缓慢且乏味的过程。 但是,像我这样的许多ColdFusion程序员已经习惯了繁琐的工作,却忘记了我们所缺少的东西……好吧,我们不再需要认真的调试器!
The ColdFusion 8 debugger was built in the Eclipse IDE, which is a tool that will be familiar to anyone using either Flex Builder or CFEclipse. The debugger allows you to set breakpoints and to debug requests running on either a local or remote ColdFusion instance. Once a breakpoint is encountered, you can inspect the value of any and all variables within any scope contained in the request. Additionally, you can step through the request and watch certain expressions to look for inconsistencies in the value settings. I believe this, combined with the Server Monitor, not only makes the debugging process much easier, but allows us the insight to create much more efficient and bug-free applications. Not that I ever write bugs! (Ahem! — Editor.)
ColdFusion 8调试器内置于Eclipse IDE中,这是使用Flex Builder或CFEclipse的任何人都熟悉的工具。 调试器允许您设置断点并调试在本地或远程ColdFusion实例上运行的请求。 遇到断点后,您可以检查请求中包含的任何范围内的所有变量的值。 此外,您可以单步执行请求并观察某些表达式以查找值设置中的不一致之处。 我相信,将其与服务器监视器结合使用,不仅使调试过程变得更加容易,而且使我们能够洞察力,从而创建效率更高且无错误的应用程序。 并不是说我曾经写过bug! ( 天哪!-编辑。 )
I liken the addition of multi-thread capabilities to ColdFusion 8 to being bitten by a radioactive spider. It provides the developer with a great deal of power, but we all know what comes with great power … yes, usually fame and money, but in this case I’m referring to great responsibility. Additional threads are used to improve the performance of a request that contains some sort of long-running process which is passed off to a thread. Typically, threads can either be:
我将ColdFusion 8的多线程功能比喻为被放射性蜘蛛咬伤。 它为开发人员提供了强大的功能,但是我们都知道强大的功能……是的,通常是名利双收,但是在这种情况下,我指的是巨大的责任。 其他线程用于提高请求的性能,该请求包含传递给线程的某种长时间运行的进程。 通常,线程可以是:
ColdFusion makes it very easy to spawn new threads with the cfthread
tag. Any code contained within the cfthread
tag is executed asynchronously, with the current request existing in an independent stream of code execution. The remainder of your request can continue to process without the need to wait for the thread’s code to finish unless it’s instructed to do so. Any experienced programmer will have run into a multitude of situations where the page request shouldn’t need to wait for a particular process to run before continuing, so clearly this is a very useful function (despite its propensity to be misused).
ColdFusion使得使用cfthread
标记生成新线程非常容易。 cfthread
标记中包含的任何代码都是异步执行的,当前请求存在于独立的代码执行流中。 您的请求的其余部分可以继续处理,而不需要等待线程的代码完成,除非得到指示。 任何有经验的程序员都会遇到很多情况,其中页面请求不需要在继续运行之前就等待特定进程运行,因此显然这是一个非常有用的功能(尽管它有被滥用的倾向)。
To give you an example of how this would work, the following example shows some code that loops through an array of RSS feed URLs and uses the new cffeed
tag to parse the RSS XML. It processes each feed on a separate thread so that they can all run simultaneously, reducing the overall time it takes to process the page. Once the threads are complete, another cfthread
tag is used to rejoin them to the current thread, where we can output the values. Those of you who are already familiar with ColdFusion might also notice that I’m using the new implicit array creation to build my feed array:
为了给您一个如何工作的示例,以下示例显示了一些代码,这些代码循环通过RSS feed URL数组,并使用新的cffeed
标记解析RSS XML。 它在单独的线程上处理每个提要,以便它们都可以同时运行,从而减少了处理页面所需的总时间。 一旦线程完成,将使用另一个cfthread
标记将它们重新加入当前线程,在此我们可以输出值。 那些已经熟悉ColdFusion的人可能还会注意到,我正在使用新的隐式数组创建来构建供稿数组:
<cfset feeds = ["http://www.remotesynthesis.com/blog/rss.cfm?mode=full","http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"] /> <cfset threads = "" /> <cfloop from="1" to="#arrayLen(feeds)#" index="i"> <cfset threads = listAppend(threads,"thread"&i) /> <cfthread action="run" name="thread#i#" feed="#feeds[i]#"> <cffeed source="#feed#" properties="thread.myProps" query="thread.myQuery" /> </cfthread> </cfloop> <cfthread action="join" name="#threads#" timeout="6000" /> <cfloop list="#threads#" index="thread"> <cfif structKeyExists(cfthread[thread],"myProps")> <cfoutput>#cfthread[thread].myProps.title#<br/></cfoutput> </cfif> </cfloop>
As I said earlier, there are so many new features in ColdFusion 8 that I can’t possibly cover them all in detail here. However, here’s a handful of the key features that might pique your interest in this new release:
就像我之前说的,ColdFusion 8中有很多新功能,因此我无法在此处详细介绍。 但是,以下一些关键功能可能会激起您对该新版本的兴趣:
Deeper PDF Integration: As one would expect from an Adobe product, ColdFusion 8 contains the most sophisticated PDF integration of any application server. It goes beyond simply creating PDFs on-the-fly to proving developers with the ability to create PDF forms and accept PDF form submissions, merge PDF files, add and remove pages, create page thumbnails, and much more.
更深入的PDF集成:正如人们对Adobe产品所期望的那样,ColdFusion 8包含所有应用程序服务器中最复杂的PDF集成。 它不仅可以简单地即时创建PDF,还可以证明开发人员具有创建PDF表单,接受PDF表单提交,合并PDF文件,添加和删除页面,创建页面缩略图等功能。
RSS/Atom Integration: As shown briefly above, the new cffeed tag makes it easy to read and create RSS or Atom feeds.
RSS / Atom集成:如上面简要所示,新的cffeed标记使读取和创建RSS或Atom提要很容易。
Image Manipulation: ColdFusion 8 finally includes a long list of tags and functions to create and manipulate images.
图像处理: ColdFusion 8最终包含了一长串用于创建和处理图像的标签和功能。
Zip/Jar File Manipulation: Create, modify and extract both .zip and .jar files.
Zip / Jar文件处理:创建,修改和提取.zip和.jar文件。
Presentations on Demand: Build on-the-fly presentations that work just like Adobe Presenter.
随需演示:建立与Adobe Presenter一样工作的即时演示。
Language Improvements: Version 8 introduces a number of syntax and general language enhancements that include JavaScript-style operators, implicit array and structure creation, and the passing of attributes into tags as collections. These improvements can make your code faster to write, easier to read, and much less verbose.
语言改进:版本8引入了许多语法和常规语言增强功能,包括JavaScript样式的运算符,隐式数组和结构创建以及将属性作为集合传递给标记。 这些改进可以使您的代码编写速度更快,更易于阅读,而且冗长得多。
.Net Integration: Work natively with .Net assemblies that exist either locally or on a remote server.
.Net集成:与本地存在于或位于远程服务器上的.Net程序集本机一起使用。
Exchange Server Integration: Programmatically manage email, calendar items, contacts, and tasks on a Microsoft Exchange Server via ColdFusion tags.
Exchange Server集成:通过ColdFusion标记以编程方式管理Microsoft Exchange Server上的电子邮件,日历项目,联系人和任务。
As you can see, so many new features are included in ColdFusion 8 that your five favorites might be entirely different from mine. If you haven’t tried ColdFusion 8 yet, what’s stopping you? The Developer Version is free, after all. Give it a go!
如您所见,ColdFusion 8中包含许多新功能,因此您的五个收藏夹可能与我的完全不同。 如果您还没有尝试过ColdFusion 8,是什么阻止了您? 毕竟,开发人员版本是免费的。 搏一搏!
Further Reading
进一步阅读
PerformanceColdFusion 8 Performance Brief (PDF, 172K)
Performance ColdFusion 8性能简介 (PDF,172K)
Server Monitor ColdFusion 8 server monitoring series:
服务器监视器 ColdFusion 8服务器监视系列:
Part 3: Automated monitoring and request management with Alerts and Snapshots
Ajax IntegrationAn overview of Ajax features in ColdFusion 8
Ajax集成 ColdFusion 8中的Ajax功能概述
DebuggerUsing the ColdFusion 8 step-through debugger for Eclipse
调试器 使用的ColdFusion 8步通过调试器的Eclipse
coldfusion