[TSTL] Migration from C++ STL to TypeScript (open source failure stories)
Tags: javascript, typescript, opensource, programming
Published: 2023-01-23 17:32:48

## Series of Open Source Failure Stories
> 1. **TSTL**
> 2. TGrid
> 3. Cagen
> 4. Safe-TypeORM

### Outline
In previous 2022, I had introduced my open source library [typia](https://github.com/samchon/typia) here at `dev.to`, and thanks to your explosive responses, I was selected as "2022 top author" and received a gift. Also, I could get received a large number of stars from you.

In today, I'd like to introduce my other open source projects, that has been failed over 10 years. From those failure stories, I want to share my experiences and lessons learned from them.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9v872h88x6uitdbj6pnp.jpg)

> Present from `dev.to` for being selected as "2022 top author"

### TypeScript-STL
https://github.com/samchon/tstl

TSTL is a migration project from C++ STL (Standard Template Library) to TypeScript.

  - Containers
    - `Vector`, `Deque`, `ForwardList`, `List`
    - `HashSet`, `TreeSet`, `FlatSet`
      - `HashMultiSet`, `TreeMultiSet`, `FlagMultiSet`
    - `HashMa`, `TreeMap`, `FlatMap`
      - `HashMultiMap`, `TreeMultiMap`, `FlatMultiMap`
  - Iterators 
  - Threads(?)
    - `Barrier`, `ConditionVariable`, `Latch`, `Semaphore`
    - `Mutex`, `TimedMutex`, `SharedMutex`, `SharedTimedMutex`
    - `Singleton`, `VariadicSingleton`, `MutableSingleton`, `VariadicMutableSingleton`
  - Utilities
    - `<algorithm>`
    - `<functional>`
    - `<numeric>`
    - `<special_math>`
    - `<ranges>`
    - `<utility>`

I'd developed this library to study data structures when I was a college student. In addition, since the basic containers of JavaScript are extremely weak, there was also an expectation that if I can implement every STL containers in the TypeScript, maybe I can become a famous open sorce library developer in short time.

After graduation, I became an algorithm developer, and kept using it for few years in a new reason. I often made a prototype project on the Web (TypeScript + React) and then completing the optimization logic, migrated the prototype to C++ production. Such migration was quite convenient because the same interface was guaranteed at the base library level through TSTL.

In summary, I had started TSTL to learn data structures, but I had been continuously working on the TSTL project, whether it is to become famous as an open source library or for convenient migration. Its duration was about 8 years.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sw4odmwa1a87s0k8ayj9.png)

> Utilized TypeScript for fast prototyping and demonstration

### Problems
However, have you heard this TSTL library? Maybe not. It is never a famous open source library and most of TypeScript developers do not know and do not use this TSTL library. During the long time development, I'd noticed my immaturities and understood why TSTL couldn't be famous.

Key reason of the failure was on appropriateness. Interface of STL components are enough suitable in C++ environments, however, it was not suitable for TypeScript development. The idea of making prototypes and demos of algorithms with TypeScript seems to have been a thought only to me. In normal frontend (and sometimes backend) development, `TreeMultiMap` or `<special_math>` functions are not needed. Why `<thread>` like components (ex. `ConditionVariable`) would be required in common JavaScript environments?

Another reason is, TSTL was an overly large project for an open source novice developer to make. Open source project never ends up with main program implementation. Lots of extra skills like documentation or PR powers are required. And I never had experienced such documentation and PR processes. Now that I think about it, shouldn't the first open source project had to start from a smaller one?

> The last reason may be I had not known famous developer communities like this `dev.to`. I hand't known how to advertise and introduce my open source projects to massive developers.