- Scala Design Patterns
- Ivan Nikolov
- 225字
- 2021-07-16 12:57:26
Chapter 2. Traits and Mixin Compositions
Before digging into some actual design patterns, we have to make sure that many of the Scala language concepts are clear to the reader. Many of those concepts will later be used in implementing the actual design patterns, and being aware of the possibilities, limitations, and pitfalls are the key factors that enable to correctly and efficiently write code. Even though those concepts are not considered as "official" design patterns, they could still be used to write good software. Even in some cases, due to the richness of Scala, some concepts could replace a design pattern by just using language features. After all, as we have already said before, design patterns are there because a programming language lacks features and is not rich enough to complete certain tasks.
The first topic that we will look into is about traits and mixin compositions. They provide the developer with a possibility to share already implemented functionality or to define interfaces for classes in an application. Many of the possibilities, which are provided by traits and mixin compositions to developers, are useful to implement some of the design patterns that we will focus on later in this book. We will go through the following main topics in this chapter:
- Traits
- Mixin compositions
- Multiple inheritance
- Linearization
- Testing traits
- Traits versus classes
- ASP.NET Core:Cloud-ready,Enterprise Web Application Development
- JBoss Weld CDI for Java Platform
- AngularJS入門與進(jìn)階
- Node.js 10實戰(zhàn)
- Visual FoxPro程序設(shè)計教程(第3版)
- Dynamics 365 Application Development
- 控糖控脂健康餐
- Python高效開發(fā)實戰(zhàn):Django、Tornado、Flask、Twisted(第2版)
- JavaScript by Example
- The DevOps 2.4 Toolkit
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- OpenCV 3 Blueprints
- Java高并發(fā)編程詳解:深入理解并發(fā)核心庫
- PHP項目開發(fā)全程實錄(第4版)
- WCF技術(shù)剖析(卷1)