© Venkata Keerti Kotaru 2020
V. K. KotaruAngular for Material Designhttps://doi.org/10.1007/978-1-4842-5434-9_1

1. Introduction

Venkata Keerti Kotaru1 
(1)
Hyderabad, India
 
Welcome to implementing web applications using Angular, TypeScript, and Material Design. As we begin the journey of exploring features and capabilities in this introductory chapter, we look at
  • Web technologies

  • A brief history of Angular and its evolution

  • TypeScript

  • Material Design and the implementation of the Angular design language

Web Technologies

Web application development has evolved. It has become a powerful, rich, and complex. In yesteryear’s web applications, the heavy lifting was done on the server side; only servers had the processing power to build rich and complex applications. Browsers presented data to the users, captured user input, and sent it back to the server for major processing. Browsers and JavaScript code on the browser performed basic validations.

Over the years, client machines became more powerful and browser technologies evolved. HTML, CSS, and JavaScript languages have transformed. ES (ECMAScript) is a language specification created to standardize JavaScript. Over time, browsers have adapted features standardized with ES.

Browsers have widely adapted ES5, a version of JavaScript specification released in 2009. It made the JavaScript language a first-class citizen in programming languages. A minor version, 5.1, was released in 2011; however, ES6, or ES2015, has provided major improvements to the language and allowed developers to take the best advantage of the platform. So far, ECMAScript updates have been made yearly. Currently (at the time of authoring this book), we are at ES9/ES2018.

JavaScript continues to add new features. The ECMA TC39 committee is responsible for evolving JavaScript. They have defined a five-stage process, which takes an idea to a fully functional feature adapted by various browsers (see Table 1-1). Each JavaScript feature goes through these stages. Once a feature is standardized and implemented by browsers, it is ready for JavaScript developers.
Table 1-1

JavaScript Stages

Stage 0

Strawman. A new JavaScript feature specification.

Stage 1

Proposal. Demonstrates the need for the feature addition, solution, and challenges.

Stage 2

Draft. Provides details on syntax and semantics.

Stage 3

Candidate. Enables users to experiment and provide feedback. Based on feedback, the specification might evolve further.

Stage 4

Finished. Ready to be included in the ECMAScript standard.

As more capabilities are added to the language and to browsers, more features are moved to the client on the browser, the complexity of browser applications increases, and new-generation web applications take advantage of sophisticated HTML5, JavaScript, and CSS3 features.

Additional complexity, scope for reusability, and patterns mean there is a need for frameworks and libraries. Angular is one of the best open source frameworks available. A tremendous number of applications and developers have taken advantage of this framework.

Introduction to Angular

Angular is a framework for building front-end applications. It is an open source project driven by Google. Contributors to the framework are from around the world. Angular helps build applications that cater to multiple device form factors—desktops, tablets (e.g., iPads and Android devices), and mobile phones. This book primarily focuses on browser applications for desktop screens.

Angular’s Roots in MV*

The AngularJS 1.x framework began as an MV∗ framework, which could be MVC or MVVM. The MVC architectural pattern—Model-View-Controller—is popular. This pattern helps build highly cohesive, loosely coupled, modular applications. It helps with the separation of concerns.

The pattern began its roots in 1970s with the Smalltalk programming language. It has since been adapted in various modern programming languages. It is a tried and tested approach, especially for front-end applications. The following are a few highlights of the framework.
  • Model is the data presented to the user.

  • View is the user interface.

  • Controller combines both. It applies the model/data on a template/view.

Figure 1-1 is a representation of the MVC pattern.
../images/475625_1_En_1_Chapter/475625_1_En_1_Fig1_HTML.jpg
Figure 1-1

MVC pattern

There is a variation to the pattern called MVVM, or Model-View-ViewModel. It is suitable for an application that extensively uses data binding on the user interface.

With MVVM, a model represents a domain entity. Typically, it is used with a business logic implementation. The model object is independent of the presentation logic. The same object might be shown on different views or screens.

Hence, the model object may not be easily bindable to controls on the view. The pattern recommends creating a ViewModel, which is a separate object that is specific to each view or screen. It is easily bindable with the controls. We transform model to a view model. Figure 1-2 is a representation of the MVVM pattern.
../images/475625_1_En_1_Chapter/475625_1_En_1_Fig2_HTML.jpg
Figure 1-2

MVVM pattern

Angular from AngularJS

There have been advances in frameworks and technologies. Consider the following highlights.
  • Web Components, a standard for building reusable HTML elements

  • Frameworks like React, which allow composing a complex user interface with reusable components

Front-end web application development moved in directions that either put together reusable components or built libraries that created those building blocks/components.

Angular version 2.x and upward saw major redesign. The 1.x versions are referred to as AngularJS. Today’s framework is known as Angular. The convention is to refer to the 1.x versions of the framework as AngularJS and everything beyond version 2.0 is just Angular.

Angular is a modern framework that primarily uses components to create views. Although components are the building blocks for views, during the course of the book, you also learn about modules, services, dependency injection, and so forth.

Angular has had incremental updates. The version number includes three parts; consider 8.2.7, for example.
  • Major version. In the 8.2.7 example, the first number is 8. An upgrade to the first number of the framework version is considered a major release. It is potentially a breaking change. Developers need to be involved in the upgrade.

  • Minor version. In the example, the second number is 2. An upgrade to this number in the version is considered a minor release. The framework has added minor features that are backward compatible.

  • Patch level. In the example, the third number is7. An upgrade to this version number is a patch release, which include low-risk bug fixes.

Note

The Angular framework continuously evolves, with a major release every six months.

When version 2 of the framework was released, it supported the following three flavors:
  • Angular with TypeScript

  • Angular with JavaScript

  • Angular with Dart

Angular with TypeScript had the most traction in the developer community. This book extensively uses TypeScript when developing Angular applications.

TypeScript

TypeScript is a superset of ECMAScript. It is an open source project backed by Microsoft. It supports data types. This book uses the TypeScript language for building an Angular application.

As discussed, ES6 (ECMAScript), or ES2015, was a major upgrade to JavaScript as a language. TypeScript compliments JavaScript features. TypeScript supports all JavaScript features, including data types, interfaces, generics, and enums. TypeScript compiles the code in browser-understandable JavaScript. It can be integrated with major bundling solutions like Webpack.

As you will see in this book, you can build high-quality applications that take advantage of the powerful features that TypeScript provides beyond JavaScript.

Material Design

Material Design is Google’s design language, which provides a rich set of guidelines. This design language mimics real-world objects, hence the “material” metaphor. Components and controls on the user interface show depth and texture, cast shadows, and use animation in a meaningful way.

What Is a Design Language?

User interface (UI) designers help create the user experience of a company’s products. A design language is developed to bring consistency in the look and feel, behavior, and experience. It describes aspects such as color schemes, patterns, and textures. Material Design is one such design language developed by Google; other examples include Flat Design, which is used extensively in iOS, Microsoft Metro Design, which is used in Windows 8 and Windows Phone, and the Fluent Design System, which is used in Windows 10.

How Does It Help Us?

When envisioning, designing, and building a system, a problem statement or requirements are defined for various features. We define a technology solution for data storage, the user interface, and so forth. In this book, we use Angular for building the UI. The missing piece is the user experience. A user needs to easily locate and navigate between features, locate all the available actions on a screen, and have the data laid out in an organized fashion. This is very important. Regardless of the system’s efficiency and capabilities, the user is interfacing with the UI. Features, consistency, and organization determine the good, bad, or ugly feedback about our product.

Material Design has been popular since its introduction into Android (version 5/Lollipop). Various Google products, including Gmail, YouTube, Google Drive, Google Plus, and Google Docs, have been built with this design language. Over time, many organizations and individuals outside of Google have used it. For the application that we are building, user adaptability will be easy and fast. Importantly, Google researched and laid out the guidelines; hence, it is a great head start.

How About Brand Value?

We desire to be consistent but unique. We do not want our application to mimic an existing product.

The Angular Material library provides enough extensibility to build a unique identity. Themes play a major role in this aspect. We can choose from an existing list of themes or build our own custom theme.

Typography

Typography describes the scale of the content (headers, titles, etc.), letter spacing, and font characteristics (font face, weight, size, etc.). Angular Material stylesheets and fonts provide prebuilt typography and theming that is confined to Material Design guidelines.

Angular Material Components

The Angular Material library provides a sophisticated list of components that are used with Material Design guidelines. These components provide ready-made functionalities in data forms, navigation, layouts, and multiple other aspects.

Conclusion

Angular, TypeScript, and Material Design are a powerful combination used to build rich web UI applications.

Angular helps build browser applications with high reusability, consistency, and scalability. This framework helps build single-page applications with out-of-the-box features, like routing. It enables easy communication with RESTful HTTP services, and manages and validates user input with sophisticated features building forms.

TypeScript is a superscript of ECMAScript. It allows you to use data types. It provides great integration with code editors and IDEs (integrated development environments). It integrates well with bundling tools like Webpack.

Angular Material provides components that confine to Material Design guidelines out of the box. It eases integrating the design language with an Angular and TypeScript application.

This chapter began with the context and history of web applications, described Angular and its evolution, and introduced TypeScript. And at the end, it introduced Material Design and the value it brings to the user experience and UI development.

References

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.4.181