Skip to content

polinatrump/book_recommendation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Science Master class: Advanced software engineering
University: Berliner Hochschule für Technik (BHT)
Project name: Book recommendation system
Project author: Polina Kozyr

PROJECT DESCRIPTION
The goal of the project is to create a simple book recommendation system based on the genre and author analysis. The user enters his name and surname and a book that he has already read and liked. Based on data of this book other books recommendations are calculated. Project is a pet one and may be concerned as a small service of some big recommendation system. For now recommendations are evaluated only by one book that user entered. Maybe in the future this system could be expanded and possibility of taking into account several books for recommendation will be implemented.

  1. Use and understand Git!
    You can see that the project is on Git-hub and check version control.

  2. UML at least 3 good different diagrams. "good" means you can pump it up artificially as written in DDD.
    You have 10 million $ from me! Please export the pics. I can not install all tools to view them!

Use case diagram
Activity diagram
Entity Relationship Diagram
Object diagram

  1. DDD If your domain is too small, invent other domains around and document these domains (as if you have 100 Mio € from Edlich-Investment!) Develop a clear strategic design with mappings/relationships with >4 Domains coming from an Event Storming. Drop your Domains into a Core Domain Chart and indicate the Relations between the Domains!

Firstly I made Event Storming diagram, defined domain events and commands and reactions for them.

Please, after you go to the link click on Download - picture will not be downloaded on your computer but these way \ you can see full picture
Event Storming

Then based on Event Storming I made DDD:
Domain and Subdomain Relationships

  1. Metrics at least two. Sonarcube would be great. Other non-trivial metrics are also fine.
    I downloaded and installed Sonarcube and used it for my project.
  • Here you can see Sonarcube results:
    Sonarcube screenshot

  • Bugs: 0

  • Vulnerabilities: 0

  • Security Hotspot: 1
    I checked by myself this moment and it is okay

  • Code Smells: 16 There are issues like that, so after manual check I think it's okay to leave it like this

  • Coverage: I used coverage report
    Coverage is 66 % for my project.

  1. Clean Code Development: at least 5 points you can show me + >>10 points on your personal cheat sheet

My personal cheet sheet :

  • Use descriptive intention revealing names - it's important to write code easy and readable. So here I used simple for cycle and you as a person who sees this project for the first time it is easy to understand code
  • Don't repeat one code twice - Code should have a single, unambiguous, authoritative representation within a system.
    I wrote a function here that split values in column. I have two different columns (genres and authors) that I
    have to split and I didn't write code twice for each column but use just one function for this task
  • You Aren't Gonna Need It - In my code I don't have variables and functions that I don't use - checked with Sonarcube
  • Create the names of variables, functions and classes that way, that you can understand what they are for easily in the future - example
  • The code should be easily testable
  • Tests should be easy to understand and easy to change - see my tests here
  • Use docstring (example here) to ealsily understand what each method or class does, its role and responsibility
  • Write Exceptions for some cases to easily understand if one certain error occurs - example here
  • Avoid using ambiguous shorthand. A variable should have a long descriptive name than a short confusing name.
  • Don’t use magic numbers. Magic numbers are numbers with special, hardcoded semantics that appear in code but do not have any meaning or explanation. Usually, these numbers appear as literals in more than one location in our code. An example in my code here
  • Single responsibility principle. Classes and functions should do one thing and do it well. It's good to write short and simple functions that perform a single task. My examples here
  1. Build Management with any Build System as Ant, Maven, Gradle, etc. (only Travis is perhaps not enough) Do e.g. generate Docs, call tests, etc. (it could be also disconnected from the project just to learn a build tool!)
    The pyinstaller library was used as build management, which allows to build python code into executable files (link). For this, the pyinstaller --onefile run.py command was used. You can see output for this command here. This command collects the source files that are required to run run.py into a single executable file and creates the dist and build directories. The dist folder contains various files that the builder creates as it builds. In the dist folder, respectively, is the executable file itself. It is important that the executable must be rebuilt every time if the program is to be run on a different CPU architecture.

  2. Integrate some nice Unit-Tests in your Code to be integrated into the Build
    Unit tests cover the main logic. Under the main logic of the application, an algorithm that looks for K nearest neighbors is implied. Since this was the main part of the applications around, which included the rest of the parts, I considered it important to cover this part with tests. Also, in order for the tests to always use the same source data, fixtures for domain models were written. Test coverage was 66%.

  3. Continuous Delivery: show me your pipeline using e.g. Jenkins, Travis-CI, Circle-CI, GitHub Action, GitLab CI, etc. E.g. you can also use Jenkins Pipelining or BlueOcean, etc. But at least insert more than 2 script calls as done in the lecture! (e.g. also call Ant or Gradle or something else).
    Jenkins file was created for describing pipeline configuration. To specify that pipeline should be build from Jenkinsfile, I chose "Pipeline script from SCM" as definition parameter (figure). I specified three stages for this pipeline: Build, Test and Deploy. Firstly, I specified the agent label. I created a docker agent which allows to execute each build of pipeline in separated docker container. For this reason I created a Docker cloud inside Jenkins with use of Docker plugin as is shown here. Parameter pollSCM allows to monitor changes in the GitHub repository and if there a new commit appears, it starts the build of pipeline. Next in Jenkinsfile the stages come. In the first stage that is called Build dependencies and libraries are being installed with command pip intall -r requirements.txt. Then the Test stage goes. At this stage I check result of my unit tests and if this stage is passed then the Deploy stage is performed. At the last stage I use pyinstaller to build an executable .exe file.

  4. Use a good IDE and get fluent with it: e.g. IntelliJ. What are your favorite Key-Shortcuts?!

I developed my project in PyCharm IDE. The Key-Shortcuts that I actually used are:

  • ctrl+/ --> Comment/uncomment current line or selected block with line comments
  • When i have to change one certain code or variable everywhere where it is I press Ctrl+F than write code in search window than press Ctrl+Alt+Shift+J to select all occurrences and edit them at a time
  • Double Shift --> Search everywhere any file, class, variable, symbol in project and current Git repository
  • Shift + F10 --> Run the script
  • Shift + F9 --> I use Debug for study errors in code
  • Alt + Enter --> to import library or class in python file
  • Developers can create database in PyCharm and easily see tables and write queries. For this press 'Database'. Ctrl+Shift+Q to get to Query Console, Ctrl+F5 to refresh Database
  1. DSL Create a small DSL Demo example snippet in your code even if it does not contribute to your project (hence it can also be in another language).
    Using the click library, a DSL interface was created to run the program (file here). This mode involves transfer input parameters through flags. Command here: python run_dsl.py --first_name=1 --last_name=2 --book_title='The Hunger Games' --recommend_count=2

  2. Functional Programming: prove that you have covered all functional aspects in your code as: only final data structures (mostly) side effect free functions the use of higher-order functions functions as parameters and return values use closures / anonymous functions You can also do it outside of your project. Even in another language as F#, Clojure, Julia, etc.

In file FP.py you can see simple example of user interface functions, where I used higher-order functions and functions as parameters and return values. They are all final data structures. There is almost no side effect except recom_num variable. The example of anonymous function you can find here.

About

Book recommendation system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published