DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Context Is King: How LLMs Are Going to Change Code Generation in Modern IDEs
  • Writing an Interpreter: Implementation

Trending

  • Docker Base Images Demystified: A Practical Guide
  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice
  • Unlocking the Benefits of a Private API in AWS API Gateway
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis

Projectional Editing: The Future of Programming

Learn about the Projectional Editor technology for programming, how it's being used to create domain-specific languages, and more.

By 
Vaclav Pech user avatar
Vaclav Pech
·
Oscar Rodriguez user avatar
Oscar Rodriguez
·
Sep. 16, 17 · Analysis
Likes (6)
Comment
Save
Tweet
Share
14.1K Views

Join the DZone community and get the full member experience.

Join For Free

We have been taught for many years how programming should be done. Have you ever stopped for a second and questioned whether perhaps there is a better way?

In the beginning, programming was done in absolute binary. For years this was the only way to do it. It was only later that the Symbolic Optimal Assembly Program (SOAP) was introduced. For old developers, using assembly was “sissy stuff” and a real programmer would not waste machine capacity on doing the assembly.[1]

Developers had an easier way to code right in the front of their eyes, but a lot of them still refused to see it.

It was a similar story in 1957 when John Backus and his team created Fortran. The community was again skeptical that this new method could outperform assembly. Old generations stuck to their old ways.

Looking back now, it seems like the decision to change technology should have been clear, but at the time it was not. Nowadays, more and more developers are receptive to new technologies, but it is hard to change the fundamental principles with which programmers were taught.

Now, we again have a unique technology before us called Projectional Editing. Projectional Editing is not a new technology; back in 2008, Martin Fowler was already talking about it. JetBrains MPS is already using this technology for its language workbench to create domain-specific languages.

A projectional editor allows the user to efficiently edit the abstract syntax tree (AST) representation of the code. It can mimic the behavior of a text editor for textual notations, a diagram editor for graphical languages, a tabular editor for editing tables, and so on. The user interacts with the code through intuitive on-screen visuals.

In parser-based approaches, users use text editors to enter character sequences that represent programs. A parser then checks the program for syntactic correctness and constructs an abstract syntax tree (AST) from the character sequence. The AST contains all the semantic information expressed by the program, i.e. keywords, and the purely syntactic aspects are then committed.

In projectional editors, the process happens the other way around: as a user edits the program, the AST is modified directly. This is similar to the Model-view-controller (MVC) pattern where every editing action triggers a change in the AST.

When editing a UML diagram, for example, users don't draw pixels onto a canvas for an "image parser" to read the drawing, parse it, and then create the AST. That would be way too limiting to what you can draw so that the engine would understand. Rather, the editor creates an instance of a Class as you drag a class from the palette to the canvas. A projection engine then renders the diagram, in this case drawing a rectangle for the class. You can then re-arrange visual elements on the screen without changing the meaning of your diagram.

This approach can be generalized to also work with text editors. Every program element is stored as a node with a unique ID (UID) in the AST. References are based on actual pointers (references to UIDs). The AST is actually an ASG, (an abstract syntax graph), from the start, because cross-references are first-class rather than being resolved after parsing. The program is then persisted to disk as XML, but this process is transparent to the user.

Avoiding the parser provides users with two more benefits:

  1. Detaching the notation from the persistence format of the code enables multiple notations to be defined for a single language. The users can then interact with the code through one notation, and use another notation to debug, review code, or resolve merge conflicts.

  2. Languages can be modularized, and users can then combine languages that they want to use in their programs. The projectional editor easily resolves any ambiguities in language definitions.

As part of the new IT industry generation, we have to question the status quo and dogmas established by the old generations. We should not settle for less, we need to be our own critics on everything from UI element to fundamental statements of programming. Projectional Editing is here and we can either choose to ignore it or seize it for all its worth.

If you are still curious about Projectional Editing you can join the JetBrains MPS webinar which will take place September 19, 4:00 PM - 5:00 PM CEST. Register here.

Abstract syntax

Opinions expressed by DZone contributors are their own.

Related

  • Context Is King: How LLMs Are Going to Change Code Generation in Modern IDEs
  • Writing an Interpreter: Implementation

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!