vibe-coding-cn/documents/gluecoding.md

163 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Glue Coding (glue coding) Methodology
## **1. Definition of Glue Coding**
**Glue coding** is a new way of building software whose core idea is:
> **Almost entirely reuse mature open-source components, and combine them into a complete system with a minimal amount of “glue code.”**
It emphasizes “connecting” rather than “creating,” and is especially efficient in the AI era.
## **2. Background**
Traditional software engineering often requires developers to:
* Design the architecture
* Write the logic themselves
* Manually handle various details
* Repeatedly reinvent the wheel
This leads to high development costs, long cycles, and low success rates.
The current ecosystem has fundamentally changed:
* There are thousands of mature open-source libraries on GitHub
* Frameworks cover various scenarios (Web, AI, distributed systems, model inference…)
* GPT / Grok can help search, analyze, and combine these projects
In this environment, writing code from scratch is no longer the most efficient way.
Thus, “glue coding” becomes a new paradigm.
## **3. Core Principles of Glue Coding**
### **3.1 Dont write what you dont have to, and write as little as possible when you must**
Any functionality with a mature existing implementation should not be reinvented.
### **3.2 Copy-and-use whenever possible**
Directly copying and using community-verified code is part of normal engineering practices, not laziness.
### **3.3 Stand on the shoulders of giants, dont try to become a giant**
Leverage existing frameworks instead of trying to write another “better wheel” yourself.
### **3.4 Do not modify upstream repository code**
All open-source libraries should be kept immutable as much as possible and used as black boxes.
### **3.5 The less custom code the better**
The code you write should only be responsible for:
* Composition
* Invocation
* Encapsulation
* Adaptation
This is the so-called **glue layer**.
## **4. Standard Process of Glue Coding**
### **4.1 Clarify requirements**
Break the system features to be implemented into individual requirement points.
### **4.2 Use GPT/Grok to decompose requirements**
Have AI refine requirements into reusable modules, capability points, and corresponding subtasks.
### **4.3 Search for existing open-source implementations**
Use GPTs online capabilities (e.g., Grok):
* Search GitHub repositories corresponding to each sub-requirement
* Check whether reusable components exist
* Compare quality, implementation approach, licenses, etc.
### **4.4 Download and organize repositories**
Pull the selected repositories locally and organize them.
### **4.5 Organize according to the architecture**
Place these repositories into the project structure, for example:
```
/services
/libs
/third_party
/glue
```
And emphasize: **Open-source repositories are third-party dependencies and must not be modified.**
### **4.6 Write the glue layer code**
The roles of the glue code include:
* Encapsulating interfaces
* Unifying inputs and outputs
* Connecting different components
* Implementing minimal business logic
The final system is assembled from multiple mature modules.
## **5. Value of Glue Coding**
### **5.1 Extremely high success rate**
Because community-validated mature code is used.
### **5.2 Very fast development**
A large amount of functionality can be reused directly.
### **5.3 Reduced costs**
Time, maintenance, and learning costs are greatly reduced.
### **5.4 More stable systems**
Depend on mature frameworks rather than individual implementations.
### **5.5 Easy to extend**
Capabilities can be upgraded easily by replacing components.
### **5.6 Highly compatible with AI**
GPT can assist with searching, decomposing, and integrating — a natural enhancer for glue engineering.
## **6. Glue Coding vs Traditional Development**
| Item | Traditional Development | Glue Coding |
| ---------------------------- | ----------------------- | --------------------- |
| How features are implemented | Write yourself | Reuse open source |
| Workload | Large | Much smaller |
| Success rate | Uncertain | High |
| Speed | Slow | Extremely fast |
| Error rate | Prone to pitfalls | Uses mature solutions |
| Focus | “Invent wheels” | “Combine wheels” |
## **7. Typical Application Scenarios for Glue Coding**
* Rapid prototyping
* Small teams building large systems
* AI applications / model inference platforms
* Data processing pipelines
* Internal tool development
* System integration
## **8. Future: Glue Engineering Will Become the New Mainstream Programming Approach**
As AI capabilities continue to strengthen, future developers will no longer need to write large amounts of code themselves, but will instead:
* Find wheels
* Combine wheels
* Intelligently connect components
* Build complex systems at very low cost
Glue coding will become the new standard of software productivity.