Should Html Formatting Be In A Database?

Welcome. Please Login, Register, Or Activate! 
type your username and password to login
Date: November 23, 2009, 01:56 PM
431264 members and 298326 Topics
Latest Member: labistadan
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Webmasters (Moderators: OmniPotens, yawa-ti-de)  |  Should Html Formatting Be In A Database?
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Should Html Formatting Be In A Database?  (Read 213 views)
yawa-ti-de (f)
Should Html Formatting Be In A Database?
« on: September 28, 2009, 01:38 AM »

So recently, I had a go at it with the db guy at work over this.  In the end, nothing changed short-term but I made my point and things will change long-term.  I have decided to share this with you for discussion:

At work, we are deploying some new code next week and as always, the testers are going full blast.  On one of the pages, we display an error message based on certain conditions.  Let's say the text says, "hello world".  In FF, the text shows up  correctly but in IE, it shows up as "hello worldd (note the extra "d").  The defect was assigned to me.

First thing I did was look at the file.  All it had was <%=error %> (We use JSP at work).  So I determine that it is java-based.  I get with the software guy but it isn't in there.  We then go to the db guy.  This is where I saw wonders.  It had html tags, surrounding the actual error text.  I then pasted the code in my text editor and validated it, only to find out that it was missing a closing SPAN tag.  I tell the db guy to insert the SPAN tag to which he responds (most likely cos he doesn't want to "suffer" to insert it in his script), "add it after the error print statement.  I got pissed.  I was like, "since you are the one adding html formatting in the db, what's to say that tomorrow you won't screw up again, making my SPAN tag useless.? Besides, during my code review, most likely, the question will be asked, "why do you have <%=error%></span>?  Why do you even have html and css in your db script?  That is my domain".

As I said, he didn't want to do anything short-term but long-term, it was decided that yes, it doesn't make sense for the db guy to be doing my job, so to speak.

So the question (in case I am missing something), "other than for when you are developing a cms app, does it make sense to add html and css formatting into a table column?  If no, why? If yes, why and give examples"

Let's discuss.

kolitos007
Re: Should Html Formatting Be In A Database?
« #1 on: September 28, 2009, 01:26 PM »

Quote from: yawa-ti-de on September 28, 2009, 01:38 AM
So recently, I had a go at it with the db guy at work over this.  In the end, nothing changed short-term but I made my point and things will change long-term.  I have decided to share this with you for discussion:

At work, we are deploying some new code next week and as always, the testers are going full blast.  On one of the pages, we display an error message based on certain conditions.  Let's say the text says, "hello world".  In FF, the text shows up  correctly but in IE, it shows up as "hello worldd (note the extra "d").  The defect was assigned to me.

First thing I did was look at the file.  All it had was <%=error %> (We use JSP at work).  So I determine that it is java-based.  I get with the software guy but it isn't in there.  We then go to the db guy.  This is where I saw wonders.  It had html tags, surrounding the actual error text.  I then pasted the code in my text editor and validated it, only to find out that it was missing a closing SPAN tag.  I tell the db guy to insert the SPAN tag to which he responds (most likely cos he doesn't want to "suffer" to insert it in his script), "add it after the error print statement.  I got pissed.  I was like, "since you are the one adding html formatting in the db, what's to say that tomorrow you won't screw up again, making my SPAN tag useless.? Besides, during my code review, most likely, the question will be asked, "why do you have <%=error%></span>?  Why do you even have html and css in your db script?  That is my domain".

As I said, he didn't want to do anything short-term but long-term, it was decided that yes, it doesn't make sense for the db guy to be doing my job, so to speak.

So the question (in case I am missing something), "other than for when you are developing a cms app, does it make sense to add html and css formatting into a table column? If no, why? If yes, why and give examples"

Let's discuss.



Interesting topic yawa, but I fail to understand your statement here, so am confused does it make sense to add html and css formatting into a table column?

Are you talkign about using either css or tables to create  columns, the topic should html formatting be in a database, what are you trying to say? So many different things at the same time,  Undecided
WebMonk (m)
Re: Should Html Formatting Be In A Database?
« #2 on: September 28, 2009, 02:06 PM »

It shouldn't. Not even the slightest "non belonging" slash  Grin. Defeats the goal of separating code from layout. But is damn-as-hell-convenient when done the first time. I've fumed over this in similar scenarios, CMSes in particular. At the very least, the top level elements should not be included in the Database.
yawa-ti-de (f)
Re: Should Html Formatting Be In A Database?
« #3 on: September 28, 2009, 03:14 PM »

kolitos:
For the 3rd time, you fail to understand.  I am beginning to think this is a trend and am considering not engaging in any thread for which you are a direct respondent.  Obviously, I am not going crazy cos at least one person understands me and answered the question perfectly.  Speaking of which:

webmonk:
Thank God you are still alive.  I was beginning to get worried.  Thanks for your input.  You echoed my thoughts verbatim Smiley

kolitos:
On second thoughts, I will attempt to make you understand:

Here is the code that was in the errors column:
<span><span><strong>you have reached this page in error</strong></span> - note the missing </span> tag

My point:
Why not just have the "you have reached this page in error" text in the appropriate column and let me determine, via html and css, how to best display this message (for example, to me the front end "skills" of the db guy, based on the html I just put up there, SUCK

Does this help, my dear friend?  Tongue
webdezzi (m)
Re: Should Html Formatting Be In A Database?
« #4 on: September 28, 2009, 03:28 PM »

@yawa, now i understand your question.

depends on the situation at hand, if u have a site with a backend that enables admin to create html pages, then u have no option but to save your full html pages in your DB. but if they wont be creating html pages, why save html in the DB?

as per the formatting issue, i think your organization needs to google more, removing a "d" programmatically MAY break your code when another upgrade comes out for your platform (u know what i mean)
yawa-ti-de (f)
Re: Should Html Formatting Be In A Database?
« #5 on: September 28, 2009, 03:34 PM »

webdezzi:

The "d" wasn't programmatically removed.  The HTML was wrong (note the lack of a second </span> at the end).  By adding the 2nd closing </span>, the "d" "disappeared" and the page is showing up correctly.

Thanks, and thanks for your input on when you may have no choice but to add html formatting to db table columns.
Afam (m)
Re: Should Html Formatting Be In A Database?
« #6 on: September 28, 2009, 03:44 PM »

No.  Because it simply does not make any sense. Presentation level work should be done by those that are well suited to do so.
kolitos007
Re: Should Html Formatting Be In A Database?
« #7 on: September 28, 2009, 04:47 PM »

Quote from: Afam on September 28, 2009, 03:44 PM
No.  Because it simply does not make any sense. Presentation level work should be done by those that are well suited to do so.

Well said Afam, but to be honest, I don't think you will have any problems if you separate your code from html, maybe using smarty.
nolongTing
Re: Should Html Formatting Be In A Database?
« #8 on: September 30, 2009, 04:40 PM »

Quote from: yawa-ti-de on September 28, 2009, 01:38 AM
At work, we are deploying some new code next week and as always, the testers are going full blast.  On one of the pages, we display an error message based on certain conditions.  Let's say the text says, "hello world".  In FF, the text shows up  correctly but in IE, it shows up as "hello worldd (note the extra "d").  The defect was assigned to me.

First thing I did was look at the file.  All it had was <%=error %> (We use JSP at work).  So I determine that it is java-based.  I get with the software guy but it isn't in there.  We then go to the db guy.  This is where I saw wonders.  It had html tags, surrounding the actual error text.  I then pasted the code in my text editor and validated it, only to find out that it was missing a closing SPAN tag.  I tell the db guy to insert the SPAN tag to which he responds (most likely cos he doesn't want to "suffer" to insert it in his script), "add it after the error print statement.  I got pissed.  I was like, "since you are the one adding html formatting in the db, what's to say that tomorrow you won't screw up again, making my SPAN tag useless.? Besides, during my code review, most likely, the question will be asked, "why do you have <%=error%></span>?  Why do you even have html and css in your db script?  That is my domain".

As I said, he didn't want to do anything short-term but long-term, it was decided that yes, it doesn't make sense for the db guy to be doing my job, so to speak.


1. Coding standards need to be established for every project in order to avoid this kind of uncertainty, where was your project manager?


Quote from: yawa-ti-de on September 28, 2009, 01:38 AM
So the question (in case I am missing something), "other than for when you are developing a cms app, does it make sense to add html and css formatting into a table column?  If no, why? If yes, why and give examples"

Let's discuss.



2.  html? YES if the data to be marked up is strictly presentation data;  for example populating a drop down list (<select>) from the database with option groups.
     Css in a database NO!!!!!!!!!

3.  NO if the data is not presentation data; for example client details.

hostmot (f)
Re: Should Html Formatting Be In A Database?
« #9 on: October 01, 2009, 12:54 PM »

There should be no reason why html formatting should take place in a database.

The database should be allowed to do what it knows how to do best; store and give data. It should not partake in the user interface process.

A company like yours should be using something like the MVC development pattern.

Html in the database will most definitely complicate things when you are trying to add ajax to spice things up.

Olawunmi,
Hostmot Sales Rep. (www.hostmot.com)
WebMonk (m)
Re: Should Html Formatting Be In A Database?
« #10 on: October 02, 2009, 08:33 AM »

^^@hostmot

Exellent contribution to the thread. Offtopic, besides using table-less format for your website, Commenting in your mother's tongue really has me inspired this early in the morning.
yawa-ti-de (f)
Re: Should Html Formatting Be In A Database?
« #11 on: October 02, 2009, 03:21 PM »

hostmot: <!-- Ipari oke --> - he he  Tongue

nolongting:
I personally do not know of any deployment or testing that goes 100% smoothly, not to talk of a page that is coded the first time around being without at least 1 error.  If you are aware, please let me know.  I don't mind putting in a word or two for such a person and if necessary, have my employers sponsor the person's work visa  Tongue

On a more serious note though, all it was was an extra "d".  The site still functions as designed.  Is a typo bad? sure but it isn't the end of the world, compared to say, a blank page showing up.
hostmot (f)
Re: Should Html Formatting Be In A Database?
« #12 on: October 02, 2009, 05:58 PM »

@webmonk

Its just the comments that you saw. You didnt notice the id attributes of the structural divs. It was done by our support guy. Thats our Bill Cosby.

@yawa-ti-de
You don't need to recommend that kinda coder to your company, Microsoft or Google would have snapped him up. Smiley
yawa-ti-de (f)
Re: Should Html Formatting Be In A Database?
« #13 on: October 02, 2009, 06:02 PM »

hostmot, tru dat  Tongue

nolongting:
I missed the part of your post about coding standards.  This is and should be within the domain of responsibility of the coders, not the project manager.  It is the coder's manager that is and should be in charge of this.  A PM, in an ideal company (not one where one is made to do everything including the kitchen sink) should only coordinate the different pieces of a project from an oversight level and not micromanage.
askphantom (m)
Re: Should Html Formatting Be In A Database?
« #14 on: October 02, 2009, 11:50 PM »

No.

I believe all your formatting should be handled outside the db. This seperates content from design.

To start with, i might get entagled in a web just like you did and start editing my db when trying to fix it. You db is just meant to store information and display when and where needed. Your css decides how it should look like.

just my thoughts.   Grin
yawa-ti-de (f)
Re: Should Html Formatting Be In A Database?
« #15 on: October 03, 2009, 12:55 PM »

all in all, these are excellent comments. In fact, ever since I started posting "non site review" posts, this is probably the best in terms of number of posts, quality of posts, the fact that there is no wrestlemania going on, etc.  Please keep it up.

As I stated on the thread from cactus who would like to meet with his nigerian peers on october 10, I think the quality will get even better when we get to see each other face to face and get a personal feel for each other.  Sometimes, though the answer (as in this case) is crystal clear, it is still good to hear from the other side, provided their arguments (again, as in this case) are sound and devoid of insults, egos, etc.

Again, please keep it up!
OmniPotens (m)
Re: Should Html Formatting Be In A Database?
« #16 on: October 03, 2009, 07:25 PM »

I'm personally working out a small CMS application and I noticed that it is not really a nice option saving HTML tags to the DB because most times it conflicts with the HTML formatting on the web pages. Though I still think you could add them into posts body for formatting the texts. I said this based on my coding anyway. I used a simple textarea without any WYSIWYG editor integrated. But I'll try integrate one and see if there will be any difference.
*dhtml
Re: Should Html Formatting Be In A Database?
« #17 on: October 04, 2009, 10:44 PM »

Now this is getting interesting. . .
Holumighty (m)
Re: Should Html Formatting Be In A Database?
« #18 on: October 15, 2009, 04:48 AM »

Please i need html and web design tutor.
 Make Money With Your Website  What does Joomla requires?  Participation On Web 2.0 Sites Remains Weak  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 


Sections: Autos/Cars (2) Jobs/Vacancies (2) (3) Career Talk Education General(2) Politics Romance Computers Phones Travel
Sports Fashion Health Religion Celebrities TV/Movies (2) Music/Radio (2) Books Webmasters Programming

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa. See also: Nairalist Classified Ads
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.