What is TypeScript, pros and cons and how it helps in Model Driven Apps
First of all I would like to say that I wanted to start this year with a fresh idea for my blog and that’s how my friend Ben den Blanken gave me the idea of this series of blog posts which is a guide about TypeScript applied in Model Driven apps.
I’m going to start by describing from the basics of TypeScript like what it is, what are its benefits, to practical examples in Model Driven Apps.
Without further introduction let’s start:
The term “TypeScript” may already be familiar to you, if so then I’m not surprised because from its introduction in 2012, the language has consistently be in active development and sees a continuous increase in popularity with every year.
So the question then is: what precisely is TypeScript?
What is TypeScript?
Pros & Cons
Going deeper in technical detail, I can list some of the pros that TypeScript can give us:
- Strict typing
Everything stays the way we define it. Need a variable to always be a number? It’ll always be a number, then.
- Type annotations
A handy way of saying explicitly what type should be used.
- Code Maintainability
TypeScript enforces a more structured approach to coding. With explicit type annotations, code becomes self-documenting, making it easier for developers to understand and maintain.
- Enhanced Collaboration
When the project is developed by several developers, TypeScript helps to improve collaboration between them. The added type annotations make code more understandable, even for team members unfamiliar with a specific section of the codebase. Especially it increases quality and decreases time for code review, which is a part of each project development process. Also, it helps with onboarding and does it more smoothly for a new developer on a project.
- Object-oriented like
TypeScript introduced a great deal of syntax taken from object-oriented programming, including but not limited to:
- enumerated types,
Now for the cons that I’ve experienced:
- Complicated typing system (sometimes)
- Learning Curve
How it helps in Model Driven Apps
The following image is a sneak peek of what will come in my next blogpost, but just to show you how you can structure your code when using TypeScript:
Of course, if we are working on a large project we could end up with huge .ts files with a lot of logic, so it is important to pay attention from the beginning and create a well-defined structure that works for you.
The following is more of a general advice, not everything is going to be TypeScript development and not everything is going to be C# development (plugins and Custom APIs), so the key is to understand the requirements and decide the best possible solution, it could even be a cloud flow.