31

I have looked through the documentation and Trailhead, and I have started building some Lightning Applications.

I still do not understand what makes Lightning Applications better than standard VisualForce. What do Lightning Applications do better than VisualForce Pages? What types of problems are they worse at handling? So far in my experience, there does not appear to be much upside, but perhaps there is something I am missing. Thanks!

  • 1
    On my phone now so can't type out a full answer but mobile capability is a big advantage of lightning components. – Chris Duncombe Feb 26 '15 at 20:07
  • I am curious to the "how" of that advantage. Can't I also build mobile capable VF Pages? Thanks for the quick comment! – Adrian Larson Feb 26 '15 at 20:09
  • 1
    Lightning components still use Apex, and there's not really much of a difference between using something like bootstrap-sf1 with Lightning Components and using bootstrap-sf1 with VF. Probably the best reason for using Lightning is that it's the way things are headed. SF is focusing on it for the future of custom dev on the platform, so great new things will be coming to it. There's also some indication that it loads a lot faster than VF pages do within S1: mobileandemerging.technology/lightning-fast – Tom Gersic Feb 26 '15 at 21:44
  • 4
    Just a quibble...this question is not actually about Lightning App Builder, which is a drag-and-drop ui tool. This is really about Lightning Apps. For clarity, I'm chaning the title to remove "Builder". – pchittum Feb 27 '15 at 16:33
  • 1
    You are quite correct. All the Lightning features have me feeling like a total newbie again. – Adrian Larson Feb 27 '15 at 18:48
31

Lightning Components will give much greater reusability of features, separation of concern between components, and are much more opinionated about structure. These are fairly neutral things. Several very good answers have already been given about why to use Lightning Components and Apps.

It is useful to know when you will still use Visualforce.

I need to deliver a custom publisher action, custom button, UI inline to my page layout, or anything in the standard desktop browser UI

There are three ways to surface a Lightning component UI today.

  • A tab in the Salesforce1 Mobile app
  • A Lightning App Builder app that is surfaced as a tab in the Salesforce1 mobile app (which pretty much gives you the exact same thing today as you get in the first option, only it is in Pilot only)
  • A lightning app with its own requestable URL

If your custom UI doesn't fit well into one of these use cases, Visualforce is the way to get it done.

I need to deliver a dynamic email template

Visualforce has a lot of applications outside of just a custom page. One of those is dynamic email templates. This is a powerful feature that is not replicated in Lightning Components.

I need to dynamically generate a PDF

Pretty much the same as above.

The Only Constant is Change

This will all change and evolve over the ensuing months/years as Lightning Components evolves into a much more key part of our UI, but I'd say this is the best characterization of the reality today.

Don't get me wrong, I'm extremely excited about what Lightning Components has to offer, and some of its promise. I just thought it would be a useful to be specific in this answer to complement some of the other very good answers.

----EDIT----

I've updated this answer based on the current state of Lightning Components as of late July 2015.

  • Ah yes, this is what I was looking for. All good answers but you offer the best response to my final question: "What types of problems are they worse at handling?" Thanks! – Adrian Larson Feb 27 '15 at 18:06
  • I would add to this that you cannot create a Lightning Homepage Component. Score one more for VisualForce! – Adrian Larson Mar 4 '15 at 16:05
  • @Peter "Separation of Concerns" is a design pattern concept and term which supposes that the app clearly separates parts such as UI, controller/services, model/data, etc. Lightning Components do not separate the model/data from the rest : they are necessarily linked up to the Salesforce data model. They are precisely linked up with the Salesforce server data model : it is not possible to develop an offline mobile app with SmartSync from the SF Mobile SDK with Lightning Components. That is why I suggest Lightning Components do not adhere to the "Separation of Concerns" design pattern. – altius_rup Aug 30 '15 at 16:29
  • An app built with lightning components isn't really an app without access to Salesforce data, that's true. But a single component can be large or small. And there is opportunity for SOC in a single component, particularly in smaller discreet components. Perhaps your definition of SOC is a bit too narrow? But you're welcome to disagree. :-) – pchittum Sep 2 '15 at 16:44
13

The Lightning Component framework is a component-based framework.

  1. As building blocks of an app, components encapsulate HTML, JavaScript, and CSS, while interacting via events. Lightning components are client-side centric, making them more dynamic and mobile friendly.
  2. Contrastingly, Visualforce components are page-centric and rely heavily on server calls. Visualforce facilitates the delivery of template-driven web pages and email messages, making it suitable for developers who wish to maintain greater control over the life cycle of the request.

So, in a nutshell, you will use lightning for building apps that are compatible across multiple devices. It forces you to follow event-driven patterns and the component-based approach so that, in the future, it will allow the consumer of a component to focus on building their app, while the component author can innovate and make changes without breaking consumers.

12

You could also see Lightning Apps as the future and Visualforce as the past. We are now in the present and have live both for a while.

The concepts and designs of Visualforce has come into age. It's not out of the box Responsible, the component model wasn't wide spread, it comes with a ViewState, it's not SPA by design, it's jailed into security silos and separate domains, etc.

Lightning is trying to improve most aspects we are asking over years to get them for Visualforce. Also developmet will be faster.

I would seriously doubt that in 5 years you might consider Visualforce for new projects. However for existing project we might have legacy vf-pages probably for a very long time.

Right now there is just not everthing ready.

The big thing I am waiting for is "Lightning for the desktop" or however they might call it. My focus are designs for huge screens (like multiple 4k displays). Also this should be addressed by future versions of Lightning. Also direct API access via Javascript is necessary. And offline access would be cool.

They are planning to replace the current standard theme (Aloha) by something new and Lightning centric.

So from my perspective it's very obvious where salesforce is moving to.

  • 1
    I think the 'lighting for desktop' will be the tipping point. Mobile-friendly feels a lot more critical to me for consumer facing apps. For now, I feel like our customers still do the majority of their enterprise work sitting at a computer. Once they embrace that I'll believe this isn't another hyped product that will fizzle out. – Phil B Feb 27 '15 at 16:42
  • @PhilB - I can't understand your last sentence: do you mean, there is no future for the desktop? At all? Or something else? – Uwe Heim Feb 27 '15 at 17:30
  • no I'm saying until they embrace that a lot of users still are on desktop I feel like saying lightning components are the future of SF development is jumping the gun. – Phil B Feb 27 '15 at 19:52
  • In my experience there are lots of processes which simply don't make any sense on today's mobile (touch) devices. These are the complex things mostly found in back offices. This stuff is crucial, often the backbone of the business. And it must move more into the focus of Lightning - and I think it will. – Uwe Heim Feb 27 '15 at 20:11
  • yep thats the point I'm trying to make as well! – Phil B Feb 27 '15 at 21:50
7

I think, that main reason for building apps in Salesforce1 Lightning is multi-device support. So it's easy to build responsive apps for any device. And also, Salesforce will prioritize the Lightning in the future... (as Tom Gersic wrote)

// I'm sorry, that I can't simply comment, but I don't have sufficient reputation.

  • 3
    It is very important to understand that Lightning is NOT necessarily focused on mobile and the s1 mobile app. It is a more general concept for any device. – Uwe Heim Feb 27 '15 at 20:14
  • 1
    Agreed. Not to pile on, but we are already doing multi device support with visualforce pages, for instance if you look at some of the salesforce wear projects put out last year those were for smart watches. – pchittum Feb 27 '15 at 20:48
0

In the spirit of declarative configuration, point-and-click Admins and Developers can drag Lightning components onto Lightning app pages without writing code.

This provides ISV partners with a new packaging and distribution model on the AppExchange and Admins with a composite application framework (many different AppExchange vendor components on a single page).

IT-focused Developers may choose either Visualforce or Lightning; the benefits of Lightning probably only recognized in orgs where there is high reuse of components.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.