dimanche 23 octobre 2016

about oriented design & procedure oriented design

I have very basic question on object oriented design. What is better object oriented design or procedure oriented design?

Consider an example.

I design a util to send mail based on some parameters. If i design procedure oriented way i will do like this.

MailUtil.sendMail(String username, String passwork, String subject, String message, String toList, String bccList, ...)

If i design this as object oriented way i will go like below

MailUtil.sendMail(IMailContentProducer)

definition of IMailContentProducer
interface IMailContentProducer {
     String getUserName(),
     String getPassword(), 
     String getSubject(),
     String getSubject(),
     String getToList(), 
    //etc...
}

Aucun commentaire:

Enregistrer un commentaire