Tuesday, December 14, 2010

Horrible CSS

This is wrong.

<div class="wid200 text_right border_top pad3">
<div class="clear">
...

Basically, authoring CSS like this is the same way people authored HTML before stylesheets. You are explicitly itemizing style hierarchically and ignoring encapsulation and the semantic bridge that CSS is meant to provide. If you prefer to code like this, You should probably actually write like this

<big>
<big>
<br> <br> <br> <br>
<font color=red>
<strong>
Markup like this, in circa 1996 style --- because when you are explicit
with every style declaration, you are doing the Exact Same
Thing.
</strong>
</font>
and I wrote code like this, it was the mid 90s ... I used Navigator 3.04 gold,
and connected to the internet via 14400 bps. We've moved one.
</big>
If you ever profess that you do "MVC" and then code like this, you are
just using buzzwords and totally mistaken. End of story.
</big>


Here is what a good piece of CSS would look like
<span class="profile cta container">
<button onclick=dosomething()>Something</button>


The Most Important Thing here is to notice that the class does not dictate a layout or a style - it dictates a higher level, encapsulated, semantic meaning for the content. If you want consistency in layout, design, and theme; this is what it should look like. Then when you do your JS coding, using your fancy jquery, you do

$(".profile .cta button")

And you don't have to add an additional id tag to reference the section semantically. The principle here is simple:

De-couple, but do not de-correlate

Sunday, December 5, 2010

Enterprise Database is

Using a number in a state column that corresponds to a 5 field state table, that is cross referenced to a country table that has 8 fields so that you have to 3 table joins in order to get from "20183" to "CA". Here? you want the billing address I know how to do that!

select users.FirstName || ' ' || users.LastName,
Ship.AddressLine1, Ship.AddressLine2,
Country.State, State.PostalRegion, Country.name from
users as users
join ShippingAddress as Ship on users.ID = Ship.UserID
join State as state on Ship.StateCode = state.stateID
join Country as country on state.countryId = Country.code
where users.ID = '101';

That was so easy and totally necessary. You know things are done Right when a 12-core machine takes 15 seconds to produce a page full of addresses; cause that's how long it took in 1975; when a kilobyte of memory set you back $10,000.

Followers