AI-Driven Program Generation ― Possibilities and Challenges

Created: 2025-08-18

In recent years, generative AI has advanced to the point where it can generate source code from natural language prompts. This has enabled partial automation of what was previously manual implementation, raising expectations for improved development efficiency.

However, when applying code generation in actual development environments, issues such as "accuracy," "deviation from specifications," and "maintenance cost" are expected to arise. This article focuses on areas such as UI programming and DSL design, organizing the challenges and potential of generative AI.

Issues with Natural Language Prompts

AI-based code generation often starts with specifying requirements through natural language prompts.

However, natural language has the following characteristics:

  • Ambiguity and polysemy

  • Omission and vague conditions

  • Difficulty in maintaining structured consistency

As a result, the generated code may have low fidelity to the intended specification.

When corrections are needed, developers must experiment with rephrasing the prompts and rerunning them, which reduces efficiency.

UI Programming and Code Generation

On the other hand, there are fields where code generation tends to succeed more easily, with UI programming being a prime example.

From the perspective of code generation, UI programming has the following characteristics:

  • Boilerplate code is abundant

  • Highly patterned structures, easy to abstract

  • Relatively clear separation between structure and presentation

In the past, tools called "GUI builders" emerged, enabling developers to visually compose screen layouts. Examples include the form designers of Visual Basic and Delphi, as well as the GUI builder of NetBeans.

However, these tools had practical limitations. For example, fully automating the connection between screen code and application logic proved difficult.

Now, by combining them with generative AI, new possibilities are emerging to reduce the gap between specifications and implementation that was previously difficult to overcome.

Three Key Factors for High-Precision Generation

The following are three factors that contribute to achieving high-precision UI code generation.

  1. UI Mockups

    • Serve as a clear and visual specification

    • Can be treated as a type of DSL

  2. Behavioral Patterns

    • Typical actions such as button clicks, list selections, and form submissions can be categorized into patterns

  3. Application Logic Specifications

    • Can be defined in a machine-readable way using IDLs (Interface Definition Languages) such as OpenAPI or gRPC

Traditionally, the integration between these elements required manual creation of boilerplate code, which was a bottleneck. However, generative AI now offers the possibility of automating this integration.

Improving Accuracy with a DSL Approach

Beyond UI programming, introducing a Domain-Specific Language (DSL) for each problem domain is an effective way to eliminate ambiguity in specifications and achieve high-precision code generation.

  • The process of designing a DSL enables modeling of the domain’s structures, concepts, and rules

  • By using a model compiler, executable code can be generated directly from specifications

  • AI can be leveraged to assist in DSL design and provide auto-completion of DSL descriptions

Developing a model compiler requires significant effort, but generative AI can substantially reduce the workload by generating code skeletons and transformation logic.

With both a DSL and a model compiler in place, code consistency is ensured at the specification level, preventing variations in generated results. In this case, the object of review shifts from the prompt to the DSL document itself. Needless to say, AI can play a major role in both authoring and reviewing DSL documents.

AI-Driven Development Styles
Figure 1. AI-Driven Development Styles

Practice in SimpleModeling

In SimpleModeling, SmartDox is adopted as the meta-language for DSLs. SmartDox is a text-based documentation format for technical writing that combines features of Markdown, org-mode, and Asciidoc. It is also used for writing the articles on this site.

When SmartDox is used as a meta-language for DSLs, its structured part is called ModelDox. ModelDox represents the model description core within a SmartDox document and serves as the foundation of the DSL.

By embedding structured elements into ordinary text and extracting them as a modeling DSL, SimpleModeling realizes literate modeling. CML (Cozy Modeling Language) is a DSL for object model descriptions, using ModelDox as its meta-language.

Cozy is a model compiler that generates source code such as Scala from CML, enabling literate model-driven development while keeping documentation and code synchronized.

Literate model-driven development with Cozy has the following advantages:

  • Allows natural language explanations and structured specifications to coexist

  • Structured parts are machine-readable, enabling precise processing by generative AI and compilers

  • Documents and code remain closely aligned, making it easier to adapt to specification changes

Literate Model-Driven Development with SmartDox/ModelDox
Figure 2. Literate Model-Driven Development with SmartDox/ModelDox

Conclusion

Generative AI demonstrates significant power in program generation when combined with well-structured specifications. In particular, in areas such as UI and DSLs, high-precision specifications like mockups or IDLs, together with model compilers, enable more accurate and maintainable code generation than before.

Generative AI is not all-powerful; it becomes practical and sustainable only when combined with structured DSLs.

An approach like SimpleModeling—which integrates natural language documentation with structured specifications and combines generative AI with model-driven development—will likely become a powerful option for future development styles.

References

Glossary

Prompt

A structured instruction or contextual representation that bridges retrieved knowledge (RAG) and the AI model’s reasoning process. It transforms the structured knowledge from the BoK into a narrative or directive form that the model can interpret, act upon, and internalize.

DSL (Domain Specific Language)

A DSL (Domain-Specific Language) is a language designed for a particular domain, enabling direct and concise expression of the domain’s concepts and structures. Compared to general-purpose programming languages (GPLs), DSLs offer a higher level of abstraction tailored for domain-specific problem solving and automation.

deviation

The state in which a computed or observed value differs from a baseline or true value. Represents a measurable quantitative discrepancy.

Feature

In UML, a Feature is a structural or behavioral characteristic of Instances of a Classifier. Features include Structural Features such as Attributes and Behavioral Features such as Operations.

Interface

Undefined

SimpleModeling

SimpleModeling is a modeling-centered software development methodology and technology system for constructing a Domain Model from Knowledge, formalizing it in CML, realizing it as executable software through Cozy and AI, and running it on Textus.

Model

A Model is an abstraction that represents a subject according to a particular Purpose and Concern so that it can be understood, reasoned about, evaluated, or constructed. It is not the subject itself; it preserves the elements, relationships, and meanings required for its purpose.

Embedding

An Embedding is a numerical-vector representation of text, terms, Model Elements, or related content that enables computation of semantic similarity. It is used for similarity search and candidate retrieval.

Literate Modeling

Undefined

CML (Cozy Modeling Language)

CML (Cozy Modeling Language) is the SimpleModeling formal modeling language for describing the Executable Model portion of an Object Model that connects to program generation and execution.

Cozy

Cozy is the SimpleModeling toolchain that analyzes Models expressed in CML and other DSLs and transforms them into realization artifacts such as programs, configuration, and documentation.

Scala

Undefined

Literate Model-Driven Development (LMDD)

Literate Model–Driven Development (LMDD) is a software development methodology that integrates natural-language narrative and formal model structure within a unified text-based framework. It extends conventional Model–Driven Development (MDD) by treating documentation and models as a single, consistent source of truth. In LMDD, the descriptive and structural elements of development artifacts are expressed together using the SmartDox language. From this unified representation, ModelDox extracts structural data, CML (Cozy Modeling Language) defines domain-specific models, and Cozy generates executable code, documentation, and configuration artifacts. Artificial intelligence participates in the LMDD process by analyzing the narrative context, validating structural consistency, and supporting the refinement of models and generated artifacts. All artifacts are represented in text form, ensuring traceability, version control, and interoperability within standard development environments. By defining a formally connected and machine-interpretable relationship between documentation, design, and implementation, LMDD provides a foundation for AI-assisted model–driven engineering where human authorship and automated reasoning operate on the same representational layer.