This is the code repository for Hands-On Design Patterns and Best Practices with Julia , published by Packt.
Proven solutions to common problems in software design for Julia 1.x
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.
This book covers the following exciting features:
- Master the Julia language features that are key to developing large-scale software applications
- Discover design patterns to improve overall application architecture and design
- Develop reusable programs that are modular, extendable, performant, and easy to maintain
- Weigh up the pros and cons of using different design patterns for use cases
- Explore methods for transitioning from object-oriented programming to using equivalent or more advanced Julia techniques
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
abstract type Formatter end
struct IntegerFormatter <: Formatter end
struct FloatFormatter <: Formatter end
Following is what you need for this book: This book is for beginner to intermediate-level Julia programmers who want to enhance their skills in designing and developing large-scale applications.
With the following software and hardware list you can run all code files present in the book (Chapter 1-12).
Chapter | Software required | OS required |
---|---|---|
1-12 | Julia Version 1.3.0 or above | Windows, Mac OS X, and Linux (Any) |
Click on the following link to see the Code in Action:
Page numbers below refer to the printed version. E-copy page numbers are slightly different.
- Page 39 and 49: Before running the using Calculator command, he/she can first go to the Pkg mode (by pressing the ] key) and then run the dev Calculator command. For example:
(@v1.4) pkg> dev Calculator
Path `/Users/tomkwong/.julia/dev/Calculator` exists and looks like the correct package. Using existing path.
Resolving package versions...
Updating `~/.julia/environments/v1.4/Project.toml`
[17fd2872] + Calculator v0.1.0 [`~/.julia/dev/Calculator`]
Updating `~/.julia/environments/v1.4/Manifest.toml`
[17fd2872] + Calculator v0.1.0 [`~/.julia/dev/Calculator`]
-
Page 54: The
subtypetree
function does not work when there is cycle in the type hierarchy. It is generally not a problem with the exception that theAny
type is a subtype of itself. So, runningsubtypetree(Any)
would get into an infinite loop. Please see Chapter02/subtypetree2.jl for a more robust version. -
Page 110: The signature of the first
explode
function under Using type parameters section should take<: Any
rather than justAny
.
function explode(things::AbstractVector{<:Any})
Because every type is a subtype of Any
, it is more idiomatic to omit the parametric part and use with a simpler syntax:
function explode(things::AbstractVector)
-
Page 219: The
vendor_id
of theTripPayment
has the wrong type. It should beInt
rather thanString
. -
Page 249: The second image on page number 249 is incorrect. The correct image is as follows:
- Page 318, 352, 494: These pages contain typos where "accessor" was misspelled as "assessor".
Tom Kwong , CFA, is an experienced software engineer with over 25 years of industry programming experience. He has spent the majority of his career in the financial services industry. His expertise includes software architecture, design, and the development of trading/risk systems. Since 2017, he has uncovered the Julia language and has worked on several open source packages, including SASLib.jl. He currently works at Western Asset Management Company, a prestige asset management company that specializes in fixed income investment services. He holds an MS degree in computer science from the University of California, Santa Barbara (from 1993), and he holds the Chartered Financial Analyst® designation since 2009.
Click here if you have any feedback or suggestions.