Java Design Questions - Class, Function, Access Modifiers
Posted
by Ron
on Stack Overflow
See other posts from Stack Overflow
or by Ron
Published on 2010-05-04T23:48:13Z
Indexed on
2010/05/04
23:58 UTC
Read the original article
Hit count: 418
I am newbie to Java. I have some design questions.
Say I have a crawler application, that does the following: 1. Crawls a url and gets its content 2. Parses the contents 3. Displays the contents
How do you decide between implementing a function or a class? -- Should the parser be a function of the crawler class, or should it be a class in itself, so it can be used by other applications as well? -- If it should be a class, should it be protected or public class?
How do you decide between implementing a public or protected class? -- If I had to create a class to generate stats from the parsed contents for eg, should that class be protected (so only the crawler class can access it) or should it be public?
Thanks Ron
© Stack Overflow or respective owner