|
| 1 | +# Object Oriented Programming & Design Patterns |
| 2 | + |
| 3 | + |
| 4 | +[](https://mybinder.org/v2/gh/rambasnet/Python-Object-Oriented-Programming/HEAD) |
| 5 | +[](https://colab.research.google.com/github/rambasnet/Python-Object-Oriented-Programming) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +- Jupyter notebooks for Object Oriented Programming and Design Patterns using Python |
| 10 | + |
| 11 | +## Text: Python Object Oriented Programming |
| 12 | + |
| 13 | +- Fourth Edition by Steven F. Lott and Dusty Phillips |
| 14 | + |
| 15 | +## How to use the notebooks |
| 16 | + |
| 17 | +### Important |
| 18 | + |
| 19 | +In order to learn coding, it's very important to actually type code on your own from scratch and NOT copy paste! You can run provided cells to see the output, follow along and learn from it. However, it's very important that you either start a new notebook or add cells and write your own code from scratch to practice the concepts covered with many similar examples and solve the exercises provided for self assessment. |
| 20 | + |
| 21 | +### Online services |
| 22 | + |
| 23 | +You can launch an interactive session of this project using online Binder service: |
| 24 | +[](https://mybinder.org/badge_logo.svg) or Google Colab. Each chapter, where applicable, provides [](https://colab.research.google.com) to simply click and run the notebook in Google's Colab environment. |
| 25 | + |
| 26 | +### On a local system |
| 27 | + |
| 28 | +To run these notebooks interactively and save your work locally, you need [Python 3](https://www.python.org/) and [Jupyter Notebook](http://jupyter.org/) -- an interactive web-based editor that allows you to create and share documents that contain live code and data. [Anaconda or Miniconda](https://www.anaconda.com/products/distribution) is the recommended way to install Python and other packages on all modern platforms. |
| 29 | + |
| 30 | +#### Using Docker |
| 31 | + |
| 32 | +- Install Docker on your system: [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/) |
| 33 | + |
| 34 | +- Dockerfile is provided to build a container image with all the necessary packages and dependencies to run the notebooks. You can build the image and run the container using the provided bash scripts. |
| 35 | + |
| 36 | +- Clone this repo and run the following command from the root of the repo |
| 37 | +- Use git-bash Terminal on Windows to run bash scripts |
| 38 | + |
| 39 | +```bash |
| 40 | + git clone https://github.com/rambasnet/Python-Object-Oriented-Programming.git |
| 41 | + curl -o setup.sh https://raw.githubusercontent.com/rambasnet/course-container/main/setup.sh |
| 42 | + bash setup.sh |
| 43 | + bash run.sh # run interactive Debian Shell in the container |
| 44 | + bash run-jupyter.sh # run jupyter notebook server in the container |
| 45 | +``` |
| 46 | + |
| 47 | +- jupyter notebooks are inside the notebooks folder |
| 48 | +- start from the OO-Table-of-Contents.ipynb |
| 49 | + |
| 50 | +#### Installing via Anaconda or Miniconda |
| 51 | + |
| 52 | +Anaconda or Miniconda has Python 3 and many other packages that you can easily install on any platform (Windows, Linux, and Mac). First, install Anaconda: [http://docs.continuum.io/anaconda/install/](http://docs.continuum.io/anaconda/install/) or Miniconda [https://conda.io/docs/user-guide/install/index.html](https://conda.io/docs/user-guide/install/index.html) for Python 3. |
| 53 | + |
| 54 | +After installing anaconda or miniconda, open a terminal or cmd prompt and run the following commands: |
| 55 | + |
| 56 | +```bash |
| 57 | + conda update conda |
| 58 | + conda env list # list current environments |
| 59 | + conda env remove -n <environment_name> # remove existing environment |
| 60 | + conda create -n oop python=3.10 # create a new virtual environment named py |
| 61 | + conda activate oop |
| 62 | + conda install notebook # or |
| 63 | + conda install -c conda-forge retrolab # uses notebook |
| 64 | + conda install mypy # type checker |
| 65 | + python -m pip install hypothesis # test data generator |
| 66 | +``` |
| 67 | + |
| 68 | +#### Running the notebooks in VS Code |
| 69 | + |
| 70 | +- Python notebooks can be run natively in VS Code. Simply open the notebook file with extension .ipynb in VS Code and run each cell; add new cell, etc. right from VS Code. |
| 71 | + |
| 72 | +#### Running the notebooks using jupyter notebook server |
| 73 | + |
| 74 | +Once Python 3 and Jupyter Notebook are installed, open a terminal change working directory using cd command to go into the folder where this repo is cloned and run the notebook from there. Use notebook or retro. |
| 75 | + |
| 76 | +```bash |
| 77 | + cd <directory where this repo is cloned> |
| 78 | + jupyter notebook # or |
| 79 | + jupyter retro |
| 80 | +``` |
| 81 | + |
| 82 | +This will start a Jupyter session in your browser. Open any chapter and start coding... |
0 commit comments