Page 2 of 2
Posted: Sun Jul 30, 2006 7:43 pm
by neophyte
BTW I'm pulling next_image and previous image into the file_data class.
Posted: Sun Jul 30, 2006 7:57 pm
by Christopher
Just a quick cut at your list (and probably wrong) but here is what they seem like to me.
View/View Helper (application specific)
message -- returns a string with paragraph tags for some information to the user
gallery_name -- returns a the title of the gallery with h2 tags
set_footer - generates an html string
Library Classes (general purpose)
set_navigation (pagination) -- creates pagination (html links)
next_image returns a link to the next image
previous_image returns a link to the previous image
make_select - generates html selector
make_switch - generates more different html selector
bread_crumb -generates html link string
make_querystr (makes links) -- makes links
Helper Function
format_string -pulls underscores out of directory and image names
Posted: Sun Jul 30, 2006 8:11 pm
by neophyte
Is there any danger that a library or helper class might devolve into "smelly code"? How do you know when it has crossed the line?
Library Classes (general purpose)
Are you suggesting separate classes for these functionalities?
Posted: Sun Jul 30, 2006 8:39 pm
by Christopher
neophyte wrote:Are you suggesting separate classes for these functionalities?
Not for each one, but Pagination, HTML Form FIeld, URL and Bread Crumb classes are very common. I have seen many different programmers build/use them and they are pretty similar from my experience.
Posted: Sun Jul 30, 2006 8:53 pm
by neophyte
I'm starting to see the rational. So "html_generator" is too broad because it doesn't really generate all html. So better to brake them into small classes or functions. At least their names will mean a bit more that way. Hmmmm, I think I like. Certainly no one pointed the "God Class" finger at a small class with a single purpose.