林子豪的 PKM
← 返回 Blog

Library, Framework, Tool/SDK and What Matters in the AI Era

Exploring the essential difference between libraries, frameworks, and tools/SDKs—and why frameworks matter less in the AI era.

1 min read
programmingaiarchitecture

A Simple Taxonomy

When I say library, I mean it as an umbrella term covering the other three:

- Library (in the broad sense)

- Framework

- Tool / SDK

The key distinction: who controls the program flow.

Framework vs Tool/SDK

Framework: You provide callbacks, the framework decides when to invoke them. Control flow lives in the framework; you're just hanging code on hooks.

// Framework style - framework controls the flow
app.use(middleware)  // you register callbacks
app.get('/path', handler)  // framework decides when to call handler

Tool/SDK: You decide when to call functions and methods. Control flow is entirely yours.

// Tool/SDK style - you control the flow
const result = json.parse(input)  // you decide when to call
const encoded = base64.encode(data)  // you decide when to call

Why We Used Libraries Before

There were usually two reasons to use a third-party library:

1. Well-defined functions: Common functionality isn't worth reinventing—JSON parsing, HTTP clients, etc.

2. Don't know how: Some things you can't implement, or the cost is too high.

For some people, a third reason existed: don't know how to organize code, so they outsourced it to a framework.

The price: you had to learn the framework's abstractions.

The Problem with Frameworks

Some frameworks have good abstractions worth learning. But not all:

- Leaky abstractions: The abstraction leaks; eventually you have to go back to the lower level

- Incidental complexity: Version changes bring extra complexity you didn't ask for

- Migration lock-in: Once you're hooked, switching is expensive

AI Changes Everything

With AI, writing glue code is easy.

What used to be outsourced to frameworks—code organization—can now be done with AI help. You can:

1. Learn the abstractions a framework provides

2. Have AI write your own implementation following that abstraction

3. If you hit a leaky abstraction, you don't wait for upstream to fix it (or never fix it)

4. Your code, your rules—evolves to fit your use case

The main value of frameworks—helping you organize code—is no longer as compelling in the AI era.

Not All Re-inventing Is Equal

Some wheels are worth reinventing, some aren't:

Worth building yourself (for max control):

- Framework-level stuff

- Business logic

- Core flows

Not worth writing:

- Codecs (JSON, MessagePack, Protocol Buffers...)

- Protocol parsing (HTTP, WebSocket, TLS...)

- Crypto (AES, RSA, signatures...)

Writing your own codec won't beat a well-maintained library, and you'll likely introduce bugs. But framework-level stuff? That's worth owning, because it determines the shape and direction of your code.

What We Should Expect from Libraries Going Forward

Since frameworks matter less, libraries need to step up:

- Good interfaces: Don't force users into a specific way; provide functionality in a general way

- Less abstraction leakage: Let users bypass the abstraction when they need to

- Composability: Small, focused libraries are easier to own than big, all-in-one frameworks

In the AI era, truly valuable libraries are those that provide capability without taking you hostage.