Advertisement
Guest User

Untitled

a guest
Mar 11th, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Smarty 10.40 KB | None | 0 0
  1. ***=-------------------------------------------------------=***
  2.  Basic Contact List Manager
  3.  BY: [REMOVED]
  4.  Language: Python with Tkinter GUI
  5. ***=-------------------------------------------------------=***
  6.  
  7. # Table of Contents
  8.  
  9. - [Program Description](#program-description)
  10. - [User Stories](#user-stories)
  11. - [SOAP vs REST](#soap-vs-rest)
  12. - [RESTful API Design](#restfulapi-design)
  13. - [Object-oriented Design Showcase](#object-oriented-design-showcase)
  14. - [Coding Style](#coding-style)
  15. - [General OO Design of Program](#general-oo-design-of-program)
  16. - [Persistence](#persistence)
  17. - [Portability](#portability)
  18. - [Running the Program](#running-the-program)
  19. - [Installing Required Libraries](#installing-required-libraries)
  20.  
  21. # Program Description
  22.  
  23.  This program is a basic contact list manager program.
  24.  Here are the following things you can do on the app:
  25.   - My Contacts: Displays contacts in the app.
  26.   - Add Contact: Adds contact with information to the app.
  27.   - Delete Contact: Removes selected contact from the app.
  28.   - Export Contacts: Produces valid JSON for contacts within the system.
  29.   - View API Calls: Displays the information retrieved from SOAP & REST calls.
  30.  
  31. # User Stories
  32. ### New User Stories
  33.  
  34.  - As a user, I would like to view the currency conversion from CAD to USD so that I am up to date with the newest conversion rate without having to use google.
  35.  - As a user, I would like the system to display a "lol cat" so that I get my daily dose of "lol cat" without having to leave the system.
  36.  -
  37. ### Previous User Stories
  38.  
  39.  - As a user I would like entered contacts to be available until I delete them so that I can store my contacts in the program.
  40.  - As a user I would like to export a single contact so that I can get one contacts information  easily.
  41.  - As a user I would like to add contacts so that I can store my contacts.
  42.    - (Previous functionality but re-worked to have better UI. Spoke with Judi and was approved.)
  43.  - As a user I would like to be notified if the contact was successfully added or not so that I know if a contact is successfully.
  44.  
  45. # SOAP vs REST
  46.  
  47. Please refer to the **`SOAPvsREST.pdf`** document found in the same folder as the README.
  48.  
  49. # RESTful API Design
  50.  
  51. Please refer to the **`RESTful_API_Design.pdf`** document found in the **design** folder in the same folder as the README.
  52.  
  53. # Object-oriented Design Showcase
  54.  
  55. ### Inheritance
  56. ```DEMO INFO HERE```
  57.  
  58. ### Encapsulation
  59. ```DEMO INFO HERE```
  60.  
  61. # Coding Style
  62. Throughout the assignment, the following coding styles were used:
  63.  - Class names use PascalCase
  64.  - "Private" variables use single '_' in front of them.
  65.  - Variable names use camelCase
  66.  
  67. # General OO Design of Program
  68. ### Encapsulation
  69.  - package/model/ContactClass.py lines 6-10: Private variables for class.
  70.  - package/model/PersonalContactClasses.py lines 7-10, 24-27, 40-42: Private variables for classes.
  71.  - package/model/ProfessionalContactClasses.py lines 7-11, 26-28, 40-42: Private variables for classes.
  72.  - package/controller/ContactListClass.py line 6: Private variable for class.
  73. > **/!\ Note**: Any variable that starts with "self._" is a private variable within the class.
  74.  
  75. ### Overrided Methods
  76.  - package/model/PersonalContactClasses.py lines 13,29,44
  77.    - These methods overrides the "show" function belonging to each class. The show function displays the classes information in a string. The "show" method is inherited from the parent class and uses the parent's classes "show" functionality within it.
  78.  - package/model/ProfessionalContactClasses.py lines 14,30,44
  79.     - These methods overrides the "show" function belonging to each class. The show function displays the classes information in a string. The "show" method is inherited from the parent class and uses the parent's classes "show" functionality within it.
  80.  
  81. ### Program Class's Relationships & Purpose
  82.  - Contact Class (Abstract)
  83.    - Location: package/model/ContactClass.py
  84.    - Base contact class in which all other contacts inherit from.
  85.    - Has attributes all contacts share in common. Example: (Name, Phone Number, Address)
  86.  - ProfessionalContact Class (Abstract)
  87.    - Location: package/model/ProfessionalContactClass.py
  88.    - Only Colleague and HealthCare contact classes inherit from this class.
  89.    - Has attributes only these two share in common. Example: (Office Hours, Work Number)
  90.  - PersonalContact Class (Abstract)
  91.    - Location: package/model/PersonalContactClass.py
  92.    - Only Friend and Family contact classes inherit from this class.
  93.    - Has attributes only these two share in common. Example: (Nickname, Birthday)
  94.  - Friend/Family/Colleague/HealthCare Class
  95.     - Location:
  96.         - package/model/PersonalClass.py
  97.         - package/model/ProfessionalClass.py
  98.     - Classes the user can create within the system.
  99.     - Only classes that can be instantiated as they are not abstract.
  100.  - ContactList Class
  101.      - Location: package/controller/ContactListClass.py
  102.     - This class is the controller for the system as it houses all the functions that are used by the view in order to manipulate the model.
  103.     - This class also conducts the logic for exporting contacts as JSON objects.
  104.     - This class also contains the API classes and facilitates the delegation of the various API calls to retrieve the data from the REST and SOAP APIs.
  105.  - ContactListView
  106.      - Location: package/view/ContactListView.py
  107.     - Creates a class that is used to make the Tkinter view.
  108.     - This class can be used to instantiate many views for the system.
  109.  
  110. # Persistence
  111. ### User Story Associated with Persistence
  112.  The user story "As a user I would like entered contacts to be available until I delete them so that I can store my contacts in the program." is associated with persistence. This story is not possible without persistence as persistence is the storying of information for later retrieval of the program. Persistence also helps the program remember its state which is what this user story also requires.
  113.  
  114. ### Persistence User Story within Application
  115.  The user story associated with persistence makes the program better as a whole because without it the program is useless. Storing the user's contact information until the user deletes it is the purpose of this application.
  116.  
  117. ### Save and Load Persistent Data Proof
  118.  The package/controller/ContactListClass.py has two functions: saveData (line 13-16) & loadData (line 18-24)
  119.  These functions allow the application to save the data given to the application by the user and load the saved data when the program is run.
  120.  
  121.  In order to do this, I used Pickle (Not to be confused with Pickle Rick) to serialize the data. As this is a relatively small application which will not have many different versions, using the built in Python serialization methods is acceptable.
  122.  
  123.  
  124. # Portability
  125.  In order to test the portability aspect, click the "Export Contact" option in the side menu.
  126.  
  127. ### Rationale For Portability
  128.  Portability is associated with the second user story " - As a user I would like to export a single contact so that I can get one contacts information easily." for the program. Exporting uses JSON as it is a very universally used type of data sharing.
  129.  
  130. ### Proof of Portability
  131.  The package/controller/ContactListClass.py on line 60 - 62 has the function thats used for returning the JSON'd contact object to be displayed to the user.
  132.  The object given was tested using: https://jsonlint.com/
  133.  
  134. # Running the Program
  135.  To run the program, just type `make`.
  136.  
  137.  If you do not have make installed, type:
  138.  `{python v3 interperator} ContactListManager.py`
  139.  
  140.  Where `{python v3 interperator}` is the command required to run Python 3 on your machine. (python || python3) as per your specific machines configuration of where Python 3 is located and run.
  141.  
  142. ## Technical Requirements
  143.  - Uses Python 3.7.2 (3.5.4 also works as tested on NoMachine)
  144.  - Uses tkinter version 8.6
  145.  - Tested on Linux (NoMachine) & Mac (Using Python 3.7.2 and Tkinter 8.6)
  146.  
  147. ## Required Libraries
  148. The following libraries are required:
  149.  - **zeep**: for SOAP API Calls
  150.  - **requests**: for REST (JSON) API Calls
  151.  - **tkinter 8.6**: for Python GUI
  152.  
  153. ## Checking Python & Tkinter Version
  154. ### Checking Python Version
  155. Use `python --version` to check the version of python you have as default.
  156. > **/!\ Note**: (SOCS Servers returns 2.7.13)
  157.  
  158. Use `python3 --version` to check the version of Python 3 you have installed if any.
  159. > **/!\ Note**: (SOCS Servers returns 3.5)
  160.  
  161. ### Checking Tkinter Version
  162.  1. Enter `python3` or `python` (Version for Python3 on your computer)
  163.  2. Enter `import tkiner as tk`
  164.  3. If step 2 fails, try `import Tkiner as tk`
  165.  4. If steps 2 and 3 fail, you do not have Tkinter. Please check the **Installing Required Libraries** section.
  166.  5. Enter `tk.TkVersion`
  167.  6. Ensure that the version given is 8.6 If not, please check Install Instructions.
  168.  7. Enter `exit()` to exit.
  169.  
  170. # Installing Required Libraries
  171. You can install the required "zeep" and "requests" libraries by running
  172. the following commands:
  173.  - `pip install zeep`
  174.  - `pip install requests`
  175.  
  176. To install Python (With Tkinter) please follow these instructions:
  177.  
  178. >/!\ Note: When installing Python DO NOT use Homebrew. Homebrew Tkinter package is NOT included which is required for this project.
  179.  
  180. >/!\ Note: The python.org version of Python comes with the appropriate version of Tkinter.
  181.  
  182. - Windows: https://www.ics.uci.edu/~pattis/common/handouts/pythoneclipsejava/python.html
  183.     >/!\Note: Install the latest version of 3.7 instead of the suggested 3.7.0
  184.  
  185. - Mac:
  186.     1. Go to https://www.python.org/downloads/
  187.     2. Click the Big Yellow Button that says "Download Python 3.7.2"
  188.     3. Wait for installer to download.
  189.     4. Run the Python Installer.
  190.     5. Verify that the installer was successful by following steps in the **Checking Python & Tkinter Version** section of the README.
  191.  
  192. - Linux: https://docs.python-guide.org/starting/install3/linux/
  193.  
  194. # Known Limitations
  195.  - Buttons have messed up colours. Known Tkinter issue for mac.
  196.  - Unable to use underscores within program as they are replaced with ''
  197.  - Command/Control + Q does not save the program's data.
  198.  - Linux has issues displaying the GUI and looks poorly laid out.
  199.  
  200. # Added Changes from Peer Review
  201.  - Changed getters and setters to properties
  202.  
  203. # Sources
  204.  - https://stackoverflow.com/questions/7498658/importerror-when-importing-tkinter-in-python
  205.  - https://krzysztofzuraw.com/blog/2016/makefiles-in-python-projects.html
  206.  - http://net-informations.com/python/iq/interfaces.htm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement