LC7 vs LC8 – The Browser Challenge. Sample Stack Included!

by Neil Roger on February 29, 2016 14 comments


 

The Goal

To show the increase in speed when developing an application in LiveCode 8 compared to Livecode 7.

Whilst developing a new sample stack to show off the new browser widget in LiveCode 8 along with the other widgets included in the core product we decided to build the same application in LiveCode 7 and record the results.

The Process

Firstly we had decided to create a mini web browser application as part of our commitment to create additional sample stacks during the LiveCode 8 cycle. We kicked off with the header bar and the navigation bar. In the LiveCode 7 application we dragged on some rectangle and button objects, headed off to find some icons, imported those icons into photoshop to design both the on and off state, we imported them into LiveCode and hand coded each header and navigation action which took a total of 40 minutes. In LiveCode 8 we dragged on the navigation and header widget and selected our customizations from the built in options and this took us just over 4 minutes.

We moved onto creating the browser card which will allow you to search for and display a web page inside the application. In LiveCode 7 we hand scripted this which totaled 25 minutes of coding, in LiveCode 8 we dragged on the browser widget and with a little bit of scripting we were done in 5 minutes.

As with most browsers you have the ability to save the web pages you find useful to your favourites. We moved onto creating the manage favourites page and this was like for like, 5 minutes in both 7 and 8.

The Stats

LiveCode 7

Header & Nav Bar – 40 mins
Browser Card – 25 mins
Manage Favourites – 5 mins

Total inc above – 1:09.40

LiveCode 8

Header & Nav Bar – 4 mins 30 seconds
Browser Card – 5 mins
Manage Favourites – 5 mins

Total inc above – 0:14.37

LiveCode 8 was 5x faster than LiveCode 7 to create this application, using the widgets available.

We wrote 133 lines of code in LiveCode 7 compared to the 32 lines of code written in LiveCode 8.

Overall this has been a very impressive exercise in highlighting the increase in productivity that LiveCode 8 is already bringing to the app development table. LiveCode 8 is a new beginning and if you haven’t tried it yet we hope the below sample stack is the invitation you have been waiting on…

Have you used the latest version of LiveCode 8 yet?

You can download the latest version here

You can download the LiveCode 8 sample stack used for this video here

Neil RogerLC7 vs LC8 – The Browser Challenge. Sample Stack Included!

Related Posts

Take a look at these posts

14 comments

Join the conversation
  • Peter - February 29, 2016 reply

    Wtf? Why would we program a browser ?! Whats wrong with the standard browser? The browser look inefficient. Too much white space, browser window is too small.

    Steven Crighton - February 29, 2016 reply

    Hi Peter. Lots of mobile apps use an embedded browser for all kinds of reasons. The purpose here was not to build a new web browser but to demonstrate how easy it is to use an embedded browser. Thanks to the new browser widget, that is now very easy.

  • David Bird - February 29, 2016 reply

    You can see that this demonstration is for programmers and not metaphysicists. You cannot save time, it just does not work like that.

    Dave Kilroy - March 1, 2016 reply

    @David Bird – I like your comment on this article the best 🙂

  • matthew - February 29, 2016 reply

    that’s all well and good, but worthless to me if I can’t develop a responsive web application with LiveCode.

  • Matt Maier - February 29, 2016 reply

    I don’t want to run down Livecode 8 or the widgets, just this comparison. In my project I just grabbed easyJSON and it saved me all the time associated with writing and debugging a JSON parser. That doesn’t mean Livecode was faster, it just means someone already wrote the code I needed. I don’t think anybody needs an example to support the assertion that reusing code is faster than writing code from scratch. A better comparison would be the time spent implementing those features in LCS vs. LCB. How many lines of code are in the widgets? Does LC8 provide a speed boost when the thing you need still hasn’t been written yet? Or, alternatively, how quickly can a widget be edited to alter or include a feature you need?

    For example, let’s say someone wrote a nice line graph widget. So I can just drag it in, point it at some data, and it renders a sweet graph. Maybe I can even control all of the visual aspects of how it renders. But I need it to be interactive. I want to hover the mouse over a spot on the graph and have it draw horizontal and vertical lines with labels showing me the actual numbers at that coordinate. How long would it take me to edit the widget vs. how long would it take me to write that from scratch in script? Code reuse is awesome, but I’m picturing those 40 minutes of time savings being eaten up by a tedious search through all of the widgets with “nav bar” in their name trying to find one that already does what I want, and THEN starting the process of coding my feature from scratch anyway. A more direct comparison would be nice.

    Mark Waddingham - March 2, 2016 reply

    Hi Matt. The comparison is intended to show how much easier it is using a browser widget in LC8 compared to what you need to do prior to LC8 to embed a browser in your app. Whilst it might only be ’40 mins’ in LC7 to write that code to do the same thing (assuming you know precisely what code to write!), that is then 40 mins worth of code in your app which you have to maintain and keep functioning.

    The browser widget means you can literally just drag-and-drop an embedded browser onto any stack and any card you need and it will work cross-platform out of the box. Whilst that might be only 40 mins saved for a particular instance of an embedded browser, it soon adds up when you consider all the other components apps tend to contain. (Also, revBrowser is definitely not the easiest part of LiveCode to use – particularly as you currently have to use divergent code for Desktop and Mobile).
    Of course, for a widget-based development model to be successful there needs to be a wide range of widgets which people can use – we are very much at the start of this journey with LiveCode 8, but it is a start.

    In terms of developing widgets then that is certainly a great deal easier than writing similar components in C++ (which the current existing LiveCode controls are), but perhaps a little more complex than writing LiveCode Script. This is a direct result of LiveCode Builder needing some of the ‘lower-level’ features present in other languages in order to be able to build high-quality, reusable and easy to use components that can be trivially used at the script level.

    One of the hardest things in programming is finding the right dividing lines between components in an application (there’s that old quote – programming isn’t just about finding abstractions, it is about finding the right abstractions) and the black-box model offered by widgets is designed to help with that. Generally speaking, it is easier to modify existing solutions than it is to build from scratch; and if the modifications you need to make are completely contained in an encapsulated element then finding and fixing any problems in a whole system becomes a great deal easier.

    At the end of the day, I don’t expect that it would be very hard for anybody who takes the time to learn LiveCode Builder (and has an interest in doing so) to tweak widgets they have the source (and rights) to modify for their own ends. In the case you give, for example, then you could either amend the widget to give you the nearest location on the current graph at a given position and then display an overlay using LiveCode Script, or put the display of the overlay into the widget – either would be perfectly suitable. However as your request sounds like quite a reasonable and useful one, it would be more than likely you would be able to find a component which did do precisely what you needed as the widget ecosystem grows.

    The point of widgets is not in any way to replace LiveCode Script, but instead to give LiveCode Script a hugely powerful arsenal of reusable components which can be used to build better apps faster. The goal is that by raising the level at which engine-like controls can be written (i.e. in a language not too dissimilar from LiveCode Script rather than C++) the range of options open to any LiveCode developer will expand substantially.

    You can take a look at what the code for widgets looks like by dipping into our GitHub repo:

    https://github.com/livecode/livecode/tree/develop/extensions/widgets

    There are more here than we will ship as supported widgets in LiveCode 8 (we are currently going through all of them and assessing what needs to be done to make them release-worthy) but all server as useful examples of how widgets are written.

  • Joe C - March 23, 2016 reply

    Rather than debate time savings, I am more interested in how this widget would allow you to, say display a dialog when the user clicks a web link asking if they 1)want to open the page inside the app browser or 2)use the device built-in browser to open the new page?

    Now that, would be both useful and a time saver. 🙂

    Neil Roger - March 30, 2016 reply

    Hi Joe, You should be able to use something like the following for this task-

    on mouseUp
    answer “Where do you wish to view this URL?” with “Within LC” and “External Browser”
    if it is “Within LC” then
    set the url of widget “browser” to field “url”
    else
    launch url field “url”
    end if
    end mouseUp

    Joe C - April 1, 2016 reply

    the problem is, the stack you provided DOES NOT WORK. I loaded it (windows 8.1 laptop running LC 8 dp 16) and got errors:

    executing at 11:14:03 AM
    LCB Error unknown module ‘com.livecode.widget.pushbutton’
    Object Header
    LCB File header.lcb
    LCB Line 457

    executing at 11:14:03 AM
    LCB Error unknown module ‘com.livecode.widget.pushbutton’
    Object Browser
    LCB File browser.lcb
    LCB Line 405

    ???

    and if I start with a blank stack, add the browser, set the url to my home site, and test – all you see is a very small square.

    Joe C.

    Neil Roger - April 5, 2016 reply

    Hi Joe,

    Some widget changes were made in LC8 DP16.More specifically the Push button widget was removed as it was deemed as unnecessary at the moment.

    Also the browser size issue you are experiencing is a bug which will be resolved in the next release of LC8. More information on this can be found here-

    http://quality.livecode.com/show_bug.cgi?id=17138

    I will get an up-to-date sample stack uploaded tomorrow.

    Kind Regards,

    Neil

    Neil Roger - April 8, 2016

    stack updated 🙂

  • bb hank - March 26, 2016 reply

    How about being able to apply a row template directly to a datagrid form, from a dropdown menu, without initially writing any code? Select from menu and the template applies itself!

    Neil Roger - April 5, 2016 reply

    Hi bb hank,

    Something like that should be possible but you would have to write some code 🙂

    It’s however a great suggestion so please submit an enhancement request with our Quality Control team as they will be able to look into it further-

    http://quality.livecode.com

    Kind Regards,

    Neil Roger

    LiveCode Support Team ~ http://www.livecode.com

Join the conversation

*