If a design pattern has been used in a class, should the comments at the top of the class or at the top of a relevant method explain the specific design pattern used or the actual functionality.
i.e.
/**
* Class MyClass
*
* Utilizes Factory Method patter to accomplish xyz
*/
or
/**
* Class MyClass
*
* Allows the creation of objects for xyz
*/
This is extremely simplified to illustrate
The main part of my query is whether to rely on other people wondering what design patterns were used, or if it may come across like being a smart arse by just saying what design pattern was used
The common practice is to name your classes (ie XyzFactory) so it's easy to see what pattern you use and give the actual funcionality in the comment, preferably more descriptive than only describing what the design pattern already does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With