Comments on: First Look: Object Oriented CSS http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/ News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com. Mon, 23 Nov 2009 10:06:45 -0500 http://wordpress.org/?v=2.8.4 hourly 1 By: Anonymous http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927301 Anonymous Mon, 22 Jun 2009 14:33:37 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927301 I think pretty much everyone hates the misnomer "OO", but the idea is definitely intriguing. I saw an article a while back about writing CSS this way, so I know it's not necessarily a new idea, but I've never really seen an in-depth discussion of it, just little "hey try it this way" articles. Seems like this style is best suited to cases when a designer won't always be intimately familiar with the CSS, isn't changing it on a daily basis, will be re-visiting projects after several weeks or months, etc. If you're very focused on a small number of properties and working with the CSS of each on a very frequent basis, then you could probably skip this method of coding. I think pretty much everyone hates the misnomer “OO”, but the idea is definitely intriguing. I saw an article a while back about writing CSS this way, so I know it’s not necessarily a new idea, but I’ve never really seen an in-depth discussion of it, just little “hey try it this way” articles.

Seems like this style is best suited to cases when a designer won’t always be intimately familiar with the CSS, isn’t changing it on a daily basis, will be re-visiting projects after several weeks or months, etc.

If you’re very focused on a small number of properties and working with the CSS of each on a very frequent basis, then you could probably skip this method of coding.

]]>
By: Eyveneen http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927223 Eyveneen Sat, 20 Jun 2009 16:18:40 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927223 or just have seperate stylesheets and use the @import rule or just have seperate stylesheets and use the @import rule

]]>
By: DAZ http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927208 DAZ Sat, 20 Jun 2009 06:36:13 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927208 @elpie I agree with you that the structure of OOCSS is very complex (I had a look at the source and couldn't believe how many files and folders there were!) As I said above though, I don't think the lack of semantics is an issue - a framework by definition cannot know the context in which the class will be used in advance, so cannot give a class name that will be semantic for everybody. I have found the best thing to do is just use a class name that describes what it does. So if your class transforms a list of links into tabs, just call the class 'tabs'. At least then the designers/developers know what that class is there for. @elpie

I agree with you that the structure of OOCSS is very complex (I had a look at the source and couldn’t believe how many files and folders there were!)

As I said above though, I don’t think the lack of semantics is an issue – a framework by definition cannot know the context in which the class will be used in advance, so cannot give a class name that will be semantic for everybody.

I have found the best thing to do is just use a class name that describes what it does. So if your class transforms a list of links into tabs, just call the class ‘tabs’. At least then the designers/developers know what that class is there for.

]]>
By: elpie http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927178 elpie Fri, 19 Jun 2009 15:16:58 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927178 I had an indepth look at this some time back and, like others, fail to see how it can be called OO. While I appreciate that a lot of work is going into it, there are some serious shortcomings that make the claim of "maintainable" a bit misleading. "Reusable" - maybe, but then anyone experienced with HTML/CSS, especially in a team environment, is already reusing code anyway. Any "framework" that specifies the use of classes with meaningless names such as "unit size2of3 lastUnit" and which, while <em>claiming to be a CSS framework</em>, states that its non-semantic classes should be inserted via a serverside script or JavaScript (huh?) just isn't worth taking seriously. Others have mentioned semantics - what on earth is semantic about classes such as gMail, gCal, yahoo, myYahoo, oldSchool and the like? Anyone wanting semantic output would not touch OOCSS. Ideal in a team environment? Maybe, if the team keeps a reference guide handy to explain the jargon. With no source order, no semantic document structure, and no apparent consideration for accessibility, OOCMS has a very long way to go before it should be considered worthy of promotion by SitePoint. I had an indepth look at this some time back and, like others, fail to see how it can be called OO. While I appreciate that a lot of work is going into it, there are some serious shortcomings that make the claim of “maintainable” a bit misleading. “Reusable” – maybe, but then anyone experienced with HTML/CSS, especially in a team environment, is already reusing code anyway.

Any “framework” that specifies the use of classes with meaningless names such as “unit size2of3 lastUnit” and which, while claiming to be a CSS framework, states that its non-semantic classes should be inserted via a serverside script or JavaScript (huh?) just isn’t worth taking seriously.

Others have mentioned semantics – what on earth is semantic about classes such as gMail, gCal, yahoo, myYahoo, oldSchool and the like? Anyone wanting semantic output would not touch OOCSS.
Ideal in a team environment? Maybe, if the team keeps a reference guide handy to explain the jargon.

With no source order, no semantic document structure, and no apparent consideration for accessibility, OOCMS has a very long way to go before it should be considered worthy of promotion by SitePoint.

]]>
By: DAZ http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927152 DAZ Fri, 19 Jun 2009 09:11:06 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927152 I think lots of other people have covered the fact that this is not OOP and the name certainly implies it is linked in some way. This causes some potential for confusion. The name has managed to generate lots of interest, however, so from a marketing point of view it was an excellent choice. This is really just a 'modular' approach to CSS, which I would consider best practice anyway. The discussion it has generated has made for some really interesting comments, so in that respect this is surely a good thing. I'm not sure it needed a whole framework and code built around it. It is just a methodology and should be discussed in that sense. As a methodology, this contains some good ideas. People should definitely be trying to create more reusable CSS. It is a fact that many website contain largely similar items - tabs, vertical nav, sidebars,headers,comments etc. It would make sense to create some classes that could be used to style these elements quickly. I'm sure a lot of people just copy and paste from the last project, but this methodolgy would advocate creating some reuasable 'modules' with consistent naming conventions, markup paterns and classnames. The arguments that the class names are unsemantic doesn't hold water. Using unsemantic class names doesn't lose any semantic meaning, it just doesn't add any either. If you're really concerned about it, why not just add some extra class names that ARE semantic? The fact is that if you are creating reusable code, you can't predict in what context it will be used in future, so the best choice for a class name would be something that describes what it does. I wrote a blog post about this a while ago (http://dazzl.co.uk/blog/don-t-sweat-the-unsemantic-stuff). I think lots of other people have covered the fact that this is not OOP and the name certainly implies it is linked in some way. This causes some potential for confusion.

The name has managed to generate lots of interest, however, so from a marketing point of view it was an excellent choice.

This is really just a ‘modular’ approach to CSS, which I would consider best practice anyway.

The discussion it has generated has made for some really interesting comments, so in that respect this is surely a good thing. I’m not sure it needed a whole framework and code built around it. It is just a methodology and should be discussed in that sense.

As a methodology, this contains some good ideas. People should definitely be trying to create more reusable CSS. It is a fact that many website contain largely similar items – tabs, vertical nav, sidebars,headers,comments etc. It would make sense to create some classes that could be used to style these elements quickly. I’m sure a lot of people just copy and paste from the last project, but this methodolgy would advocate creating some reuasable ‘modules’ with consistent naming conventions, markup paterns and classnames.

The arguments that the class names are unsemantic doesn’t hold water. Using unsemantic class names doesn’t lose any semantic meaning, it just doesn’t add any either. If you’re really concerned about it, why not just add some extra class names that ARE semantic? The fact is that if you are creating reusable code, you can’t predict in what context it will be used in future, so the best choice for a class name would be something that describes what it does. I wrote a blog post about this a while ago (http://dazzl.co.uk/blog/don-t-sweat-the-unsemantic-stuff).

]]>
By: prince_mallow http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927129 prince_mallow Thu, 18 Jun 2009 19:04:35 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927129 WOW! I usually get very defensive when I start reading an article that suggests different CSS stylings. I also at times really hate CSS for it's multitudes and multitudes of never ending script on a page. I never thought of separating the design aspects from the functionality aspects like that. It is something I will have to try. Enjoyed the article. Truly sorry for the other commenters getting hung up on the word object oriented. It's really just an inspiration from it's concept. WOW! I usually get very defensive when I start reading an article that suggests different CSS stylings. I also at times really hate CSS for it’s multitudes and multitudes of never ending script on a page. I never thought of separating the design aspects from the functionality aspects like that. It is something I will have to try. Enjoyed the article. Truly sorry for the other commenters getting hung up on the word object oriented. It’s really just an inspiration from it’s concept.

]]>
By: McGivrer http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927118 McGivrer Thu, 18 Jun 2009 13:02:41 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927118 Yes, this CSS implementation is not exactly Object orientation, but this utilization have benefit of the DOM hierarchical structure and the inheritance capability of the Cascade Styles Sheets. I Mean, the tag <code>BODY</code> is parent of all <code>DIV</code> tags of your page, so any <code>DIV</code> element "classified" with any CSS class will benefit of any <code>BODY</code> CSS class applied. (Am I clear ? I am not sure, but it's the idea, and it's a good one !) Thanks to the SitePoint Team to broadcast Good(Best?) practices to avoid monstrous CSS class definition file and incomprehensible. Yes, this CSS implementation is not exactly Object orientation, but this utilization have benefit of the DOM hierarchical structure and the inheritance capability of the Cascade Styles Sheets.

I Mean, the tag BODY is parent of all DIV tags of your page, so any DIV element “classified” with any CSS class will benefit of any BODY CSS class applied. (Am I clear ? I am not sure, but it’s the idea, and it’s a good one !)

Thanks to the SitePoint Team to broadcast Good(Best?) practices to avoid monstrous CSS class definition file and incomprehensible.

]]>
By: stubbornella http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927101 stubbornella Wed, 17 Jun 2009 23:41:19 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927101 Oops, the video embed only works in preview mode. Here is the <a href="http://www.stubbornella.org/content/2009/03/23/object-oriented-css-video-on-ydn/" rel="nofollow">OOCSS video</a> Cheers, Nicole Oops, the video embed only works in preview mode. Here is the OOCSS video

Cheers,
Nicole

]]>
By: stubbornella http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927099 stubbornella Wed, 17 Jun 2009 23:38:52 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927099 Great article and introduction to OOCSS! Thanks! Some of you haven't really <a href="http://wiki.github.com/stubbornella/oocss" rel="nofollow">looked at the OOCSS code</a> before commenting... the class names you bring up don't appear anywhere. :) @Jez You are absolutely right, it would be much better if browser supported inheritance within the CSS itself. More on that later. Calling it OO may irk some of you, but it doesn't need to be .net, php, or js in order to be OO. In fact, in order to be object-oriented CSS it needs to specifically be CSS and do what CSS was intended to do, which is style web pages. It has many of the components of OO including encapsulation, inheritance, polymorphism, modularity, abstraction. No, it doesn't have methods. CSS doesn't need methods. The cool thing about the cascade is that you can do things like multiple inheritance, that would be a mess in ordinary programming, but with the cascade are neatly taken care of. Keep in mind that this article is an intro, a dip into the subject rather than the full treatment. You might also want to check out this video on the subject or <a href="http://wiki.github.com/stubbornella/oocss" rel="nofollow">at least look at the code</a>. Great article and introduction to OOCSS! Thanks! Some of you haven’t really looked at the OOCSS code before commenting… the class names you bring up don’t appear anywhere. :)

@Jez You are absolutely right, it would be much better if browser supported inheritance within the CSS itself. More on that later.

Calling it OO may irk some of you, but it doesn’t need to be .net, php, or js in order to be OO. In fact, in order to be object-oriented CSS it needs to specifically be CSS and do what CSS was intended to do, which is style web pages. It has many of the components of OO including encapsulation, inheritance, polymorphism, modularity, abstraction. No, it doesn’t have methods. CSS doesn’t need methods.

The cool thing about the cascade is that you can do things like multiple inheritance, that would be a mess in ordinary programming, but with the cascade are neatly taken care of.

Keep in mind that this article is an intro, a dip into the subject rather than the full treatment. You might also want to check out this video on the subject or at least look at the code.

]]>
By: michai http://www.sitepoint.com/blogs/2009/06/16/first-look-object-oriented-css/comment-page-2/#comment-927097 michai Wed, 17 Jun 2009 23:31:57 +0000 http://www.sitepoint.com/blogs/?p=10974#comment-927097 Who ever said this was OOP? It's just object-oriented. Conceptually. Do you take *everything* this literally? Spend a few minutes looking into it before whining about what a horrible atrocity the name is, it's nothing new, etc. In other news, Mozilla Firefox isn't _actually_ a small furry critter who loves in forests. Who ever said this was OOP? It’s just object-oriented. Conceptually. Do you take *everything* this literally?

Spend a few minutes looking into it before whining about what a horrible atrocity the name is, it’s nothing new, etc.

In other news, Mozilla Firefox isn’t _actually_ a small furry critter who loves in forests.

]]>