Introducing the challenge

Case Study: Building Software in Python

Mark Pedigo, PhD

Principal Data Scientist

What is a case study?

  • Apply existing skills to a real-world problem
  • Prerequisite courses
    • Software Engineering Principles in Python
    • Intermediate Object-Oriented Programming in Python

Two people in a meeting discussing a case study

Case Study: Building Software in Python

Case study scenario

Determining mortgage for new homes

  • Loan Officer for PyBank Financial
  • Build a program to
    • Determine house spend
    • Determine monthly payment
  • Disclaimer: Illustrative purposes only

loan_officer.jpg

Case Study: Building Software in Python

Plan of action

  • Software automating the calculations
  • Using Software Engineering principles, based on classes
  • Stages
    • Basic calculator
      • +, -, *, /, **
    • Financial calculator
      • Calculate interest, interest rate
    • Mortgage calculator
      • Calculate loan amount, repayments

Three calculators, increasing in size

Case Study: Building Software in Python

Inheritance

Code is reused between classes

  • The child class (FinancialCalculator) inherits all functionality from the parent class (BasicCalculator)
  • Child class can implement additional functionality
class BasicCalculator:
    def multiply(self, x, y):
        result = x * y
        return result
  ...
# Child of BasicCalculator
class FinancialCalculator(BasicCalculator):
    def months_from_years(self, years):
        # Inherits the .multiply() method
        return self.multiply(years, 12)
    ...
Case Study: Building Software in Python

Review of software engineering principles

  • Modular, clean, readable, efficient code
    • Inheritance, methods
  • Leverage reusable libraries, frameworks, existing solutions
    • Modify pre-existing code
    • Streamline development
  • Clear documentation, code comments, usage guides
    • Documentation
  • Testing
    • doctest and unit testing

An picture of a computer surrounded by icons representing software engineering

Case Study: Building Software in Python

Roadmap

Roadmap showcasing the different parts of the project.

Case Study: Building Software in Python

Let's build!

Case Study: Building Software in Python

Preparing Video For Download...