Refactor: Remove unused imports and add final where it should be
This commit is contained in:
@@ -1,25 +1,9 @@
|
|||||||
package decorator;
|
package decorator;
|
||||||
|
|
||||||
import entities.Notification;
|
import entities.Notification;
|
||||||
import notificationsDecorations.NotificationDecoration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ces approches ne seront pas implémentées ici, car elles pourraient alourdir le code sans apport clair.
|
|
||||||
* Par exemple, un builder pourrait être utile pour construire des notifications (objets complexes),
|
|
||||||
* ou des stratégies pourraient être envisagées pour des fonctionnalités comme la datation.
|
|
||||||
* Les design patterns ne sont pas des solutions universelles : leur utilisation doit être justifiée par un besoin concret.
|
|
||||||
|
|
||||||
* Le code actuel ne respecte pas pleinement les principes SOLID, ce qui peut rendre sa maintenance plus difficile.
|
|
||||||
* L'ajout de patterns comme le Singleton (considéré comme un anti-pattern dans certains contextes,
|
|
||||||
* notamment parmi les principes STUPID) ne résoudrait pas nécessairement ces problèmes.
|
|
||||||
|
|
||||||
* Pour s'entraîner, les Katas sont une excellente alternative : ce sont des exercices simples et variés,
|
|
||||||
* idéaux pour explorer les design patterns de manière propre et progressive.
|
|
||||||
* Ils permettent aussi de comparer différentes solutions pour un même problème, ce qui est très formateur !
|
|
||||||
*/
|
|
||||||
public abstract class BaseDecorator {
|
public abstract class BaseDecorator {
|
||||||
protected Notification notification;
|
protected Notification notification;
|
||||||
protected NotificationDecoration decoration;
|
|
||||||
|
|
||||||
public BaseDecorator(Notification notification) {
|
public BaseDecorator(Notification notification) {
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package notificationsDecorations;
|
package notificationsDecorations;
|
||||||
|
|
||||||
import entities.Notification;
|
|
||||||
|
|
||||||
public abstract class NotificationDecoration {
|
public abstract class NotificationDecoration {
|
||||||
/**
|
/**
|
||||||
* Each decoration apply a transformation on the content of the Notifications
|
* Each decoration apply a transformation on the content of the Notifications
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package notificationsDecorations;
|
package notificationsDecorations;
|
||||||
|
|
||||||
public class WatermarkNotificationDecoration extends NotificationDecoration {
|
public class WatermarkNotificationDecoration extends NotificationDecoration {
|
||||||
private String waterMark;
|
private final String waterMark;
|
||||||
|
|
||||||
public WatermarkNotificationDecoration(String waterMark) {
|
public WatermarkNotificationDecoration(String waterMark) {
|
||||||
this.waterMark = waterMark;
|
this.waterMark = waterMark;
|
||||||
|
|||||||
Reference in New Issue
Block a user