Compare commits
11 Commits
all-contri
...
all-contri
Author | SHA1 | Date | |
---|---|---|---|
|
d584404df6 | ||
|
353a2d9fcf | ||
|
a1c96ede13 | ||
|
0d2c4abe5a | ||
|
e7e3ace01f | ||
|
41dacc2e2e | ||
|
dc7bf6190d | ||
|
98d2dc0104 | ||
|
870d44b127 | ||
|
834f20911b | ||
|
b91bbc773d |
@@ -1102,6 +1102,25 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "RayYH",
|
||||
"name": "洪月阳",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/41055099?v=4",
|
||||
"profile": "https://rayyounghong.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "xdvrx1",
|
||||
"name": "xdvrx1",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/47092464?v=4",
|
||||
"profile": "https://xdvrx1.github.io/",
|
||||
"contributions": [
|
||||
"review",
|
||||
"ideas"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 4,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
[](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
# Introduction
|
||||
@@ -250,6 +250,8 @@ This project is licensed under the terms of the MIT license.
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://www.linkedin.com/in/ashish-trivedi-218379135/"><img src="https://avatars3.githubusercontent.com/u/23194128?v=4" width="100px;" alt=""/><br /><sub><b>Ashish Trivedi</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=ashishtrivedi16" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://rayyounghong.com"><img src="https://avatars1.githubusercontent.com/u/41055099?v=4" width="100px;" alt=""/><br /><sub><b>洪月阳</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=RayYH" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://xdvrx1.github.io/"><img src="https://avatars0.githubusercontent.com/u/47092464?v=4" width="100px;" alt=""/><br /><sub><b>xdvrx1</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3Axdvrx1" title="Reviewed Pull Requests">👀</a> <a href="#ideas-xdvrx1" title="Ideas, Planning, & Feedback">🤔</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@@ -45,7 +45,7 @@ public final class InitializingOnDemandHolderIdiom {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sigleton instance.
|
||||
* Singleton instance.
|
||||
*
|
||||
* @return Singleton instance
|
||||
*/
|
||||
|
@@ -16,10 +16,12 @@ request from the presentation.
|
||||
## Explanation
|
||||
|
||||
Real world example
|
||||
|
||||
> You need to create a hotel room booking system. Since the requirements are quite simple we intend
|
||||
> to use the Transaction Script pattern here.
|
||||
|
||||
In plain words
|
||||
|
||||
> Transaction Script organizes business logic into transactions that the system needs to carry out.
|
||||
|
||||
Programmatic example
|
||||
@@ -80,15 +82,9 @@ The `Hotel` class has two methods, one for booking and cancelling a room respect
|
||||
them handles a single transaction in the system, making `Hotel` implement the Transaction Script
|
||||
pattern.
|
||||
|
||||
```
|
||||
public void bookRoom(int roomNumber);
|
||||
```
|
||||
The `bookRoom` method consolidates all the needed steps like checking if the room is already booked
|
||||
or not, if not booked then books the room and updates the database by using the DAO.
|
||||
|
||||
```
|
||||
public void cancelRoomBooking(int roomNumber)
|
||||
```
|
||||
The `cancelRoom` method consolidates steps like checking if the room is booked or not,
|
||||
if booked then calculates the refund amount and updates the database using the DAO.
|
||||
|
||||
|
Reference in New Issue
Block a user