Make Your Apps Scalable and Web-Enabled

by Sep 12, 2018

This blog post accompanies the webinar Make Your Apps Scalable and Web-Enabled – Leverage your Business Logic with a Fast Flexible Multi-Tier Architecture – Using RAD Server and REST Services.

Create high performance, scalable applications by adopting a multi-tier architecture. By separating the UI/presentation layer, the server and the data layer, your apps will scale more easily with changing business needs and accommodate larger numbers of users. Multi-tier architecture also allows dev team members to focus on their strengths and add new services through a loosely coupled architecture which keeps the impact of changes small. This webinar demonstrates how easy it is to create a services-based app using REST/JSON, database integration, and RAD Server. We will look at the use case of the RAD Server Field Services Application Template and also provide examples of web-enabling your application with an Ext JS front-end.

SlidesYouTube Replay

https://youtu.be/q2nNMEwVyNc

Agenda

  1. The Monolithic Problem
  2. Architecture Types
  3. Why Does Scalability Matter?
  4. Microservices vs. Monolithic Services
  5. Making Your Business Logic Scalable
  6. Field Services RAD Server Template
  7. Using Ext JS for Web-Enablement
  8. Different Editions of RAD Studio

The Monolithic Problem

We all start with the monolith. This is the app that is easy to develop, just drop our data access controls on the form, mixing the business logic with the data access and the user interface. The monolith gets us to market quickly, but over time is harder to maintain.

  1. Does Everything in one tightly coupled module:
        UI, Logic, Data, etc.
  2. Quick when Apps are Small
  3. Doesn't Scale Well. Can't easily adjust as features, new users, and new platforms are added
  4. Doesn’t scale and typically only available via one platform (usually desktop), and not web enabled
  5. Difficult to Maintain as App Grows

Software Architectural Coupling

When our software modules are coupled they are hard to maintain. Wikipedia has an article on coupling, and Nick Hodges covers it in his books.

  1. Coupling is the degree of interdependence between software modules
  2. Disadvantages of tightly coupled systems:
    1. A change in one module forces a ripple effect of changes in other modules
    2. Adding and removing modules requires more effort due to increased dependencies
    3. Module are harder to reuse and test because inter-dependence
  3. Loose coupling is characterized by well defined & limited interactions

Why Scalability Matters?

As the app does more and gets more workload, the need to scale goes up. Horizontal scaling allows the software to handle more workload without the cost per unit of work going up.

  1. More important with growth
  2. Support more users & workload 
  3. Reduce cost per users & work unit
  4. Allows for horizontal scale

Microservices vs. Monolithic Services

Going straight for Microservices usually isn't a good plan.

  1. Martin Fowler suggests Monolith First
  2. Microservices require additional overhead
  3. Introduce Microservices to solve complexity issues
  4. Optimizing early may fix wrong problems (YAGNI You Aren’t Gonna Need It)
  5. Shortens time to market, allows for scale over time

Migrating your Business Logic with RAD Server

RAD Server makes it easy to make your monolithic app scalable.

  1. RAD Server’s EMS Packages are built with either Data Modules or Units.
  2. Refactor your code into loosely coupled Data Modules
  3. Move Data Modules to RAD Server
  4. Use remote calls to access endpoints
  5. Be aware of latency issues
  6. See Nick Hodges’ RAD Server Story

Remote Data Call Latency Tips

  1. When moving from LAN to WAN the response time of each request increases
  2. Bundle multiple requests into one request
  3. Utilize local cache instead of repeating the same call
  4. Parallel requests can be faster than a series of requests
  5. Proper architecture can prevent latency issues

Field Services RAD Server Template

There are a few different Industry Templates available in GetIt. They are a great resource to learn more about RAD Server and scalable app development.

  1. Available via GetIt Package Manager in the IDE
  2. Includes full source and graphic resources
  3. Written in Delphi (the technology all works with C++Builder too)
  4. Includes Field Service App, Admin, Server (uses RAD Server), & Setup
  5. Designed for mobile and desktop use
  6. Includes detailed documentation and video instructions
  7. Great resource to learn about REST services & RAD Server
  8. Use this template as a base to build your own solutions

Why Web Enable?

You are a big fan of native app development. What does the web give you? Adding a web interface is one way to take advantage of your new scalable architecture. 

  1. Minimal friction for new users to connect
  2. Compatible across more devices and platforms
  3. Trade-off some performance and features from native apps
  4. No installation required – access from shared computers
  5. On-ramp to move users to native experience

Sencha Ext JS

The go to choice for web front ends is Sencha's Ext JS.

  1. Ext JS helps you build data-intensive web apps
  2. Uses JavaScript, HTML, & CSS
  3. Includes 115+ UI components including calendar, grids, charts, pivot grid, and more
  4. Two flavors:
    • Classic: Focused on Desktop and greater compatibility
    • Modern: Focused on modern standards & Mobile (FKA Sencha Touch)
    • Also Universal Applications for both Desktop and Mobile (using both Modern and Classic)
  5. More information
  6. Take a look at Kitto2 and UNIGui as additional resources to integrate Ext JS
  7. Web Development with ExtJS for Delphi Developers

RAD Server + Ext JS

  • Tokyo 10.2.2 included a new FireDAC TFDBatchMoveJSONWriter component to generate JSON for a Sencha Ext JS client. 
  • Tokyo 10.2.3 expanded RAD Server to host static HTML, JS, CSS files (and any other files)

ColumbusEgg4Delphi

Useful framework in refactoring your Monolithic App to multi-tier to make it more scalable.

  1. A simple to use Delphi framework to correctly write business logic in Delphi "RAD style" applications
  2. Provides a single point for the Business Logic code
  3. Forms and data modules are free of Business Logic code
  4. You can do unit tests; Business Logic can be unit tested using in-memory datasets.
  5. You can still use the RAD approach to design you forms
  6. If your data comes from an application server, you can fill in-memory datasets (or virtual dataset) and still use the same Business Logic.
  7. Free and Open Source

RAD Server Resources

  1. RAD Servier Video Playlist: https://embt.co/RADServerVideos
    • Migrating to RAD Server Webinar Replay
    • Deep Dive – Creating a Department Store Retail Solution
    • RAD Server Multi-Tenancy
    • Building a Microservices Architecture with RAD Server
  2. Build Flexible and Robust Apps with a Multi-Tier Architecture
  3. RAD Server & EMS DocWiki
  4. Case Study Foresiight & Migrating to RAD Server https://embt.co/ForesiightRADServer (YouTube)

RAD Server Field Services Template

  1. Available from GetIt Package Manager in the IDE
  2. Includes detailed documentation
  3. Overview post: https://embt.co/FieldServicesOverview
  4. Deep Dive Article: https://embt.co/FieldServicesDeepDive
  5. YouTube Videos: https://embt.co/FieldServicesVideos
    • Setup & Configuration
    • Development Server
    • Admin Application
    • Client Application
    • UI Tips and Tricks