Meta framwork with TLang
   5 min read    TLang Authors

TLang is a small programming language that can help generate code in many programming languages such as Java, Kotlin, TypeScript, and Dart by creating code templates. It is useful to avoid boilerplate code, refactor and improve code, maintain code consistency, save time, and correct bugs.

In this blog post, I will share how we used TLang to create our own opinionated component that serves as a meta framework for our business. This meta framework allows us to focus on the business logic and requirements, rather than the technical details and implementation. It also enables us to generate the documentation, the specifications, the mockups, and the code for our projects automatically. This means that one team works on creating new components with TLang, and the other teams work on their applications using the components.

What is a meta framework?

A meta framework is a framework that can generate other frameworks. It is a way of abstracting the common patterns and functionalities that are needed for different types of applications, and providing a high-level interface to customize and configure them.

For example, a meta framework for web development could generate a web framework that handles routing, authentication, database access, templating, testing, etc. based on the specifications and preferences of the developer. The developer would only need to write the business logic and the user interface for their web application, and the meta framework would take care of the rest.

A meta framework can also generate other artifacts that are related to the application, such as documentation, specifications, mockups, and code. This can help streamline the development process, ensure consistency and quality, and reduce errors and bugs.

How we created our meta framework with TLang

We decided to use TLang as the language for creating our meta framework, because it has several advantages:

  • It is simple and expressive, with a syntax that is easy to read and write.
  • It supports multiple programming languages, so we can generate code for different platforms and environments.
  • It has a powerful template system, that allows us to define reusable code snippets and insert them into different places.
  • It has a flexible type system, that allows us to define custom types and validations for our data and components.
  • It has a rich set of built-in functions and libraries, that cover common tasks and scenarios.

We started by defining the core components of our meta framework, such as:

  • A component model, that defines the structure, behavior, and interface of each component.
  • A component registry, that stores and manages the components and their dependencies.
  • A component generator, that takes the specifications and preferences of the developer and generates the code and other artifacts for the component.
  • A component tester, that validates and verifies the component and its functionality.
  • A component documentation, that generates the documentation and the mockups for the component.

We then used TLang to write the code templates for each component, based on the best practices and standards of the target programming language. We also wrote the code templates for the documentation and the mockups, using Markdown and HTML respectively.

We also defined some custom types and functions for our business domain, such as:

  • A customer type, that represents the information and preferences of a customer.
  • A product type, that represents the information and features of a product.
  • A order type, that represents the information and status of an order.
  • A payment type, that represents the information and method of a payment.
  • A discount function, that calculates the discount amount for a given order.
  • A tax function, that calculates the tax amount for a given order.
  • A shipping function, that calculates the shipping cost and time for a given order.

We then registered these types and functions in the component registry, so that they can be used by other components.

How we used our meta framework for our projects

Once we had our meta framework ready, we were able to use it for our projects. For each project, we followed these steps:

  • We defined the specifications and preferences for the project, such as the name, the description, the target programming language, the target platform, the target audience, the features, the requirements, the design, etc.
  • We used the component generator to generate the code and other artifacts for the project, based on the specifications and preferences. The component generator would use the code templates and the component registry to create the components and their dependencies, and insert them into the appropriate places.
  • We used the component tester to test the project and its components, and check for any errors or bugs. The component tester would use the custom types and functions to validate and verify the data and the functionality of the components.
  • We used the component documentation to generate the documentation and the mockups for the project, and review them for any feedback or improvement. The component documentation would use the code templates and the component registry to create the documentation and the mockups, and display them in a user-friendly format.

By using our meta framework, we were able to create our projects faster, easier, and better. We were able to focus on the business logic and requirements, rather than the technical details and implementation. We were able to generate the documentation, the specifications, the mockups, and the code for our projects automatically, and ensure their consistency and quality. We were able to reduce the errors and bugs, and improve the performance and reliability of our projects.

Conclusion

TLang is a small programming language that can help generate code in many programming languages by creating code templates. We used TLang to create our own opinionated component that serves as a meta framework for our business. This meta framework allows us to focus on the business logic and requirements, and generate the documentation, the specifications, the mockups, and the code for our projects automatically. This means that one team works on creating new components with TLang, and the other teams work on their applications using the components.

If you are interested in learning more about TLang and our meta framework, you can visit our website or contact us. We would love to hear from you and answer any questions you may have. Thank you for reading this blog post, and we hope you found it useful and informative. 😊