How to decide to which class does a method belong
Posted
by
Eleeist
on Programmers
See other posts from Programmers
or by Eleeist
Published on 2013-10-18T16:00:17Z
Indexed on
2013/10/18
16:11 UTC
Read the original article
Hit count: 185
I have TopicBusiness.class
and PostBusiness.class
. I have no problem with deciding into which class methods such as addPostToDatabase()
or getAllPostsFromDatabase()
should go. But what about getAllPostsFromTopic(TopicEntity topic)
or getNumberOfPostsInTopic(TopicEntity topic)
?
Should the parameter be the deciding factor? So when the method takes TopicEntity as parameter it should belong to TopicBusiness.class
? I am quite puzzled by this.
© Programmers or respective owner