This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LoyaltyCardService { | |
| // constructor removed for brevity's sake | |
| void addPoints(int id, int points) { | |
| LoyaltyCard card = //... find card by id in db | |
| card.addPoints(points); | |
| // persist the LoyaltyCard | |
| } | |
| void removePoints(int id, int points) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LoyaltyCard { | |
| private int id; | |
| private int balance; | |
| private int cardType; | |
| // getter, constructor removed for brevity's sake | |
| void addPoints(int points) { | |
| int extraPoints = 0; | |
| if (cardType == 1) extraPoints = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LoyaltyCardService { | |
| // constructor removed for brevity's sake | |
| void addPoints(int id, int points) { | |
| LoyaltyCard card = //... find card by id in db | |
| card.balance += points; | |
| // persist the LoyaltyCard | |
| } | |
| void removePoints(int id, int points) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LoyaltyCard { | |
| private int id; | |
| private int balance; | |
| // getter, constructor removed for brevity's sake | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Garage { | |
| Plane plane; | |
| public void leaveGarage() { | |
| ... | |
| plane.isPilotAllowedToFly(); // Not Allowed!! ... because | |
| ... | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| APIClient client = anAPIClientBuilder() | |
| .withHost("..") // Rule #4 | |
| .withAppKey("..") // Rule #4 | |
| .withSecretKey("..") // Rule #4 | |
| .build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| car.getOwner().getAddress().getStreet(); | |
| // or | |
| Owner owner = car.getOwner(); | |
| Address ownerAddress = owner.getAddress(); | |
| Street ownerStreet = ownerAddress.getStreet(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DBConnection { | |
| private static int MAX_CONNECTION = 1; | |
| private DbConnectionFactory factory; | |
| public void close() { | |
| ... | |
| clear(); // Allowed Rule #1 | |
| ... | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM nginx:1.16.0-alpine | |
| COPY --from=builder /dist /usr/share/nginx/html | |
| EXPOSE 80 | |
| CMD ["nginx", "-g", "daemon off;"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM openjdk:8-jdk-alpine | |
| COPY --from=MAVEN_TOOL_CHAIN /tmp/target/io-app-service*.jar app.jar | |
| ENV JAVA_OPTS="" | |
| EXPOSE 8080 | |
| ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar |
NewerOlder