Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SudhaLV/short-exercise-oop-encapsulation

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

A Short Exercise to Explore Object-Oriented Programming - Encapsulation


Overview

This repository is a short exercise designed for you to explore Encapsulation which is one of the four pillars of Object-Oriented Programming (OOP).


๐Ÿ“– Instructions

  • Fork this repository

  • To run the program, go to the Main class which is the entry point and run it using IntelliJ

  • There are two models DodgyBankAccount and SecureBankAccount, these are located in the model directory.


๐Ÿค“ Study Prompts

Use the following questions to guide your exploration and learning! ๐Ÿ—บ

  • Run the main method on the Main class, what is it doing? What is being outputted to the console?

  • Look at the DodgyBankAccount, this class is not well-encapsulated. Can you note down the problems with how the class is designed, and the ways it is being misused?

  • Compare and contrast the DodgyBankAccount and the SecureBankAccount, how is the SecureBankAccount different to the DodgyBankAccount? How is it designed to prevent it from being misused? Are there instances of better method names for clearer abstraction?

About

This is a short exercise using the example of bank accounts to demonstrate the importance of encapsulation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%