Why Chengwu Low-Code Platform Chose Pebble Over FreeMarker
The Chengwu low-code platform chose Pebble over FreeMarker after a detailed comparison of usability, extensibility, security, and performance, emphasizing Pebble's modern collection handling, unified syntax, rich filters, native Map support, default security, and easier extensibility for non-developer users.
1. Modern Collection and Data Structure Handling
Pebble provides intuitive iteration and manipulation of List and Map, with near-zero learning curve, aligning with modern frontend developers and business users.
Pebble List Iteration
{% for item in items %}
<li>{{ item.name }}</li>
{% endfor %}FreeMarker List Iteration
<#list items as item>
<li>${item.name}</li>
</#list>Pebble's for loop supports Python-style built-in variables: loop.first / loop.last to check first/last element. loop.index (0-based) and loop.index1 (1-based) directly available.
Direct filter, map, slice operations on List within templates.
Example: Checking First Element
{% for item in items %}
{% if loop.first %}<b>First:</b>{% endif %}
{{ item.name }}
{% endfor %}FreeMarker requires manual counter variables and nested conditionals for the same result.
2. Unified Syntax for Frontend-Backend Collaboration
Pebble's syntax closely resembles Jinja2, Twig, and Vue templates, lowering the learning barrier for frontend developers, product managers, and operations staff.
Conditionals, loops, and variable rendering share syntax with common frontend template engines.
Supports object property and method chaining (subject to sandbox configuration).
Example: Chained Access with Default
{{ user.profile?.email | default("Not set") }}FreeMarker requires explicit null checks, resulting in more verbose syntax.
3. Rich Collection Functions and Filters for Strong Business Expressiveness
Pebble offers a comprehensive set of collection filters and functions: length to get list size:
{{ items | length }} filterto filter lists:
{{ items | filter(item => item.active) }} sort, reverse, unique and other common operations.
Example: Display Only Active Users
{% for user in users | filter(u => u.active) %}
{{ user.name }}
{% endfor %}FreeMarker's collection processing follows traditional Java style, requiring nested <#list> and <#if> without direct filter support.
4. Native and Concise Map and Multi-Dimensional Data Structure Support
Pebble allows direct iteration over Map key-value pairs:
{% for key, value in map %}
{{ key }} : {{ value }}
{% endfor %}FreeMarker Map iteration is more cumbersome, typically requiring entrySet or custom approaches.
5. Secure by Default, Eliminating Template Injection Risks
Pebble disables reflection and static method calls by default, making it "secure out of the box" — critical for low-code platforms where business users author templates. FreeMarker can be sandboxed but its legacy configuration is complex and error-prone.
6. High Extensibility with Simple Custom Filter and Function Development
Pebble's plugin mechanism is clear: extending filters and functions only requires implementing an interface and registering it, fitting naturally into modern frameworks like Spring Boot. FreeMarker's extension interfaces are older and demand more adaptation work for Spring integration.
7. Superior Performance and Cross-Language Compatibility
Benchmark tests show Pebble's template parsing and rendering outperforms FreeMarker, with lower memory usage under high-concurrency SaaS loads. Its syntax compatibility with Jinja2 and Twig also facilitates future cross-platform expansion and migration.
Summary
The Chengwu low-code platform selected Pebble based on:
Pursuit of usability and maintainability for business scenarios.
Baseline security requirements.
Need for a unified frontend-backend technology stack that is easy to extend.
Native, rich support for List, Map, and other collection data structures.
Pebble makes template development as natural, concise, and efficient as writing frontend templates, enabling non-developers to participate in low-code application building and maximizing the platform's vitality.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
