The book library
Table of contents
This little post would be about how I had, and I'm planning to organize the code inside my book library. This library is part of the reading management system that I'm working on. But, at the moment, this is where I'm focusing my efforts.
How it is now
Originally, I did'n have a structured way to organize the code of my library. Currently, my code is organized like this:
- Type Classes
- Type declarations and newtype declarations with their functions next to them.
- Sum data type definitions.
The base of the new way
Now, I'm planning to implement the following approach, described by Eric Normand :
- Actions: Anything that depends on when it is run, or how many times it is run, or both [...].
- Calculations: Computations from input to output. They always give the same output when you give the same input. [...].
- Data: Recorded facts about events. [...]. [1, p10]
How it would be
How this would look without seeing the actual code:
- First I would put the data or in this case what is a book. Type classes, type and newtype declarations; type aliases, and data types.
- Then the calculations in this case and by the moment the functions to wrap and unwrap around my defined types, and other operations that don't need to interact with the outside world.
- Finally, I would put the actions, right now the only type of functions that I think could go here are time-related functions.
References
[1] E. Normand, Grokking simplicity: taming complex software with functional thinking. Shelter Island, NY: Manning Publications Company, 2021.
Subscribe to my newsletter
Read articles from Ulises Alexander Arguelles Monjaraz directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ulises Alexander Arguelles Monjaraz
Ulises Alexander Arguelles Monjaraz
I'm a software engineer from Mexico, I've been coding in Python for around 3 years, mostly in personal and college projects. Currently, I'm focusing more in learn and develop in Haskell, one of my current projects is the design and coding of a library to help in the development of book related software. My hobbies are: listening to music, watching anime and series; reading manga, webtoons, webcomics, and books; programming, traveling when possible, going to the movies, going out for a walk.