Pacific Connection(英語)

Visualforce Announced at Dreamforce 2007 CEO Mark Benioff is pacing back and forth on the stage in front of an enormous video screen on which the company’s semi-official logo, a red circle-and-slash overlaying the word ⁠software,⁠⁠ is bouncing between two Pong-like paddles. The auditorium, wider than long, is in San Francisco’s Moscone Center, where the company’s fifth annual Dreamforce conference is kicking off. will claim that 7,000 people from 42 countries were in attendance, and they all seemed to be at the keynote.

Benioff and three co-founders started in a San Francisco apartment (1445 Montgomery St.) almost nine years ago. He is tie-less in a pinstripe suit and has the look of a slightly rumpled banker after a long day, but in his own way, he is as polished a presenter as Steve Jobs. The tale he tells of the company’s origins is now a familiar one, but it seems to get more impressive every year as the crowds grow larger. The first product was a contact manager, written in assembly language. At a developer’s conference held a few months earlier, Benioff recalled how back in the 1980s, he kept waiting for Apple to come out with its first Mac compiler and wound up working for the company. A couple of years later, he moved to Oracle for a 13 year stint before founding Salesforce.

The company hopes to make $1 billion in sales this year. It has 35,000 customers, 900,000 subscribers. Big customers include Cisco, whose chairman John Chambers, is on hand for a speech, Dell, and the Japan Post. There are 24 Japanese ISVs on AppExchange, the company’s Application clearinghouse site. (Benioff asks to see a show of hands of people from Japan. A scattering of arms are raised.) Disney, he says, has built a Mickey Mouse management system?managing the character’s appearances so that there’s no over-saturation and no mouse cloning. Electronic Arts, always in need of programmers, has used Salesforce to build a ⁠talent acquisition⁠⁠ system. The project took three weeks. Benioff’s not-so-subtle point is that these are in-house applications from large IT organizations doing serious development work on Salesforce servers.

Benioff ticks off more stats. The infrastructure accommodated 18.7 billion API calls to the database and hosts 44,000 custom applications?with 200 on display at the show? 5.5 million custom reports, 176,000 custom objects, 384,000 lines of Apex Code, even though the programming language, announced last year, had only been in release for a month. All these API calls and objects and code lines?⁠more than 6.2 million customizations to our service⁠?are the stuff of application development. Developers are everywhere, with conferences and a lounge full of demo workstations and a Wii console dedicated to them. In other words, Salesforce as a development platform is catching up, and might even overtake Salesforce as a ready-made application hosting company. Renaming its platform ⁠⁠⁠ with the tagline ⁠Platform as a service,⁠⁠ wants to provide everything a programmer could want without ever having to resort to the local hardware.

Last year, it was the back-end business logic via Apex Code. This year, it’s the user interface, via a product called Visualforce, which Benioff called ⁠the last piece of the platform puzzle⁠⁠ and, less modestly, ⁠the most important breakthrough we’ve ever made.”

That remains to be seen, but there was no denying that the company has managed to put together the essential ingredients of a hosted developer environment: database, business logic, and now, the user interface, all in one place. The two key advantages of Visualforce touted at the conference are onscreen flexibility and support for multiple devices. You can produce onscreen forms with far more control over the look and feel, including things like blogs and wizards that would have been difficult or impossible to do before. And you can port applications to devices. Benioff mentioned tablets, kiosks and mobile phones, and showed off a demo running on an iPhone. As with Apex Code itself, Visualforce remains a work in progress, with programmer feedback awaited. But one of the biggest advantages of SaaS is that feature upgrades can be continual, as long as they are backwards compatible.

Benioff said that the impetus for the platform is the ever-widening span of customers who are looking for ever more specialized, vertical applications, which in turn, require ever more customized tabs, fields, page layouts, APIs and objects. ⁠We said?wow?our customers are yearning for more of a platform, because there is no way we’re going to build every single application for every industry.⁠⁠ And the driving force for the company’s continual improvement of the platform is ⁠so that you can focus on the fun stuff. That’s our motto: we want you to do the innovation, we’ll take care of the infrastructure.⁠

Of course it’s one thing for a developer to use a third-party software architecture and trust that the company?a Microsoft or an Oracle?will be around for a while. It is a much wider leap of faith when the outside company is also providing your hardware architecture, as well. The obvious benefit is that is lavishing attention over the server farm and software updates, so that you don’t have to. But if that architecture were to crash, there is nothing you can do except pick up the phone. Hence the meta-message behind Dreamforce is that you are not alone: if Cisco, Disney, EA, the Japan Post, and your 7,000 fellow attendees can trust, so can you.

MVC architecture

Speaking at a ⁠deep dive⁠⁠ breakout session, senior product manager Andrew Waite talked about some of the history leading up to Visualforce. He said that Salesforce has already given administrators and other non-technical people the ability to customize the interface, adding basic field elements, controlling whether a given field required, and specifying its data type. ⁠That got us really far, but we realized we needed more. So we introduced technology Web integration links which let you embed hyperlinks on a page. The point of that was to link your Salesforce system with some external system that lets you augment the user interface, which in term might intercept the request and process it with a Web service.⁠

S-controls came later. Essentially mechanisms for defining and storing custom control, s-controls create and display custom data forms using components like custom links, Web tabs, and buttons. ⁠S-controls allow you to do some of that processing in the browser, itself.⁠⁠ But while s-controls have become a staple of customization?integrating with other tools like Salesforce’s Ajax toolkit?the code resides on the client machine in JavaScript instead of on the Salesforce servers. Performance, scalability, and maintainability, said Waite, are all adversely affected.

With Visualforce, Salesforce claims it has created the first on-demand implementation of a model-view-controller (MVC) architecture, a widely used way of separating the visual interface from data manipulation. In an MVC structure, the model represents the data, the view represents the presentation of that data, and the controller represents the business logic that manipulates the data. In Visualforce, the model is provided by custom objects?a staple of the development platform. But three components are new: pages and components, which provide the view, and controllers.

  • Pages specify the look of an application’s user interface, using basic HTML, as well as extended technologies, including CSS, JavaScript, AJAX and Adobe’s Flex. Data can be imported and positioned using merge fields, a standard Salesforce field typically used for importing contact records, custom links, and formula results. Pages are referenced with a page name, as they would be on a traditional application server. And of course, pages are rendered on the server, not on the client, as it they would, say, with JavaScript. An advantage of this approach is that multiple pages can be used to support multiple devices, accommodating specific screen sizes and keyboards.
  • Components are essentially reusable subsets of a page and are invoked from the page using component tags. Visualforce ships with 50 predefined standard Salesforce components that can be assembled in building block fashion with minimal coding. These components can then be populated using automatic data binding, with data from both custom and standard objects. Components can be further customized using style sheets, instead of being re-defined from scratch. Some components provide AJAX functionality like automatic page refreshes, without requiring additional JavaScript code. All components are accessed on a page using a tag library model. Salesforce anticipates that its customers will put additional components on the company’s AppExchange server.
  • Controllers represent the logic of an interface, as well as connecting the screen presentation with the underlying data. A given page interacts with a given controller through components, which bring data in and send it out for storage. Salesforce did the obvious and implemented controllers with Apex Code, providing a common language for the interface and the business logic. Code features include full database access, as well as Web services for calling other systems, accessing internal databases functions, and more. Controllers can maintain the state across page interactions, which is useful for constructing a wizard?in which logic is carried through multiple page steps. As with the pre-built components, Salesforce provides pre-built standard controllers for such standard chores as view, edit and save, again, without any additional coding required.

Salesforce now makes a distinction between standard and custom presentations and behaviors. A standard look and feel requires neither Apex Code nor Visualforce, and can already be done simply by using the application framework. This molecular component of the framework is a tab, which can be automatically created from any data object. But for developers who want different behaviors and presentations, Apex Code and, now, Visualforce, come into play?separately or together. The emphasis here is on incremental change. For example, you can create a custom look and feel coupled with standard behavior by leveraging one of the standard controllers. Or you can do both by using a page and custom controller. Pages can be used just to extend the look and feel of the default interface, altering, for example, the standard header and footer areas, as well as binding it to a specific tab. Or you can override elements of the user interface, for example, altering the screens linked with one tab, but not the others. At the other side of the spectrum, you can create pages and behaviors that don’t resemble anything in the Salesforce palette ? the aforementioned blog is an example ? or target a portable device.

Ron Hess: Developer Evangelist

At the Dreamforce Developer’s lounge, I asked Ron Hess,’s principal developer evangelist, to walk me through the advantages of Visualforce.

Where exactly does Visualforce fit into the platform?
With Visualforce we now have a presentation layer that completes our platform. We have code and logic running on our servers and now we have a user interface, delivered as a service from our servers.
How much control did developers have over the user interface before Visualforce?
Before Visualforce our users developed s-controls, which were also hosted on our service, and allowed you to run HTML, JavaScript, Flex, etc. code from our service. But you had to be an AJAX developer to take advantage of the database. And you had to code your user interface in HTML. The Visualforce announcement lets you take advantage of components that we’ve already built ? little pieces of the Salesforce interface like page blocks and input fields that allow you to build your page quickly and easily, without understanding or developing your own AJAX-type library. So you can have AJAX behaviors and interact with Salesforce elements without coding your own AJAX interface.
How far along is support for portable devices?
The Apple guys are here and you can see Visualforce running on an iPhone. The idea is straightforward: with just a few style sheets, you can take an ordinary page and makes it available for any device. The style sheets are just regular Web style sheets. Before, you had to go into our stylesheets and learn them. Now, using our components, you can leverage those styles and you don’t have to do anything extra. Or, you can discard all of those stylesheets and create your own stylesheets as we’ve done for the iPhone demo.
So when a new device comes out, who is responsible for creating the stylesheet?
Whoever is going to deliver the application. We’re not writing every application in the world. Our developers and our partners are. So the partner who want to command the lead for that device can go out and build that application, write those style sheets and deliver that app.
It took a long time previously if you wanted to add elements to an existing page. Is that right?
Yes. It was tedious and error-prone and could only be done by an expert who understood stylesheets and HTML.
What was the hurdle?
You could do that with an s-control. Today, now, with a single tag from our component library you can include that entire page block. And our server delivers a completely finished HTML page with the Salesforce style in it.
The implication seems to be the s-controls are becoming obsolete?
One of the design goals was to do s-controls better. The design goal was to do everything an s-control does and more, and do it on the server where possible. We want to deliver the data and the experience, and by combining the data with the page on the server, delivery is much quicker. The page is delivered as a whole ? there’s no going back to the server, fetching another bit of data and coming back.
You are encouraging developers to get going by including 50 pre-built components.
Yes, and that number will increase. Not only will we increase the number of components available, partners and customers will be able to build components in the future?not today?and then those will grow. I can imagine writing a library of components for the iPhone.
Is this the on-demand version of a building block solution?
We think so. It was very complex to build a beautiful application before. If all you had to work with was s-controls, when you look at what Visualforce offers, it’s really compelling. We think it is the finishing block on our platform as a service.