This module introduces you to Classes and how to use them in TypeScript.
Learning Objectives
The objectives of this module are to provide you with and understanding of:
- What classes are
- How to use inheritance in TypeScript Classes
- How to use Access Modifiers
- How to use Abstracts
- How to use Structural Typing
Intended Audience
This learning path is aimed at all who wish to learn how to use TypeScript
Prerequisites
It is essential you understand the face of contemporary web development to attend this course. You should have a good working knowledge of Javascript. Please note: Before attending this class delegates must have a Microsoft account (signing up one is free).
Feedback
We welcome all feedback and suggestions - please contact us at qa.elearningadmin@qa.com to let us know what you think.
Abstract classes allow us to create base classes from which other classes may be derived. They've been part of JavaScript since years 2015. Abstract classes cannot be instantiated themselves, but they can provide names for the required class variables and functions. Functions can have a concrete implementation, or they can be made abstract. If that's the case, then the class using the abstract as a base must provide the implementation for the function. A good example for an abstract class is a shape class. All shapes, it could be argued, will have a name, a number of sides and an area. But we'd never want to create an instance of an arbitrary shape. We have a constructor that defines the name, number of sides and a value for the area of any class that uses this as a base. There's an abstract get function called calc area. This has no implementation as each shape will have its own method of calculating its area. It defines a concrete implementation of a print shape info method. Beneath that, we have a circle class that extends the shape class, having its own property of radius. An implementation of get calc area is provided, that calculates sets and returns the area. On the right hand side of the screen we have a triangle class that does the same thing, but uses a different implementation for calc area. On line 50, we try and instantiate the shape class. We get the error I show. we cannot create an instance of an abstract class. The instantiations of the circle and triangle classes are fruitful. And we can use calc area and the print shape info method.
Lectures
Ed is an Outstanding Trainer in Software Development, with a passion for technology and its uses and holding more than 10 years’ experience.
Previous roles have included being a Delivery Manager, Trainer, ICT teacher, and Head of Department. Ed continues to develop existing and new courses, primarily in web design using: PHP, JavaScript, HTML, CSS, SQL, and OOP (Java), Programming Foundations (Python), and DevOps (Git, CI/CD, etc). Ed describes himself as practically minded, a quick learner, and a problem solver who pays great attention to detail.
Ed’s specialist area is training in Emerging Technologies, within Web Development. Ed mainly delivers courses in JavaScript covering vanilla JS, ES2015+, TypeScript, Angular, and React (the latter is authored by Ed) and has delivered on behalf of Google for PWAs. Ed has also developed a new suite of PHP courses and has extensive experience with HTML/CSS and MySQL.
Ed is responsible for delivering QA’s Programming Foundations course using the Eclipse IDE. His skillset extends into the DevOps sphere, where he is able to deliver courses based around Agile/Scrum practices, version control, and CI/CD.