http://www.perlmonks.org?node_id=390227


in reply to Code Conflation: Considered Harmful?

You have hit upon something most experienced developers call "Separation of Concerns". It's the underlying principle behind MVC - Model / View / Controller. (It's called by other names, but that's the most popular.) It was also a driving force behind creation of OO methodologies.

This is usually seen in Perl with the use of templating systems, like HTML::Template or Template Toolkit, for separation of Perl (business logic and engine, or Model / Controller) from output generation (View). Other distributions, such as SQL::Catalog, can help with the separation of SQL (data logic, or Model) from Perl (business logic and engine, or Model / Controller).

Many people, including myself, tend to provide for a different separation between HTML, CSS, and Javascript. I look at the View layer as generally composed of three elements:

Perl tends to not be involved with those at all, except for ease of maintenance in the assembly of the pieces. So, I tend to have different directories for each (/templates, /javascript, and /css). So, if I were truly separating out the five languages, I would have the following directories:

Most examples you tend to see are for complete newbies, who just want something to get them up and running quickly. The reason for that is that newbies need to have instant gratication, or they give up. Later, if they are interested, they will do what you're doing - come to those with experience and ask for advice. At that point, you'll improve your code. :-)

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested