python-non-sqlalchemy-code-challenge-articles

Phase 3 Code Challenge: Articles - without SQLAlchemy (Updated)

In this code challenge, you will be working with a Magazine domain.

We have three models: Author, Article, and Magazine.

For our purposes, an Author has many Articles, a Magazine has many Articles, and Articles belong to both Author and Magazine.

Author - Magazine is a many to many relationship.

Note: You should draw your domain on paper or on a whiteboard before you start coding. Remember to identify a single source of truth for your data.

Instructions

To get started, run pipenv install while inside of this directory. Then run pipenv shell to jump into the shell.

Build out all of the methods listed in the deliverables. The methods are listed in a suggested order, but you can feel free to tackle the ones you think are easiest. Be careful: some of the later methods rely on earlier ones.

Remember! This code challenge has tests to help you check your work. You can run pytest to make sure your code is functional before submitting.

We’ve provided you with a tool that you can use to test your code. To use it, run python lib/debug.py from the command line. This will start a ipdb session with your classes defined. You can test out the methods that you write here. You can add code to the lib/debug.py file to define variables and create sample instances of your objects.

Writing error-free code is more important than completing all of the deliverables listed - prioritize writing methods that work over writing more methods that don’t work. You should test your code in the console as you write.

Similarly, messy code that works is better than clean code that doesn’t. First, prioritize getting things working. Then, if there is time at the end, refactor your code to adhere to best practices. When you encounter duplicated logic, extract it into a shared helper method.

Before you submit! Save and run your code to verify that it works as you expect. If you have any methods that are not working yet, feel free to leave comments describing your progress.

Core Deliverables

Write the following methods in the classes in the files provided. Feel free to build out any helper methods if needed.

Initializers and Properties

Author

Magazine

Article

Object Relationship Methods and Properties

Article

Author

Magazine

Aggregate and Association Methods

Author

Magazine

Advanced Deliverables

These deliverables are not required to pass the code challenge, but if you have the extra time, or even after the code challenge, they are a great way to stretch your skills.

Bonus: Aggregate and Association Method

Bonus: For any invalid inputs raise an Exception