28

I’ve spent five years writing a JavaScript framework

 4 years ago
source link: https://www.tuicool.com/articles/iyUNjeM
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

I’ve spent 5 years writing a JavaScript framework on my own.

Jun 28 ·3min read

Typescene is a robust front end library written in TypeScript: strongly typed, no dependencies, no nonsense. It’s really great for desktop-like (or mobile) applications, not so great for blogs and other content. It isn’t backed by some major corporation, not even a startup, but it’s been built by me: one developer on a mission to build the most elegant framework ever— not scared of rework and refactoring because not much was at stake all this time except my own dog food work, until now .

Go check out https://typescene.dev and take it for a spin.

But why?

With so many great platforms and tools that are available for Web development today, it’s easier than ever to build rich Internet apps using one of the existing frameworks. But all of this progress in Web development comes at a cost. Have you ever opened a years-old project that used the favorite Web framework-du-jour, and tried to make sense of it now? Would you be able to maintain such a piece of software?

All of this progress comes at a cost. Have you ever opened a years-old project that used the favorite Web framework-du-jour, and tried to make sense of it now?

Sure enough, modern package managers solve some of the compatibility issues, but library APIs are constantly in flux. New ideas come in and ‘legacy’ ones disappear. Who will remember the (hypothetical) peculiarities of the willUpdate method in version 14.2.132 of framework X?

If constantly upgrading to the latest version is not an option, we’re setting ourselves up for trouble down the road.

Maintainability

This might not be an issue for one-offs and personal projects that you’re constantly working on, but maintainability is a major concern for any software that needs to be supported by a business or other organization in the long term.

Most code isn’t updated constantly (like Facebook or Dropbox), or written once and then forgotten, but rather something in between.

Here’s where the design goals of the Typescene framework come in.

Goals

Taken from the Introduction page on the Typescene website:

  • No revisions to the architecture, ever . Code shouldn’t have to be completely rewritten to be compatible with the next major version of Typescene. We all have better things to do.
  • No runtime dependencies on external libraries, at all . This makes it possible to re-build your app as long as you can compile TypeScript code (which is probably a very long time).
  • No-nonsense object-oriented (OO), event-driven approach. As developers, we tend to view UI elements as dynamic ‘widgets’, and OO fits this model perfectly. Event-driven UI programming has been the standard for decades and is very easy to follow for new developers, so there’s no need to reinvent the wheel here.
  • Strongly typed. Your future self (or colleague) will thank you if your text editor can help you figure out what your code means, highlight errors before compiling, and can even suggest ways to refactor your code. Auto-completion and automatic imports work out of the box in editors such as Visual Studio Code.
  • (Minimal) framework, not just a library. Typescene provides you with a complete runtime environment out of the box, for a consistent foundation that works for apps of any size — you’ll only need external modules to import complex UI components or application behaviors that aren’t included in the framework itself.

Most importantly, Typescene hasn’t been invented overnight, it’s not a Minimum Viable Product that introduces some clever new paradigm. It’s the result of years of practical experimentation, refactoring, and validation — built to last, and ready to support modern applications in the real world.

Learn more about the Typescene architecture , or check out the other docs .

Follow typescene on Twitter.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK