ABC Bank

Table of Contents:

  1. Introduction
    1.1 Classdiagram
    1.2 Introduction
    1.3 Engaging with this document

  2. Abstract methods
    2.1 Intro abstract methods
    2.2 Abstract class diagram
    2.3 Classdiagram

  3. Datahandeling (Adapter Pattern)
    3.1 Intro
    3.2 Class diagram
    3.3 Mock database
    3.4 Database handler
    3.5 Test block

  4. Loan application (Factory pattern)
    4.1 Intro
    4.2 Class diagram
    4.3 Abstract class
    4.4 Loan application algorithm
    4.5 Test block

  5. Account Products(Strategy/Factory/Decorator pattern)
    5.1 Intro
    5.2 Class diagram
    5.3 Product Abstract class
    5.4 Product algorithms
    5.5 Product Factory
    5.6 Product Functions
    5.7 Test block

  6. Customer Benifits (Strategy Pattern or Abstract Factory)
    6.1 Intro
    6.2 Class diagram
    6.3 Membership Abstract class
    6.4 Memberships
    6.5 Membership
    6.5 Test block

  7. Interfaces (Facade pattern)
    7.1 Intro section
    7.2 Class diagram
    7.3 Interface Loan
    7.4 Test Loan Interface
    7.5 Interface Accounts
    7.6 Test Accounts Interface
    7.7 Interface BankMain
    7.8 Test BankMain Interface
    7.9 Interface Login

  8. Conclusion
    8.1Last words
    8.2Interfaces Login (Run all)

1. Introduction

1.1 Classdiagram

This is a full class diagram to realize the full scope of the prototype; the diagram is further broken down in each section for better clarity.

title

1.2 Introduction

The prototype aims to break down the structures (design patterns) used to ensure usability and flexibility for future extensions. Thus the project uses a combined pattern, combining an abstract factory, strategy, decorator, facade and observer patterns. Each of these patterns offers different benefits to functionalities that this bank requires, thus ensuring the best utilization of the four pillars of programming:

The scope of the prototype encompasses multiple design principles, which will further be broken down in each section, however, one of the most important in the case ABC bank is to "strive for loosely coupled designs between objects that interact". Taking into consideration that ABC bank needs to break into a competitive market with new and innovative solutions, I believe in adopting a modular approach where objects or (clusters for functionality) can plug and played as new needs arise.

1.3 Engaging with this document

Each section has broken up into the different functions of the program, following one or more design patterns, Therefore there will be a short introduction for each describing how they function and why they are chosen.

There is also a class diagram giving a high-level overview of inheritance and composition between relevant objects in that section.

Each section is further subdivided to break down the different functionalities of the objects, there will follow a short explanation for each section if necessary and a test code block, showcasing that module.

At the end of this document, there is a combined interface testing some of the interconnections between each of the modules, this is not a full implementation only a prototype with limited functionality.

Pressing the table of contents sections headers sends you directly to that section, in the same way pressing the button below will shortcut you "Back to table of Contents", allowing you to quickly navigate the prototype and concepts presented.

Back to Table of Contents

2. Abstract methods

2.1 Intro abstract method

Since so much of the prototype is based on the use of abstraction and encapsulation it's important to quickly explain how this is done in the python language used. Importing abcmeta will us to use abstract classes and methods, that cannot be called on directly but instead, essentially give us a blueprint allowing us a more modular approach through Object-oriented programming. Thus allowing us to meet the requirements and prepare for future expansion of the functionality.

The code cell below imports the library, to use abstract classes:

2.2 Abstract class diagram

title1

In the diagram below you see that the class teacher has 3 subclasses with an (is-a) relationship essentially meaning that all Professors and instructors are also teachers. "Teacher", in this case, is an abstract class with two abstract methods, these can be polymorphed by any subclasses, to implement their set of rules(privileges) and their naming convention depending on which is instantiated.

Back to Table of Contents

3. Datahandeling (Adapter Pattern)

3.1 Intro database

ABC bank will most likely implement a relational database instead of NoSQL because of the importance of consistency in transactions of data. Any choice of large-scale databases will need the program's read-and-write requests to be adapted into a query language. The adapter pattern, though ideal for this circumstance, isn't completely showcased in the code block. This is because we needed a functional prototype, so I have instead utilized a python dictionary as key-value storage, for the functionality of the demo. Though the coding differs the principles remain the same, our object(DatabaseHandler) lies in between the program and database(key-value storage) the same way an adapter would, adapting interaction between two objects.

The efficiency of using an adapter means that we can not only extend the object with further adaptation, but we also can replace the object hope with minimal changes To the main code base. Thus incapsulating the necessary functionality used for reading and writing data to the database and allowing the banking system to adhere to design principles such as "classes should open for extension, closed for modification.

The class diagram below is simpler in the sense that has fewer objects.

3.2 class diagram

title1

3.3 Mock database

Below are two simple dictionaries (key-value storage) used for demoing the prototype. Each entry has a key that corresponds to the value. Some keys are even further embedded with other dictionaries.

3.4 Database handler

The actual handler has a few universal functions that will be utilized by the rest program, these would need to be further adapted to another data structure or replaced entirely.

The properties in this object are only for demonstration purposes only. Ideally, to maintain the speed and availability of the server, the relevant user data should be loaded into the memory stack once and then used and manipulated from memory, eventually writing back to the database once user operations are concluded. This is possible because most interactions from users on the banking systems will not collide with other users.

3.5 Test block

Here are some examples of interacting directly with the data handling object, similar to how the program will approach pulling appropriate data when needed.

Interact with the code window below by adding and removing "#" to see individual output:

Back to Table of Contents

4. Loan application (Factory Pattern)

4.1 Intro

The loan applications module as an isolated unit follows the Factory pattern. Loan applications are a specific set of sequences that calculate upon commonly inherited properties by parent class, thus avoiding code duplication. The design pattern allows as previously mentioned overwriting the abstract method with the set instruction on how that particular loan application should be processed and what properties will be considered for each type of loan.

Then module eventually returns a yes or no if the loan is approved for the end user, depending on the multiple requirements.

The Different loan applications can easily be expanded upon and offer an extensive range of products such as; refinancing the home loan, boat loan or other types of loans that will need to consider a client's financial situation.

In this case to simplify the reading of this document the rest of this module or the "factory" is found on: 7.3 Interface Loan this allows the user instantiates the chosen object (loan type). Incorporating the design principle "Identify the aspects that vary and separate them from what stays the same."

4.2 class diagram

title1

4.3 Abstract class

Blueprint for loan applications, with one method, that allows the subclass to polymorph their own implementation of algorithms. This class initializes properties and the same properties are inherited by all subclass since these don't change despite the object being instantiated.

4.4 Loan application algorithm

The following approval calculations inherit common application properties and essentially overwrite the loan_approval method the parent class. For test purposes only use 2 of the properties.

4.5 test block

Here are some examples of interacting directly with the Loan approval object in a similar fashion to how the program will interact with it.

You can interact with the code window below by adding and removing "#" on one line at a time:

move "#" on one line att a time:

Back to Table of Contents

5. Account products (Strategy/Factory/Decorater pattern)

5.1 Intro

The Account products module will be the largest in a bank as the transactional behavior of reading and writing a ledger is almost identical whether the product is a type of account as demonstrated below or a mortgage account or credit card account. They will have some form of:

The only variation between accounts is basically that some work on a deficit and some surplus balance, so incorporating them into one module is prudent. Design principle: "Identify the aspects of your application that vary and separate them from what stays the same".

The accounts follow the needs for a classic strategy pattern where they all implement the same modes of operations but with a few different properties supplied for the operations. However, because of the subtle differences in calculations, a combination of Factory and Strategy has been implemented in the code in sections 5.4 - 5.7.

As seen in the diagram below, the credit card and debit card (is-a) CurrentAccount or CreditCardAccount. These decorate underlie accounts transactions, almost qualifying as an interface or facade themselves. Though these need to still be implemented, as many other types of accounts have yet to be implemented, this only goes to show the flexibility and extendability of this module. I would say that the current and planned implementation not only encompasses many of design principles but also SOLID principles:

5.2 class diagram

title1

5.3 Product Abstract class

The abstract class has three abstract methods that allow them to overwrite the instantiated object's properties and sequence of operations.

5.4 Product avalible

Read and write to the correct database according to the object passed further expanding the base will make it simple to copy AccountProducts "blueprint" of the methods available, and add customer products as needed.

5.5 Product Factory

When adding a new Product to the roster, the only place that needs to add code is in the ProductFactory below, adding a new dictionary item such as: '"Homeloan": HomeloanAccount()' and adding a new object with related procures above. An example of a loosely coupled design is closed for modification but open for extension.

5.6 Product Functions

This acts interface to the more complex module, abstracting functionally for ease of use in the rest of the program.

5.7 Test block

Back to Table of Contents

6. Customer Benefits (Strategy Pattern or Abstract Factory)

6.1 Intro

The Membership benefits in this implementation are a strategy pattern using polymorphism to dynamically change between the befits packages. However, this will only impact the base rate of interest and be passed on to other aspects of the software, maybe also allowing some limited functions like adding special accounts for gold users.

If the "membership status" is planned to significantly impacts all states of the objects in the future, an implementation with an abstract factory would be better suited for that scenario, thus allowing the instantiated membership to determine the sequence of the rest of the objects.

6.2 class diagram

title1

6.3 Membership Abstract class

6.4 Memberships

Simple membership method that passes a weight on interest.

6.5 Membership

6.6 Test block

Back to Table of Contents

7. Interfaces (Facade pattern)

7.1 Intro section

This section is split into multiple interfaces that interconnect the loosely coupled objects primarily incorporating the following design principles:

As all modules demonstrated above function individually, the purpose interfaces below are simply interactions between all the elements of the program. Thus incorporating the befits of the Facade pattern essentially masks the complex underlying structure. The interfaces themselves are also loosely coupled in the sense each choice you make will take you to the next object interface, all can be replaced for a desktop system or webpage.

7.2 class diagram

title1

7.3 Interface Loan

Allows for iteraction with the different loan approvals

7.4 Test Loan Interface

Remove "#" if you want to try this interface separately from the others.

7.5 Interface Accounts

Prints statement and allow user to navigate through menus

Back to Table of Contents

7.6 Test Accounts Interface

Remove "#" if you want to try this interface separately from the others.

7.7 Interface Bankmain

Allows for iteraction with the different loan approvals

7.8 Test BankMain Interface

Remove "#" if you want to try this interface separately from the others.

7.9 Interface Login

Back to Table of Contents

8. Conclusion

8.1 Last words

The necessity to ensure that the banking system not only functions as per the needs of the current client base but also ensures flexibility to grow and develop as new needs arise or technology matures.

A project of this scale requires a fair amount of planning when combining design patterns and principles that are the foundation of good object-oriented programming. The different parts of the program that are presented, all require different approaches to ensure the best possible user experience. This can therefore cannot be a one size fits all scenario, but applying the fundamentals of OOP will increase the probability of avoiding a complete rework of the system in the future.

8.2 Test All Interfaces

Remove "#" if you wish to Run the login interface that runs all the demo parts of the program.

Back to Table of Contents