this month were talking about java, web services, and "things not cf" - topics that are fast becoming common subjects of discussion among cfers. im not going to focus on just one cfdj list thread, but on several recent threads and examples that illustrate the trend, and a recent new requirement to explore other technologies.
as everyone knows by now, with the release of coldfusion mx the coldfusion application server now runs on top of the java platform. a world of new functionality now exists under the hood, just waiting for cf developers to take advantage of and find clever uses for it. for example, how many times have you created a coldfusion variable and then used the ampersand operator in your cfml code to append characters to this string? its not an uncommon occurrence at all. while theres nothing inherently wrong with this practice - there is another way!
in java theres a class called the stringbuffer class. in addition to other uses, its often used in servlet programming to build an html string before returning it to the browser. its quite easy to use a stringbuffer instead of a coldfusion variable to store and manipulate strings; the advantage is that stringbuffer objects have a built-in method that performs concatenation with the current value. this means that rather that instantiating a new object in memory every time you concatenate (which is what happens in cfml), you can create one object and tell it to concatenate on itself. listing 1 shows the code, shown first using "standard" cfml and th... 下一页