Summary

In this chapter, we learned about several anti-patterns in Julia programming. When we went over details for each anti-pattern, we also figured out how to apply alternative design solutions.

We began with the piracy anti-pattern, which refers to bad practices as related to extending functions from a third-party module. For convenience, we classified piracy anti-patterns into three different types—type I, II, and III. Each type poses a different problem in causing the system to become unstable or potentially invite problems in the future.

Next, we looked into the narrow argument types anti-pattern. When function arguments are too narrowly specified, they become less reusable. Because Julia can specialize the function for various argument types, it is more beneficial to make argument types as general as possible, utilizing abstract types. We went through several design options in great detail, and concluded that the most general types can be used without sacrificing performance.

 

Finally, we reviewed the nonconcrete field types anti-pattern. We proved that having nonconcrete types poses a performance problem because of the resulting inefficient memory layout structure. We figured that the problem can be solved easily by using parametric types, specifying concrete types as part of the type parameters.

In the next chapter, we will turn our attention to traditional object-oriented design patterns and see how they can be applied in Julia programming. Fasten your seat belt: if you used to be an OOP programmer, your ride may be a little bumpy! 

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

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