Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Scala Design Patterns

You're reading from   Scala Design Patterns Write efficient, clean, and reusable code with Scala

Arrow left icon
Product type Paperback
Published in Feb 2016
Publisher
ISBN-13 9781785882500
Length 382 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivan Nikolov Ivan Nikolov
Author Profile Icon Ivan Nikolov
Ivan Nikolov
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. The Design Patterns Out There and Setting Up Your Environment FREE CHAPTER 2. Traits and Mixin Compositions 3. Unification 4. Abstract and Self Types 5. Aspect-Oriented Programming and Components 6. Creational Design Patterns 7. Structural Design Patterns 8. Behavioral Design Patterns – Part 1 9. Behavioral Design Patterns – Part 2 10. Functional Design Patterns – The Deep Theory 11. Functional Design Patterns – Applying What We Learned 12. Real-Life Applications Index

How to choose a design pattern

As we already saw, there is a huge number of design patterns. In many cases, they are suitable to be used in combinations as well. Unfortunately, there is no definite answer about how to choose the concept of designing our code. There are many factors that could affect the final decision, and you should ask yourselves the following questions:

  • Is this piece of code going to be fairly static or will it change in the future?
  • Do we have to dynamically decide what algorithms to use?
  • Is our code going to be used by others?
  • Do we have an agreed interface?
  • What libraries are we planning to use, if any?
  • Are there any special performance requirements or limitations?

This is by no means an exhaustive list of questions. There are a lot of amount of factors that could dictate our decision in how we build our systems. It is, however, really important to have a clear specification, and if something seems missing, it should always be checked first.

In the rest of the chapters, we will try to give specific recommendations about when a design pattern should and should not be used. They should help you ask the right questions and take the right decision before going on and writing code.

You have been reading a chapter from
Scala Design Patterns
Published in: Feb 2016
Publisher:
ISBN-13: 9781785882500
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime