RSS
Facebook
Twitter

Monday, January 17, 2011

CSS for Developers: Horizontal Layout Using CSS

I'm a Java Developer.  But I'm also a Web Developer.  Web Developers have been so badly maligned over the last decade or so that I always feel wary (and sometimes slightly ashamed) admitting this.  There's some sort of assumption that Web Developers (and Front End Developers) aren't real programmers. Similarly, "real" developers don't like to be tainted by coming into contact with that nasty "front end stuff" in case someone mistakes them for a designer.

Trust me, no-one is going to mistake a Java Developer for a designer.  For a start, when designers wear geeky glasses it's ironic.  Or chic.  Or something.

But developers will be forced to do something around the front end at some point in their lives.  Even if it's because they're sick of manually kicking off some process and want to give the users a big red button to press instead.

So, as much to compensate for my own goldfish-like brain as anything else, I'm going to make a note of some of the CSS stuff I've used or found helpful during my mad scramblings to get the LMAX Trader user interface to a) look the way we wanted b) perform fast enough so our awesome back end performance wasn't totally invisible to the retail user and c) Not Suck Too Badly in Internet Explorer.

Part One: Horizontal Layout (or: There's No Excuse For Tables Any More)

You may (or may not) have heard that using tables for layout is a Bad Thing.  But to be fair, most of us don't care.  I've done it myself, it's usually the quickest way to lay stuff out on the page, especially if you're new to HTML / CSS and/or short on time.  There are loads of arguments all over the web as to why this is a bad thing, but the reasons I didn't want tables on the LMAX UI was a) we saw the performance improve by a really simple replacement of tables with divs and b) given the amount the UI was mutating, divs positioned with CSS was going to allow us a much quicker turnaround for the umpteenth re-design of the UI (ideally the upshot of this would be letting the designers mess with the CSS when they changed their minds and leave us developers out of it).

Anyway let's assume Tables Are Bad.  Tables are only for tabular data, not for layout.  In my world.

1.1 Simple Horizontal Layout Using Inline

The most common use of tables for layout is where you put elements side by side - the default behaviour of divs is that they lay out underneath each other.

However it's pretty easy to get divs to behave this way too, and using divs has some advantages over using tables.
<html>
<head>
<title>Horizontal flow</title>
<style type="text/css">
#left {
background-color: cyan;
display: inline;
}
#center {
background-color: yellow;
display: inline;
}
#right {
background-color: red;
display: inline;
}
</style>
</head>

<body>
<div id="container">
<div id="left">Left</div>
<div id="center">Center</div>
<div id="right">Right</div>
</div>
</body>
</html>
The first option is to use display: inline.  This will lay div elements next to each other, similar to a span.  This is the simplest way to get divs to appear side-by-side.

The disadvantage of this technique, however, is that inline elements can't be sized the same way as standard divs.  By default they contract to fit the content.

The screenshot above is from Chrome on the mac - you'll notice by default the elements have some spacing between them.  Reducing the margin/borders on the elements doesn't seem to eliminate this, so that's something else you might need to consider if you use this mechanism to display elements side-by-side.

1.2 Simple Horizontal Layout Using Floats


<html>
<head>
<title>Horizontal flow</title>
<style type="text/css">
#left {
background-color: cyan;
float: left;
}
#center {
background-color: yellow;
float: left;
}
#right {
background-color: red;
float: left;
}
</style>
</head>

<body>
<div id="container">
<div id="left">Left</div>
<div id="center">Center</div>
<div id="right">Right</div>
</div>
</body>
</html>
Similar to using inline, floating a div will do the following:
  1. Make it shrink to fit the content
  2. Lay it out side-by-side with any sibling floating divs.
You'll want to apply padding, margins, height, width and whatever else to make it appear less rubbish.


1.3 Wrapping Horizontal Layout


<html>
<head>
<title>Horizontal flow</title>
<style type="text/css">
#left {
background-color: cyan;
width: 50%;
float: left;
}
#center {
background-color: yellow;
width: 50%;
float: left;
}
#right {
background-color: red;
width: 50%;
float: left;
}
</style>
</head>

<body>
<div id="container">
<div id="left">Left</div>
<div id="center">Center</div>
<div id="right">Right</div>
</div>
</body>
</html>
The advantage you have using divs over tables is that you can get the browser to work out how the elements should flow.  Tables require you to determine exactly how many cells appear on each row, but with divs you can determine a width for each element and have the browser work out whether to show it on a new line or not.  This will work with both percentage and pixel widths.
  • If you want a more table-like structure where you know exactly how many elements should appear on each line, use a percentage of the screen with.  
  • If you know the width of each element, you should set a pixel width on the elements and have the browser work out how many to show per line.

The next CSS post will go over floating behaviour in a little more detail.

Sunday, October 31, 2010

Live at Last

We went live with "real" customers this week just gone.  It's the culmination of nearly two years work for me personally, and three years for our company.



It's really nice to be live at last, and to have our name out there. It might (in fact, should) change the focus of our work. Without paying customers it's much more difficult to prioritise work based on what they might need or want.

Exciting times for LMAX!

Friday, July 9, 2010

This is just a summary of the points I took from the Lean conference at Bletchley.  They all need expanding, this is just the stuff that struck me that I want to record.

A Kanban Multiverse – Karl Scotland
Points from his talk
  • Meaning = visualise; interact; persist
  • Kanban provides the translation between communities
  • Remove columns from the Kanban board - no more chucking things over the wall to people
  • Flip charts for design models
  • Dots on cards for every day in dev, crosses for every day in test
  • Exploration of UI is part of the card
Ideas applicable for my project
  • Add broken acceptance tests to the Kanban Board?
  • Start doing task breakdowns again
  • Add issues and impediments to Kanban board?
  • Mingle should be updated to reflect the Kanban, at the moment the states are incorrect

Converting a Scrum Team to Kanban - Mattias Skarin
Points from his talk
  • Moved from releases per iterations to releases per week
  • Shifted motivation from delivering at end of iteration towards delivering quality
  • Establish release cadence and team rhythm
  • Root cause analysis to find problems and target them
  • Removed the need for estimates
Ideas applicable for my project
  • Shift to focus on release cadence from iterations?

Product Development in the Land of the Free

Points from their talk
  • Goal should be to “Delight Customers”
  • Sitting together decreases waste
  • Sysadmins belong to the team and rotate
  • Deliver value fast enough and you don't have to ask for permission

Learn to Lean: Becoming a Lean Startup – Damon Morgan

Points from his talk
  • Introduce a learning culture: blogs, brown bags, conferences
  • Scrum introduces a half-day overhead of planning etc.
  • Scrum implies a handed off release to QA / Ops
  • Didn't have “QA” but “Developer/Testers” and “Tester/Developers”
  • Lean = planning on demand. 
  • Not sure when we're supposed to do retrospectives with a pull model?
  • Definition of Done is not only released to production, but has two possibilities: Generating Value and Not Generating Value
  • Cards that are “complete” but not released are inventory (and therefore waste)
  • Need fast smoke tests
  • Monitoring allows you to reduce errors and see if the release was good. Auto-rollback if not
  • Releases can be small, feature-specific releases
  • Have an ideas wall for anyone to contribute
  • AB Testing very useful to this organisation.
  • Reduced reliance on estimates
  • Releases not a big deal – happen daily
  • Measure outcomes, not activity
  • Out of 20 ideas, maybe one works. But cost/benefit clear and well understood
Ideas for us
  • Become more release-focussed
  • Should we encourage developers to do (more) exploratory testing?
  • Definition of done should be “released”
  • Better automated monitoring

Using Kanban to Continuously Improve – Benjamin Mitchel

Points from his talk
  • Quality First
  • Flow important
  • “What wasted your time?” to do root cause analysis
  • Measure time taken to flow through the board
  • Even if you show people metrics they still don't believe you
Ideas for us
  • Thank goodness we're not a big enterprise organisation

Behaviour Driven Development – Liz Keogh

Points from her talk
  • The term BDD and what it means has solidified over time, but it's nothing new
  • Concentrate on your riskiest tests first
  • Write your tests starting “should”
  • Conversations are around behaviour not tests
  • Development of stories is focussed on learning
Ideas for us
  • We're pretty good at BDD

Value Stream Languages – Eric Willeke

Points from his talk
  • Really just a summary of the day / Lean
  • We should respect different languages
  • Break things down into what you need to learn, not what you need to do and how long it will take
  • Variation comes from time it takes to learn, not time it takes to do
  • Ask “what do we need to know that we don't know now?”
  • Break milestones down accordingly – High Learning → High Risk → Core Value → High Value
  • Standup should be phrased “what did we learn yesterday; what do I need to learn today”
  • When your acceleration of learning decreases it might be time to stop designing and start doing
Ideas for us
  • Maybe a shift in thinking about “learning” instead of “doing”

Summary

Points frequently repeated and/or relevant to my project
  • Aim towards no estimation
  • Not focussing on iterations but on releases
  • Releases are part of the definition of done
  • Our BDD and basic Kanban is pretty good
  • Visibility allows us to find bottlenecks and target them
  • Focussing on learning might be a path to improvement
  • Silos are Bad, mmmkay?

Friday, May 15, 2009

Comments on representations of our industry

I have not (yet) seen the presentation this post is referring to.  But I think many of the comments Ted makes are very valid, and our industry as a whole should occasionally stop and think.  I've seen Ted speak at QCon, and I've had a lot of time for his comments ever since.

I'm aware that this blog is rapidly filling with comments about gender and perceptions and people-y stuff, when I originally wanted it to be a purely technical blog.  But I guess this other stuff interests me more.  And there are less people talking about it than there are talking about pure technical solutions to problems.

Thursday, April 2, 2009

Monday, March 30, 2009

Sexism in IT?

Let's celebrate our IT women

"Everyone" knows that there are more men than women in IT.  That it's a "boys" job.  Not a lot of people know that the first programmer was a woman.  Not a lot of people realise the number of women in IT is DECREASING.  And has been since the 80s.  In a working world where I honestly believe that *in general* there are more opportunities for women (OK, inline with the other stuff I've been reading I'll caveat this with white, middle-class women), it seems shocking that such a growth industry as IT is actually losing women, and appears unable to determine why, or stop the flow.

I get asked a lot, as a girl programmer, why there aren't more women in IT.  This is a complicated issue and one I've been thinking about for years and still don't have any good answers, but I personally think it's more about perception than anything else.

I don't think it's because you get more outright sexism and laddish behaviour in IT than anywhere else.  I've worked in half a dozen companies, in a range of industries, including very male industries like manufacturing and banking, I've been a consultant so been onsite at a bunch more companies.  And I have to say I don't think I've ever seen the sort of behaviour that is mentioned in the article.

I would go so far as to say IT, certainly in terms of programming or IT support, actually attracts men that are quite the opposite to laddish.  So here I will succumb to gross generalisation and stereotypes myself, but the guys I've worked with are highly intelligent and more likely to rate you on your ability than on your colour, sex or background.  These are often guys who were actually studying at school rather than absorbing anti-female sentiments in the pub or from The Sun.

I find being a woman in IT both a blessing and a curse.  As a girl, you are, I believe, more likely to get through to interview, and since you stand out as different are more likely to be remembered and called back for a second interview.  I think once in the organisation, we suffer more with low self-esteem and find ourselves constantly trying to "prove" that we're not just some token bimbo hired by HR.  And do you know why?  Not because anyone ELSE thinks that, but because WE think that.  We are our own worst enemies.

We need to take a leaf from the boys' book and have more faith in ourselves, more confidence.  We might not be as good as that person over there at this particular thing, or this other person at something else, but we are good at what we do, otherwise we wouldn't be there.  And if we express our insecurities instead of our confidence, other people will assume we're as mediocre as we sometimes think we are.

Some of the very worst culprits for sexism in our industry are us, the girls who are already in it.  Yes, it does exist, I am not denying that for a second1.  But the way to overcome it is to reflect it back at them, not to internalise it as our problem, something wrong with us for being in the wrong job.  The more we show that it's normal for us to be here, that we belong here, the better we'll feel about ourselves.  And maybe we'll attract a few more girls too.



;1Take, for example, the CEO who interviewed me and said "I'm probably not allowed to say this, but how will you feel working in an environment full of men".  To which my answer was, have you read my CV?  I went to a boys' school for sixth form, I was one of 6 girls on my degree course (out of approx 150), I worked at Ford for 4 years.  Don't you think I would be more freaked out working with girls?

Tuesday, February 24, 2009

Scrum but...

Having experience Flaccid Scrum, I find this article interesting, and agree with most of it.

I'd also like to add though, that if you do the scrum practices (story cards, stand ups, retrospectives, etc) but don't buy into the fundamental principals, you will not succeed.  And that means everyone on the team, not just the people in charge.  In particular, if the team is not empowered, is not committing to the estimates and the iteration plan in its heart, and and does not trust, then you are probably better off using traditional processes.  Or just as likely to fail whatever process you use.