Book Image

Hands-On Design Patterns and Best Practices with Julia

By : Tom Kwong
Book Image

Hands-On Design Patterns and Best Practices with Julia

By: Tom Kwong

Overview of this book

Design patterns are fundamental techniques for developing reusable and maintainable code. They provide a set of proven solutions that allow developers to solve problems in software development quickly. This book will demonstrate how to leverage design patterns with real-world applications. Starting with an overview of design patterns and best practices in application design, you'll learn about some of the most fundamental Julia features such as modules, data types, functions/interfaces, and metaprogramming. You'll then get to grips with the modern Julia design patterns for building large-scale applications with a focus on performance, reusability, robustness, and maintainability. The book also covers anti-patterns and how to avoid common mistakes and pitfalls in development. You'll see how traditional object-oriented patterns can be implemented differently and more effectively in Julia. Finally, you'll explore various use cases and examples, such as how expert Julia developers use design patterns in their open source packages. By the end of this Julia programming book, you'll have learned methods to improve software design, extensibility, and reusability, and be able to use design patterns efficiently to overcome common challenges in software development.
Table of Contents (19 chapters)
1
Section 1: Getting Started with Design Patterns
3
Section 2: Julia Fundamentals
7
Section 3: Implementing Design Patterns
15
Section 4: Advanced Topics

Piracy anti-pattern

In Chapter 2, Modules, Packages and Data Type Concepts, we learned how to create new namespaces using modules. As you may recall, modules are used to define functions so that they are logically separated. It is possible, then, that we can define two different functions—one in module X and another in module Y, with both having exactly the same name. In fact, these functions do not even need to mean the same thing. For example, in a mathematics package, we can define a trace function for matrices. In a computer graphics package, we can define a trace function for doing ray tracing work. These two trace functions perform different things, and they do not interfere with each other. 

On the other hand, a function can also be designed to be extended from another package. For example, in the Base package, the AbstractArray interface is designed to...