Skip to content

Instantly share code, notes, and snippets.

@flancer64
Created October 31, 2024 08:28
Show Gist options
  • Save flancer64/a23b29ae6ff7d7d0cf52c49841f75e88 to your computer and use it in GitHub Desktop.
Save flancer64/a23b29ae6ff7d7d0cf52c49841f75e88 to your computer and use it in GitHub Desktop.
Core philosophy and principles of Tequila Framework (TeqFW) for scalable, modular JavaScript development.

Philosophy of the TeqFW Platform

Introduction

The Tequila Framework platform (hereafter referred to as TeqFW) was created to simplify the distributed development of JavaScript applications by loosely connected teams of developers. It fully supports ES6 modules, providing a unique approach to dependency injection and avoiding early code binding. This document offers a general understanding of TeqFW's philosophy; for detailed instructions and examples, please refer to other documents in the knowledge base.

The main concepts of TeqFW include:

  • Utilizing pure JavaScript without the need for transpilation
  • Relying on JSDoc instead of TypeScript for type annotations
  • A modular architecture based on ES6 modules
  • Applying the principle of Inversion of Control (IoC)
  • Supporting unique namespaces for module addressing
  • Using templates to unify code structure
  • Adhering to conventions that facilitate distributed development
  • Clear separation of data and functions in accordance with Harvard architecture principles
  • The ability to dynamically load ES6 modules from CDNs at runtime

Core Concepts

1. Pure JavaScript

TeqFW operates exclusively with pure JavaScript without the need for code transpilation, simplifying debugging and accelerating the development process. This allows developers to write and test code directly without unnecessary conversion steps.

Summary: Eliminating code transpilation simplifies development and enhances compatibility across different environments.

2. JSDoc

Instead of using TypeScript, TeqFW employs JSDoc annotations for type descriptions. This eases code handling, allows for static analysis in IDEs, and provides development freedom without the strict typing constraints of TypeScript.

Summary: JSDoc offers the benefits of type checking without strict limitations, simplifying work across various environments.

3. Modular Architecture

TeqFW uses ES6 modules as the primary unit of application structure. Each module can export individual entities, and dependencies are injected through constructors or factories. Modules are bundled into npm packages managed via package.json. The teqfw.json file adds information necessary for the TeqFW platform, such as rules for mapping namespaces to file structures to locate source code.

Summary: ES6 modules provide modularity and flexibility in code structure, managed through npm.

For more details on TeqFW's module structure, read the document "TeqFW Module System".

4. Inversion of Control (IoC)

The core idea of IoC in TeqFW is to avoid static imports of modules. This ensures consistent operation in both browser and Node.js environments, allowing developers to focus on high-level architecture while deferring implementation specifics until application runtime.

Summary: Inversion of Control enhances portability and modularity, enabling a focus on architecture.

5. Namespaces

Namespaces are used for effective dependency management. The filename or class name in a TeqFW plugin should reflect its location in the codebase, simplifying navigation and the search for required modules.

Summary: Namespaces allow efficient management of modules and dependencies.

Learn more about namespaces in the section "Working with Namespaces in TeqFW".

6. Templates

TeqFW uses templates to organize code by component types, helping maintain structural consistency. For example, code can be organized into Data Transfer Objects (DTOs), services, controllers, and so on.

Summary: Templates help standardize code and improve its organization.

7. Conventions

Strict adherence to conventions helps developers quickly onboard and simplifies collaboration in distributed teams. Standardizing code structure, file naming, and component organization makes development more predictable and scalable.

Summary: Conventions simplify distributed development by making code uniform and predictable.

8. Data and Functions

In TeqFW applications, code is divided into that which describes data structures (DTOs) and that which processes this data. Data handlers operate under a functional paradigm, relying heavily on input data and minimizing dependency on external states.

Summary: Separating data and functions simplifies maintenance and enhances code modularity.

For more details on DTOs and data handlers, read the document "Working with Data in TeqFW".

9. Dynamic Module Loading from CDNs

TeqFW provides the ability to dynamically load ES6 modules during application runtime in the browser. Using dynamic import and CDNs like JsDelivr or Unpkg, the Object Container can load any modules directly from the npm package registry. This means that applications on the TeqFW platform can access any available ES6 module without prior installation or bundling, significantly expanding development possibilities and flexibility.

Summary: Dynamic module loading from CDNs allows applications to flexibly connect dependencies at runtime, utilizing a wide range of packages from the npm registry.

Conclusion

TeqFW offers a powerful set of tools and approaches for efficient and flexible JavaScript application development. By leveraging pure JavaScript, JSDoc, modular architecture, and other described concepts, developers can create scalable and maintainable applications, easily integrating new modules and collaborating within distributed teams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment