Tuesday 27 November 2012

Interesting thing coming in ECMAScript 6

Javascript always has been the poor cousin to all that whizz-bangery that happens on a server and as a result anything new coming down the pipe line kinda gets lost in the news-stream of super-duper server improvements.

I try were possible to keep up to speed with what's about to come along and it was with this in mind I I was casting my eye over Juriy Zaytsev's EMCAScript 6 compatibility chart and I started to notice green's appear. Some of the current or beta versions of the browsers are starting to support the new V6 changes so it shouldn't be that long until we start to see them in the wild and can start to use them in anger.
(if you are interested in the EMCAScript 6 Draft Doc you can download it here)

Of the changes coming I am piqued by the idea of

1. Modules

While there are some JS libraries that do something very similar ES6 will provide support for modules, the rational behind this is to provide for:
  • Standardized mechanism for creating libraries.
  • In-language loading of external modules (non-blocking, direct style).
  • Portability between different host environments.
  • Future-proof mechanism for platforms to introduce experimental libraries without collision.
  • No installation/registration code within modules.
As Modules are static by default (but can be dynamically reflected) this makes them far more compatible with static scoping. Modules are loaded from the filesystem or network in direct style instead of by callbacks and this means the main thread of execution is not blocked by the load.

It is hoped that Modules will be used for scoping and their implementation preserves and promote static, lexical scoping, thus avoiding the many problems of dynamic scope: programming pitfalls, malicious scope injection, poor performance and  lack of modularity. Static scoping is also necessary for checking for unbound variables at compile time.

A simple module would look like this

module orders {
export function ASP(qty,val) { return val/qty; }
export var dollar = "$";
export var pound = "£";
}


This module would then be accessed in your JS code like this :

import orders( ASP ,  pound) from orders;
alert( pound+" "+ASP(ThisOrder.Quantity,ThisOrder.Value) );


I can see instances where this will be very useful!

More details on Modules can be found here

2. Object.Observe
Object.Observe gives us the ability to watch Javascript objects and report back changes to the application, changes like properties being added, updated, removed or reconfigured. When I am building a UI frameworks I often want to provide an ability to data-bind objects in a data-model to UI elements. A key component of data-binding is to track changes to the object being bound. Today, JavaScript frameworks which provide data-binding typically create objects wrapping the real data, or require objects being data-bound to be modified to buy in to data-binding. The first case leads to increased working set and more complex user model, and the second leads to siloing of data-binding frameworks. ES6 will get around this by providing a run-time capability to observe changes to an object. Here is interesting discussion on this soon to be available new feature

3 Default Parameter Values

Default parameter values allow us to initialize parameters if they are not explicitly supplied, so you can do things like


function dspInputPanel(footer = "Steve McDonagh")
{
       ... build inputPanel Object..
       footer.innerHTML = footer;

}

So when I call dspInputPanel() with no parameters the footer object will contain Steve McDonagh
if I call dspInputPanel("Anne Other") then the footer object will contain Anne Other

4. Block Scoping
There will be 2 new declarations available for scoping data in a single block

let which is similar to the var declaration but allows you to redefine a var in the let's block scope without changing the orginal var in the scope of the function

function doInterestingStuff()
{
         var x = 5;
         var y = 6;
         let (x = x*2,y =y*3) { alert( x+y ); }     // pops up 28
         alert(x+y)                                            // pops up 11
}


const is the other declaration and is like let but is used for read-only constant declarations

5. Maps
Arrays of Name - Value pairs have been around a long time in JS and ES 6 will introduce the new Map() object with it's functions SET(), HAS(), GET() and DELETE() that makes using them even easier

var myDogs = new Map();
myDogs.set("Fido","Poodle")
myDogs.set("Rover","Collie")
myDogs.has("Fido")                                 // Returns true
myDogs.get("Fido")                                 // Returns "Poodle"
myDogs.delete("Fido")                             // Returns true when deleted
myDogs.has("Fido")                                //  Now returns false


6. Sets
SETs are basically arrays and there is a new object creator Set() with associated methods HAS(), ADD() and DELETE()

var myCustomers = new Set( ["IBM","DELL","APPLE"] )
myCustomers.has("IBM")                   // returns true
myCustomers.add("ASUS")               // adds "ASUS" to the set
myCustomer.delete("IBM")                // Removes IBM from the set
myCustomer.has("IBM")                   // now returns false

This will allow array filtering to be so much easier, consider the following where I have an Array of customer names that I want to ensure is unique this new method is much much much easier to read.

function unique( customers )
{
       var ucust = new Set();
       return customers.filter(item) {
                                     if(!ucust.has(item)) { ucust.add(item) }
                                     return true;
                                     } 
}



There are loads more changes and improvements in the spec and it seems that ES6 is targeting a 2013 full spec release but as always some browsers are already implementing individual features and it's only a matter of time before their availability is widespread.

JS it seems may be coming out of the closet in the next 6 months and may soon be considered a "proper" language :-)

Friday 23 November 2012

The new CSS3 @supports() rule is really rather cool!

As all devs know , browsers can in varying degrees be a right royal pain in the arse when it comes to standards compliance and when you throw in companies like Never Upgrade a PC Till It Breaks Inc. who are still running XP with IE6, planning your super duper new web site to support them can be fraught with problems.

Most of us are used to the idea of designing a UI that degrades into a DBA-UX  (Different But Acceptable User Experience) to do this we have to be able to work out exactly the support for each feature that use in our design and have some "alternate" view that we can switch to.

Up until now I have relied on the wonderful Modernizer.js which smooths out a lot of the inconsistencies between browsers particularly the older rust buckets that NUPCTIB Inc use.

However there is a new CSS rule that will also help you - ladies and gentlegeeks let me introduce @supports() which has the syntax

@supports <supports_condition> { /* specific rules */ }

@supports is supported in most of the current browsers but as you might expect IE has ignored it and Safari doesn't have it yet. If you do use it in your CSS and a browser loads it that does not know what @supports is.. it will ignore the enclosed block, so you can still use your normal methods.

Basically what @supports() does is , it queries the CSS engine for support of whatever it is you need and then invokes the enclosed CSS rules accordingly.

@supports (display: table-cell) { /* some table-cell css in here */ }



Will test the CSS capability for box-flex and apply the rule if it is supported
You can also use a negative test for a rule not being supported.

@supports not (display:table-cell) { /*cope with non support CSS here*/ }

... and you can string together logical NOTs and ORs!

@supports (display:table-cell) and (display:list-item) { /* CSS goes here }

I am sure you get the idea and can see the usefulness of this addition to the Designer's toolbox


 






Thursday 22 November 2012

Useful i5/OS tip - Displaying Locks on an IFS Object

I was plagued this week by an odd problem on one of our i5 boxes. I was trying to use the CPYFRMIMPF & CPYTOIMPF to pull in data from a new Japanese division that uses nothing but Japanese characters in their data. This of course means UTF-8 / Unicode data, which can be a bit of a pain to set up in a DB2/i5 data table (particularly if someone forgets to make fields something other than CCSID 65535!)

Anyway.... I could get data off the system using the CPYTOIMPF into the IFS no problem at all, DBCS to UNICODE worked like a treat and everything was well with the world ... BUT ... try as I might I could not get CPYFRMIMPF to bring the data back into the DB2 file again.

There was a rather odd CPE3025 message that  told me the input file or path did not exist (error code 3025) and yet there is was, I could open it, read it, edit and save it  and everything seemed perfect .. but time after time I got the CPE3025 error and no data was transferred. I tried all day with no sucess and eventually went home hoping that a nights sleep would clear the mind and inspiration would come in the morning.


This morning came in an did a CPYTOIMPF which worked fine, did a CPYFRMIMF .. and .. it worked perfectly with no errors
After a bit of experimenting the culprit was discovered to be the fact that I had opened the file using Operations Navigator and even though the file had been closed normally Ops Navigator holds a lock on the file until Ops Nav is closed, the net effect of this is that the file is unavailable for the CPY* command.

Part of this analysis used a rather useful but lesser known API that you can use to track locks on objects in the IFS .. the api is this :

CALL QP0FPTOS PARM(*LSTOBJREF '/ifspath/ifsfile' *FORMAT2)

You need to have the *SERVICE special authority and the api dumps the locks to a spool file.

Easy when you know how but not an obvious tool for this particular problem





Thursday 15 November 2012

Domino Dander for Dosh 2013

Gentle readers some non-techie news!

The bold Eileen Fitzgerald and myself are planning a Dander For Dosh in May next year.

Eileen and were joined by the indefatigable Carl Tyler for 2012's walk along the coast between Bray and Wicklow in Ireland. We didn't pester the life out of you because we didn't get the giving organized in time for the actual walk. This year we will get our act in gear and start demanding money with menaces in January - You have been warned!

Conscious of the fact that the world is a tad short of cash we felt that we needed a real challenge one that would stretch us physically and encourage you to part with your hard earned cash. We are still discussing our options but top of the list is "The Great Glen Way" from Fort William on the West Coast of Scotland to Inverness on the east..80+ miles at around 20 miles a day for 4 days.

As plans form there will be more posts and many many requests for cash however if anyone would like to join us for 4 days of walking the length of the Great Glen under Ben Nevis along the edge of Lough Ness and down into the "granite" city, drop me a line and I will add you to the distribution list for our detailed plans.

Eileen and I cannot guarantee you good weather, but we can guarantee you four days of eclectic conversations, beautiful views, good food and good company (as you would expect from a group of Domino Geeks) I you want to join us for one day, two or all you will be very welcome (mainly as Eileen knows all my jokes and craves new material)


So Watch this space , marvel at our foolishness and when the time comes sponsor us as much as you can!

Sunday 4 November 2012

Alternates to the evil EVAL() in javascript

I am interrupting the Design Series of post for a quick JavaScript post that comes out of a question asked on the JavaScript forum on LinkedIn about alternates to the eval() function in JavaScript.

The most pertinent reasons for not using eval() are:-

1. Security - it leaves your code open to a JS injection attack which is never a good thing
2. Debugging - no line numbers which is a PITA
3. Optimization -  as until the code to be executed is unknown, it cannot be optimized.

Sadly EVAL is way to easy to use and as a result we see it all to often in places we shouldn't really see it and this can leave the door open to some nere-do-well making a mockery of the rest of your obviously wonderful code.

So what to do to avoid using eval()? Well alternates to the the 3 main areas I have used EVAL in the past are listed below.

1. When working out a bit of an object to change for example something like this

eval('document.'+IdName+'.style.display="none"');

Now I am not suggesting anyone WOULD do this given the tools available but I have come across code like this in older applications written by people just starting out in the wonderful world of JS.

document[IdName].style.display= 'none';

or

document.getElementById(IdName).style.display='none';

are both much safer and a lot faster.

2. Getting JSON that has been returned by AJAX calls to the server into the DOM, like this snippet of jQuery is doing.

$.ajax({ url: "getdata?openagent&key=SMCD-98LJM",

              success: function(data) { eval(data),
                                        doSomethingInteresting()
                                      }
        })

This will work but a more satisfactory way would be to use the JSON data type in the ajax call

$.ajax({
  url: url,
  dataType: 'json',
  data: data,
  success: *callback*
});

alternately use the $.getJSON() jQuery shorthand function.

If you don't use jQuery (or dojo which has an equivalent) you can use the powerful JavaScript JSON object.

var myJSONData = JSON.parse(data, reviver);

Where DATA is the the JSON data string and REVIVER is an optional function that will be called for every KEY and VALUE at every level of the final resulting object. Each value will be replaced by the result of the REVIVER function. For example this can be used to change strings in the JSON text into JS Date() objects.

3. The thorny and potentially very insecure loading and execution of Code Blocks, probably the most common use of eval() function in Javascript. Anywhere you allow code as text to be passed and run in the browser is prone to attack, it is much better where possible not to do this. When you absolutely have to do it then I would say using the Function constructor is less risky than a bold eval() call.

var myCode = "... your JS code ..."
var doSomething = new Function(myCode)
doSomething.call()


This will have the same effect as EVAL() but is less prone to being found as an avenue of attack for the forces of chaos on the internet. ** Note** you can also use the constructor format below to pass parms to the code block.

var doSomething = new Function("..var1name..","..var2name..", etc .. "..myCodeString..")

On a side note but related note, when you create a normal JS function construct, the definition does not have to appear at the start of the script (though it is usually best to do so for the sake of clarity). It can even be defined after the the code that calls it. In most cases, no matter where you choose to define your function, the JavaScript engine will create the function at the start of the current scope. BUT and it is an all caps BUT if you need to construct a code block conditioned on an IF, like this
if( someThingIsTrue )
 {
 function doSomeThingWonderful.call() { .... }
 }


Mozilla based browsers will allow it, but most others do not as they will always evaluate the function, even if the condition evaluates to false. So do not try to declare functions in the way noted above. Declaring functions inside these statements is possible in all current browsers using assigned anonymous functions, so it is better to do it this way.

var doSomeThingWonderful;
if( someThingIsTrure ) {
  doSomeThingWonderful = function () { --CodeBlock A--};
} else {
  doSomeThingWonderful = function () { --CodeBlock B--};
}
doSomeThingWonderful.call()

There are other reasons you need to evaluate objects or code  but generally there are ways around most of them that whilst potential slower to process are more secure and sensible.



     

Monday 15 October 2012

Principles of Design #6 - Colour Theory, The basics


Right I could wax long an lyrical about colours and how to use them, which I have to say probably sounds odd coming from me given that I am nearly colour blind. However I have been colour blind all my life and to me the sky is blue and grass green because that is what we are taught from when we are small.

Colour is very hard to describe to someone else without using the word "like" in fact most colour names are based around a descriptor that carries with it the meaning of the colour being expressed..

For example "Cornflower Blue" should make you think of the colour of Cornflowers like the one on the left or of a room that was painted with cornflower blue paint. There is no such thing as normal colour vision, we all each and every one bring our own baggage to this quick wander down the garden path of colour theory.



Colour Theory is a BIG topic so I will only be looking at 3 specific areas in this post, areas that any web or app designer needs to have a firm grasp of if they are to produce finished code and colour schemes that are beautiful, pleasing and work within the context of the app you are developing. These topics are .
  1. The Colour Wheel
  2. Colour Harmony
  3. Colour Context
The Colour Wheel

 The colour wheel is one of those things I never see on a geek developers table or in their favourites and yet it is a tool that artists and graphic designers use daily!. Go to any art store and pick one up they will know exactly what you want is you ask for "A Colour Wheel". Alternately you can use one of the many online colour wheels .. this is one I use a lot and can recommend.
http://colorschemedesigner.com/


Color wheels are arranged so that the colours move from red at the top around the rainbow until you come again to the blues and violets at 11pm ish. You will notice that the wheel on http://colorschemedesigner.com has the words WARM and COLD at 1 and 7 o'clock. this does not mean that just the colors at these "times" are Warm or Cold but there is a transition going on from the reds,oranges and yellows which are the colours of fire, embers and the sun convey warmth where greens, turquoises and blues are the colours of grass and water traditionally cool things. But be careful it is transitional and you move from warmer to cooler in gradual steps in each colour.



A color circle, based on red, yellow and blue, is traditional in the field of artists however Sir Isaac Newton was the chap that developed the first circular diagram of colors we know of in 1666. Since then, scientists and artists have studied and designed numerous variations of this concept. Differences of opinion about the validity of one format over another continue to provoke debate. In reality, any color circle or color wheel which presents a logically arranged sequence of pure hues has merit.




Primary Colours: Red, yellow and blue
In traditional colour theory (used in paint and pigments), primary colour are the 3 pigment colours that can not be mixed or formed by any combination of other colours. All other colours are derived from these 3 hues.  When you mix these 3 colours you get the Secondary Colours Green, orange and purple. If you start mixing primary and secondary you get the Tertiary Colours Yellow-orange, red-orange, red-purple, blue-purple, blue-green & yellow-green etc. and so on. gradually as you mix the colours you get the wheel you can see at http://colorschemedesigner.com.



OK I got that colours are colours and they are can be placed on a wheel so how does that help me and why should I use a wheel at all?

Good Question - this is where the next topic comes in

Colour Harmony

In visual experiences, harmony is something that is pleasing to the eye. It engages the viewer and it creates an inner sense of order or a balance in the visual experience. When something is not harmonious, it's either boring or chaotic. At one extreme is a visual experience that is so bland that the viewer is not engaged. The human brain will reject under-stimulating information. At the other extreme is a visual experience that is so overdone, so chaotic that the viewer can't stand to look at it. The human brain rejects what it can not organize because it cannot understand it.. Creating harmony is the task designers need to get right as it delivers visual interest and a sense of order.

The Schemes!
Look again at the colour wheel

The very slime outer ring comprise the primary colors, the inner rings the secondary, terteriary and so on so how do we combine these into a scheme? Well look at the top of the site you will see what at first glance look like odd shaped buttons.

these are the 6 types of standard colour schemes that for want of a better word "work". Look at the one I have highlighted called ANALOGIC, note the 3 dark segments at the top of the circle, these represent colours that are close together on the wheel. If a colour is beside another other colour it is called Analogous (or Analogic) you see this quite a lot in nature and the human brain really quite likes it and accepts it readily and this is perhaps the easiest colour scheme to get right.
If two colours are opposite one another on the wheel they are deemed to be Complimentary and this is another of the scheme names. If you select the Complimentary button on the http://colorschemedesigner.com site you will see this.

Note the appearance of two dots one at 12 o'clock the other at 6, these are the complimentary colours if you drag the dark 12 o'clock dot around the circle the corresponding opposite dot moves with it and the colour scheme displayed on the right of the screen displays a palate of colours that work well together. Note that as you move the dot the palate colours on the left never clash, are never discordant, they "work" - and there-in lies the beauty of the colour wheel!

There are 6 schemes in total and you can explore them at your leisure however I will mention one more the Triadic which combines 3 colours on the wheel in a triangle shape. This can be hard to get right if you do not use a colour wheel!

as you can see you get the dark dot at the top, which you can move around clock wise and anti-clockwise, the two white dots at the bottom form a triangle and these can be dragged as well.. however they broaden or narrow the base of the triangle.Once again the wheel can be used to get colour schemes that work, although some may be a tad garish.. so use with caution!

you will notice that the center of the circle is the colour under the dark dot, this colour will be the one you select as the main colour of your scheme, the others will be secondary to it. hence the larger area of that colour on the right hand palate pane.

Context

How colour behaves in relation to other colors and shapes is a complex area of color theory. Compare the contrast effects of different color backgrounds for the same red square
For most people with normal or nearly normal color vision red appears more brilliant against a black background and somewhat duller against the white background. In contrast with orange, the red appears lifeless; in contrast with blue-green, it exhibits brilliance. Also notice that the red square appears larger on black than on other background colors, this is context! Always try colour swatches of your colour scheme like this to see if they 'work' the way you expect them to and deliver the sort of balance and emphasis that you want to convey.

This is also where I have a problem and http://colorschemedesigner comes to the rescue again notice a the top right there is an option for..... Colour Blind


 Have a look at your color scheme when you apply the different types of colour blindness filters and note how the tonal values change use these options in combination with the preview buttons at the bottom to see how others will see your colour scheme always remember that how you see the context of your scheme is not how others will if they have colour blindness of if there monitor is configured differently from yours. (I am Tritanopy Colour blind have a go and welcome to my world ;-) )

Next post we will go a bit deeper into the world of color and look at hue, luminance and tone

Coping with Windows update 2661254 SSL FIx on a self certed domino server

Well well well, that was an interesting couple of days!
Microsoft in their infinite wisdom decided to release a fix that stops Internet Explorer (a pox on it) accessing any SSL site that has a <=512bit certificate.

Here is a link to the MS document

Now there are very good, sound and security related reasons for MS to do this but it did cause me some fretting and sleepless nights this week, i have no doubt once the fuss dies down you will see Firefox, Opera, Safari and the rest follow suit.

We protect a lot of our internally accessed data with self certed SSL certificates and these where created back in the days when 512 bytes was more than ample and secure for this purpose. These certs were renewed each year and over time have been forgotten about.

The symptoms of the problem post this fix being applied are:-

When IE <=8 tried to connect you get a "there is a problem with the web site" error and you can go no further, with IE >=9 you get the "There is a problem with the certificate" message but clicking on the "Proceed to the web site (not recommended)" does nothing.

Now on a i5 server (used to be the iSeries Server or AS400 and nicknamed iBoxes) renewing a self certed SSL server certificate is dead easy and you get the option to change the bit length so for our iBoxes it was dead easy. Admin Panel, renew certificate, change bit length, create, apply , restart server .. and the problem went away.

But Domino servers ... ahhhh ....

I went into the Certificate authority NSF created for the server, tried to create a new certificate, not a problem but no field to let me change the key length.. ARRRRRRGGHHHHHHH!!! Tried a whole lot of things to get a 1024 long key, with no great success. So my quickr users on the one server with the problem had to start using another browser whilst I sorted this problem out.

As it turns out Per Lausten Domino Guru and all around nice chap tweeted a link that lead me to the solution ...many thanks Per!!! Once again Social Networking helps the poor benighted admin out of a tight corner not really of his own making.

Basically what I did was the following which I was missing in the other ways I tried
The full details for what follows are on the link above, but in summary you just start from scratch.

01. I took a copy of the original Cert Authority NSF created for the server
02. I took a copy of the .key and .sth files currently in use on the server
03. I created a new nsf using the Domino Certificate Authority template CCA50.ntf
04. I created a new CERTIFICATE AUTHORITY KEY RING FILE with a 1024 bit key (option 1)
05. I ran the Configure Certificate Authority Profile (option 2) for the new key ring file
06. Set the expiry to 5 years
07. I ran option 3 - Create Server Key Ring & Certificate, filled in the guff required paying special attention to put CAKeyPair in as  the CA Certificate Label and the fully qualified domain name of the server as the "Common Name" and 1024 as the key length.

Et Voila!!! I have a new Keyfile.kyr and KeyFile.sth with 1024bit keys!

All that was left was to copy these to the server and stop and start the HTTP task and IE started to work again, which was accompanied by a massive sigh of relief and a couple of memo's suggesting we might as well go the whole hog and get "real" certificates even thought they cost money.

Thanks again Per for the link that got this sorted you are a star!

Wednesday 26 September 2012

Principles of Design #5 - Unity, Getting all to work together

Bit of a gap in the series, a 25 mile walk in the Mournes and a couple of projects at work got in the way.. Anyway on with the series - Unity, what is it?

Well that is a hard-ish concept as it sort of suggest that "What works ... works". However it is something that all devs should think about as most of aspire to create things that work and have an identity. Alternately we may work in a company that has a well defined corporate identity framework with in which we create our applications and whilst we work within this framework we may want to add to or improve the framework with our own ideas.

Other frameworks may be very well defined like IBMN's OneUI that we all know and some of us love. I have to add that I am not that keen on it but it does tick a lot of the "design" checkboxes  it is just a bit ... mmmm.... soulless unless you breath some of yourself into it.

Consistency

So in broad terms unity is an umbrella principle for visual design, meaning all aspects of "The Language of Design" that I have talked about so far (and in those to come) contribute to the visual unity of an image. Consistency among parts that contribute to the whole is a hallmark of a unified design. Such parts include color schemes, typography, semantic hierarchy etc. When all of these parts are in sync, the end result is a unified design. However, if one of the parts is inconsistent or improperly applied, unity suffers and the image or site or app often appears disjointed. A common problem that makes a good web site look thrown together.


The site above whilst at first glance looks OK suffers from a lack of consistency, the images do not compliment each other and distract from the design The navigation is confusing and not centred, the colours do not complement each other and the page has no focus which leads nicely into ...

Relationships 

Unity is the relationship among the elements of a visual that helps all the elements function together. Unity gives a sense of oneness to a page as a seen by the user as a single visual. In other words, the words and the images work together to create meaning. So basically don't use a picture of a dog when you are talking about cats or as in the example above have way way way to many unconnected images.

Colour Schemes

I will be talking in a separate post about colour however keeping colour consistent across all the pages or parts of your app.This is where frameworks like OneUI or Twitter Bootstrap come into their own and will help the designer from the get go.

By whatever method you should try to achieve a design that should consistently use a stable color scheme that appeals to viewers. For example, if a Web site consists of multiple pages and the font color for hyperlinks is blue on the first Web page, then hyperlinks should be blue on subsequent Web pages. Also, background colors should be used consistently and should enhance readability preferably by relying on a template or some type of CSS to ensure that page loads are cohesive.

Proximity


The simplest method of making objects or elements on a page appear to belong together is to group them closely together. We humans LOVE patterns and developing a pattern in your design or images will create unity in your design.

Similarity

Things that are the same shape, size, colour or orientation allows the viewer to associate them with each other and visually bind them together.

Repetition

Another method often used to promote unity is the use of repetition. Repetition of color, shape, texture or object can be used to tie a design together. 

Continuity
A much more subtle method of unifying a design involves a trick borrowed from the art community. The continuation of a line, an edge or direction from one area to another. Continuation is often used in books and magazines to tie the elements of a page together with the use of ruled column dividers and by lining up edges of text  headlines and graphics.

Take the picture above the artist has used the continuity of the road to unite the fore-ground with the back ground. The left to right stroked in fore-ground unite the left and right of the picture.

This continuity allows the viewer to start at the front of the picture and work to the back without interruption. The continuity of the stokes allows the view to recognise a pattern that consolidates the idea that we are looking at a "worked" field.

Closure
When you have a group of elements in a design it is important they they are "closed" . By that I mean that the group should be a recognised shape itself and the closure can be achieved with either a boundary line or by whitespace. Have a look at the example below at the 3 panels at the bottom each panel has an image with text below surrounded by white space. This is a "closed" group. Also looking at the 6 panels as a single group bounded by the grey side bars can also be considered as "Closed"

Conclusion


Consider the site above it shows all the elements of unity as a whole - the overall T pattern is easy for the user to identify with. The images work well together the fonts work well and the colour scheme works. This unity allows the elements of the site to be more than the sum of their parts and bind the site into a single pleasant visual experience.

This is what we as design-centric developers need to strive for design not only each element well but ensure that each element works well with every other element on the page.

That brings the principals bit of this series to an end. I hope you found it useful and in the next series of posts I will be talking about how we can leverage these fundamental ideas together with with your current skill sets in the development cycle to both develop and design apps and web sites.

First up is colour in the next post.

Friday 21 September 2012

IT Sales Cold Calls - The bane of my life :(

Right - people who follow my tweets will already know that my patience with cold callers has worn perilously thin of late. Particularly with Oracle salespeople although SalesForce, HP and Macafee are not that far behind.

I am paid to do a job and I do that job reasonably well given the fact there there are only so many hours in the day that I can work in. What I am NOT paid to do is to engage with cold callers trying to engage me in a conversation that adds not a shred of productivity to my day, dozens of times a week. This week I have taken 14 of these deeply irritating calls and quite frankly enough is enough!

For the record :-

1. Were you even mildly interested in me as a person rather than as a revenue stream you would have asked someone how to pronounce my name, calling me Mr [long pause] Ma Dough Mag and when I correct it if you continue to get it wrong I WILL hang up.

2. Were I interested in your offering I will contact you until then LEAVE ME ALONE!

3. If I am on a list that says I am interested and you are from Oracle , Salesforce, HP or Macafee the list is wrong and I will  have asked many times to be taken off the list. People like yourself  haven' bothered so pardon me if I don't give a damn about professional courtesy if you or a colleague ring me the next fecking day with the same content.

4.  I really really really do not care a monkey's chuff if Gartner thinks the sun shines out of your collective orifices. Neither do I care a scintilla that product X will save the universe from heat death  or the effects of the antisocial cultural hegemony of Facebook. If you send me "White Papers" and I haven't explicitly asked for them then  I will figuratively wipe my arse with them, flush them into the toilet of my contempt and have them safely de-odourised by the toilet duck of derision.

6. Offering to come and meet me in person because you will "be in the area" does not in any way suddenly make me interested in your product. The fact I have said "I am not interested" does not in any way allow you to infer than me being able to smell your aftershave and marvel at the sartorial elegance of your suit is going to change my mind.

7. Implying that whatever competitor's product I am using is crap, worthless or might cause impotence does not endear your product in any shape or form (Unless it is Internet Explorer which of course does cause Impotence and that is the reason I do not use it) If I ever want someone to insult the tools I use every day I will be sure to put you at the top of my list.

8. I know "times are hard" and you are "just doing your job" but you do have to remember you are interrupting me at work. You are directly responsible for a hiatus in whatever it is I am doing, that hiatus better be something I AM interested in or you WILL suffer the thin sharp edge of my wrath.

9. If you come across me on your call list for the day - consider me "hostile and dangerous" you have been warned!!!!






That is all.

Friday 14 September 2012

Design Principles #4 - Use Emphasis to make your point

So in our wander through the skills and ideas useful for devs that do not have design team handy when they are designing apps and sites we arrive at emphasis.

"OK", I hear you cry, "I know all about the [em],[i] and [b] tags."

But emphasis is more so much more that typographical!

Emphasis is what gives you design a focal point and by that I mean that the element that is most important stands out in your design. For this reason emphasis is sometimes called dominance, but I don't want to get all "50 DIVs of Grey" here so I will stick with Emphasis for now.



In the web site above is a classical example of emphasis used to great effect. The rays of light slanting down from top left to the centre and the well lit center image and dark surround create the emphasis and drag the eye to the most important thing on the page. Rembrandt used exactly the same lighting technique all the time... the emphasis is on the lit characters and you find yourself looking at them first and paying more attention to them as a result.

Focal points are very important. In an earlier piece I mentioned the Web Page "Sweet Spot" which was roughly here.
However you do not have to place the focal point here, you can by using emphasis move the focal point to wherever you want on the page.

One of the biggest mistakes I see in design it when the dev tries to make everything in the design stand out or more commonly nothing has emphasis at all. The problem with that is the app will appear busy if too much emphasis is used, and boring and unappealing if not enough is used.

Instead I would recommend using a semantic flow to your HTML markup, a task now made all the easier with the HTML 5 which has changed and will continue to develop towards a semantic rather than presentational markup. Using this new semantic markup as a starting point the developer can arrange the elements of the app or page into a hierarchy.

So your Web page/app will have a hierarchy and all you need to do is put the emphasis on the correct elements so that your design leads the user on a journey you want them to take and hopefully that will be in IBMish an "exceptional experience" ;-) So how do I do it this emphasis thingie

White Space
Remember Emphasis is important but of equal importance is what you de-emphasise!
What I mean by that is the more an element is surrounded by white space or is isolated from other elements, the more weight and, thus, importance it takes on.



In the example above note the "Part of the story" unlike the rest of the page which is space-free this text is emphasised by the the fact it has white-space around it. It jumps from the page and screams "READ ME FIRST" to the viewer.

Contrast
Emphasis can also be leveraged using contrast.

Contrast is about differences: light against dark, small next to large, a portrait-oriented photo next to several landscape-oriented photos. See the contrasts and subsequent focal point on “Love that Summer Feeling” above. The focal point is a rectangle alongside many squares; it is the largest shape on the page; and it also is colorful against a black-and-white backdrop.  This is Contrast pure and simple.

Establish and then break a pattern



In the last post I talked about Rhythm and patterns you can emphasise an element on your design by placing an element at odds with the established pattern on the site. the central item is rotated by 3 degrees clockwise (you can do this really easily with CSS3 *-transform:rotate(5deg); rule). Once again the eye is caught by the weight of the difference and drawn to the centre, the rotation be clockwise draws the eye down to the title "Tie-Dyed". Emphasis hard at work!

Continuance.

Continuance is a fancy way of saying once the eye starts moving it prefers to keep going in that direction until something with more emphasis comes along. Consider this


Even though the bottom splat is bigger and so tends to catch your eye first, your brain can’t help but go “FECK, look at the sexy arrow AND it is pointing right !” Soon enough, you’ll find yourself staring at the smaller object.This is the same effect as you get when someone stops on a crowded street and stares up at the sky, soon a bunch of people will be looking up trying to find what the person is looking at.. (Hint the person looking up is the arrow!!)


Typography

I started with a nod at typography I will do a complete post on fonts in the future so prepare yourself for an attack on the evil that is Comic Sans! But I will add here Fonts can play a bit part in emphasis but do NOT fall into the trap of having lots of different font-faces, sizes, colours and weights. This is NOT good! Use no more than 3 fonts on a page and make very very sure they look good together. Do not,for example mix serif and non serif fonts, on the same page it hurts the eyes! The experience of printers going back to the times of Caxton's printing press should be ignored at your peril!!!

So that was a quick dander through emphasis. It is a very very useful tool for a developer to use, but it is easily misused and can cause chaos , confusion and double-vision in your users! Like all things make it part of your thinking process when planning the site and experiment so you get the right emphasis on the right places.

Look at magazines at other web sites and applications, where is the emphasis? Does it help or hinder? You have your eyes open all day, use them to learn what makes "good" design!!

Next post will be UNITY!

Wednesday 12 September 2012

Design Principles #3 - Getting down to the Rhythm

Rhythm is mentioned by one of my arty farty heros Henri Matisse

An artist must possess Nature. He must identify himself with her rhythm, by efforts that will prepare the mastery which will later enable him to express himself in his own language.
Now Mr. Matisse was taking about paintings but it is equally true about music, poetry or indeed web and app design. We as devs create rhythm by simply repeating elements in predictable or surprising patterns. This repetition is a natural thing that occurs everywhere in our world. As people, we are driven everyday by predictable, timed events. The Olympics every 4 years, telegraph poles along a road, fence posts receeding off down a beach, breakfast coming after gettting out of bed.

Rhythm in design is just re-creating that, re-creating these predictable timed patterns, creating a pleasing sub-conscience relationship between the elements in the pattern.

Humans are designed to seek for and recognise patterns being able to recognise a sabre tooth tiger was a definite advantage to our hairy anchestors!. Patterns are familar and are reasuring to the user, unordered chaos (the opposite of rhythm) jars and unsettles the viewer and should be avoided - unless that IS what you were looking to achieve ;-)
In your app or web site rhythm creates a sense of movement for the user. A good website shouldn’t feel template based, it should tell a story. The fluctuation or repetition  of key elements on a website express rhythm.

So rhythm - tell me more ... there are 3 types Regular, Progessive and Flowing.

Regular Rhythm
Dead easy ...it just repeats elements in timed or predictable intervals like this .. on Play.com

Button equal sized and horizontal, large main image in the area where the eye naturally gravitates, and "KNOCKOUT DEALS!" slap bang in the hot zone of eye movement. Then four small rectangle panels along the bottom. Even these 4 panels have text on the left similar sized image on the right.

All regular, safe , rhythm!

Beware regular rhythm! It can be ... boringly template looking ... if not done well and with some stylistic flair.

Progressive Rhythm
A progressive pattern used changes in size or colour or possesion but not in a regular way. Progessive patterns lead the eye progressively through the elements. In http://flairbuilder.com/ above the asymmetric circles and dotted thread are perfect examples of a Progressive Rhythm leading the naturally from Circle to Circle right to left.

This is particularly skillful blend of regular rhythm in the navigation and footer and progressive in the center panel. It works visually and that is always the acid test of a good design.

Flowing (or Fluid) Rhythm
A flowing rhythm gives a sense of movement, and is often more organic in nature. Think of the stripes on a Zebra, they are regular white and black stripes but arranged in a fluid almost random way. (The rhythm on a Zebra comes the repeating white and black not the size position or shape.)

Flowing is perhaps the most difficult of the rhythms to get right with elements on the page however you can use it to good advantage with your masthead or footer images, which can give the over all impression of a flowing movement on the page.
... and in this website , the sadly now defunct http://www.aw-digital.com

 .. the dev has used a mixture of regular (the stripes top left) and progressive (the semi circular arc) and fluid with the different sized circles. The combination gives a very pleasing effect. Also note there in the top left quadrant the home button.. right where the eye will settle and there diagonally opposite are the "social" buttons balancing the home button nicely.... Lovely!

Adding unique interest and excitement to your web designs can be hard to accomplish, but adding some rhythm to the design is a quick and easy way to do this.Our own demon drummer Bruce Elgort will tell you that good drumming can be the back bone, anchor and driving force in music and as you can see it can be the same in web and app design! Every design has rhythm even if you didn’t plan for it, so a good dev will  take control of it and use it to the best advantage.

.. and so on to how to do "Emphasis" to your app's best advantage in the next design post


Tuesday 11 September 2012

Design Principles #2 - Proportion

Proprotion - OK why should I care about proportion?

Proportion is closely linked to Balance that I discussed in the previous "Design" post. Proportion is one of the attributes that can balance a page or on the other hand send it spinning off into the realm of things that make you go "EUCK!!!!!"

At it's most basic level, proportion is the relationship that an element has with one or more other elements on the page. This relationship can be any one of the elements attributes size, colour, weight (as described in the previous post) but generally it is the size that we humans look for instinctively.

Think of the human body. If you head was 200% wider but the same height it would odd or more correctly "out of proportion" to the rest of your body. The human eye is used to the "natural" proportions found in nature, so while we will instinctively like things that observe certain rules of proportionality we will also dislike and find upsetting those things that are "out of proportion".

Back in the Renaissance artists and mathematicians noticed that there was a natural proportion that when observed made their pictures, sculptures and buildings better, more pleasing and generally visually wonderful!

After much quill sucking and doodling on the back of Italian Bistro table clothes they came to the astounding discovery that the proportion of "nice looking things" was generally the same. They called this the "Divine Proportion" or "Golden Ratio" and it is 1:1.618033988749895 or if long numbers aren't your cup of tea 1:1.618

Eh?
Have a look at the above statues ... which one looks "in proportion"?

If you said the one in the middle .. well you would be right.. here you have the golden mean in action.. the ratio between each adjoining element is in the proportion 1:1.62 .... see?

Right that works for naked men (and women) but what about web pages or apps?

So if you have a page layout that is 906px wide and you want to divide it into two sections that conform to the golden proportion .. easy peasy!



Simple :-)

Still Not convinced... well lets look at twitter.


Look at the boxes.. and how they "fit" the design.. each box is in 1:1:62 with the next biggest element. BTW The spiral is one of the things in nature to look for when looking for the golden ratio.


Right I am going off on a tangent for a moment ..

The Golden Ratio is not quite as fixed a rule as you may think when you start to play around you will discover that you can break the golden ratio if you are careful. There is an optimal number of symbols or characters per line. Generally this is accepted as being 50-60 although up to 75 can be OK. More than this the readers eye wanders off and they loose their place and their interest. Too short and the eye will have to travel back too often, breaking the reader’s rhythm. Too short lines also tend to stress people, making them begin on the next line before finishing the current one (hence skipping potentially important words). SO depending on your typography in your page's elements you can break or at least bend the golden ratio and still provide a balanced design.

There is a very interesting book “Typographie” by E. Ruder that explains a lot about how we read and it seems that the subconscious mind is energized when jumping to the next line as long as it doesn’t happen too frequently. At the beginning of every new line the reader is focused, but this focus gradually wears off over the duration of the line

So with this in mind, sizing your textual elements should combine an optimal line length of between 50 and 60 symbols and nod at the proportions of the golden ratio.

OK Back on proportion

Sine 1:1.618 is pretty close to .33 : 0.66 a variant of the Golden ratio is "The Rule of Thirds" this generally can be used without need for your calculator. All you need to do is divide your design vertically and horizontally into thirds - like a tic-tac-toe board. take this site for example


Now if you remember back to part 1 of this series I pointed out that when people do decide to read a page, their eyes sweep horizontally from left to right, often focusing initially on a roughly triangular area in the upper-left corner. When the results are applied to a page that observes the rule of thirds then we see the following happening.


On the demandware site above you can see that the designer has used the rule of thirds but has nodded at the golden ratio

Also worthy of note in the site example :

1. The picture is placed so the site is in the golden ratio from top to bottom in a similar way to the statue.. the top section is in 1:1.62 to the picture underneath. There is also a golden spiral in there by "weight" in the top 2/3 of the page.


2. The edges of the person's body (not the arms) in the picture runs down the 2/3's line reading left to right or right to left, these are close to the golden ratio and are satisfying to the eye.

3. Whilst the weight of the left hand side is increased by the large ON DEMAND section the page remains in balance because the lower left hand segment is less populated than those on the right so the page remains in balance and is satisfying

4. The package the person is holding is sloped bottom left to top right. This leads the eye up to the navigation panel. Were it the other way around this would drag the eye down to the footer.



..and that is an short introduction to proportion ... another invaluable tool to the designer and will get mentioned again when I talk about "Grids" later in this series.





.. and next we move onto Rhythm ....

Today is a BOFH day .... :-)

Today I got a reply from a user who had received a standard warning message about a password change event that will be happening tomorrow.
The orginal email message reads

Dear xxx,
Please be aware that your password for the userprofile XXXXXXX on the BIGBOX server will expire tomorrow and you will be required to change it.
Regards
The Security Administration Team
We in IT send these messages on the two mornings before password change day so that the change does not come as a surprise and it gives our users 2 days to work out something exciting and memorable that does not break the password composition rules and yet fits on a post-it note attached to their screens.. Names of people and servers changed to protect the guilty.


The Reply
Steve
       What is this about?
Regards
Norbert Normal
My Reply to the reply

Dear Mr Normal
This message is to warn you that your password will expire tomorrow and you will have to change it Here are some useful definitions

"BIGBOX" = A server that has the name BIGBOX you know you are attaching to the BIGBOX server when you click the icon on your desktop named BIGBOX. This opens a windows where in large 70pt friendly blue letters in the center of the screen it says BIGBOX

"Password" = this is a secret word that allows you and you alone to access the facilities on a Computer. In this case the BIGBOX server see 1 above. We use passwords because we like secrets in MIS. Encryption is our bread an butter and passwords our Marmite. We do it specifically to make it difficult for people to do things that they shouldn't do on the server. We have considered removing your keyboards but this was deemed to be too excessive by the User Committee.

"Tomorrow" = a difficult concept, usually considered to be the day after today. But when is today? I generally advise users that tomorrow is the next time you wake up and get out of bed. However if you had a large and perhaps liquid lunch this may lead to confusion. So I suggest you put on your television and tune to BBC1 .. stay awake until you see the next BBC Breakfast program starting and you will have arrived successfully at "tomorrow"

Regards
Steve


Quick Tip for IE Compatibility Modes

After much head scratching on how to get IE9 to behave properly with a web site design I discovered deep in a MS document that you can add this inside your [HEAD] and it will force any IE version to use the highest compatibility mode that is available to it
[meta http-equiv="X-UA-Compatible" content="IE=edge" /]

Damn useful as IE9 will by default start in QUIRKS mode and make a mockery of all your lovely newish CSS and JS.

The MS Article is here

PS I will be back later with Design Principals and Proportionality

Monday 10 September 2012

Design Principles #1 - Balance

So what is "Balance" and why do I give a monkey's chuff?

Well on a very basic level we humans like things to be balanced and something that is visually balanced is more pleasing to the eye than something that is not.

The easiest way is to think of an old fashion set of scales, when the two objects being weighed are the same weight the scales will be balanced. You can have several objects on one side and they still "balance" one big object on the other side.

You will hear design geeks like me say "That panel has too much weight" and basically I am saying the same thing. Visually the panel is heavier than the other elements and is causing the whole effect to be out of balance.

The "weight" of a visual object is made up of its size, color and lightness or darkness. If a visual object on the screen does not "balance" with the other objects on the screen then it drags the viewers eye down to the heaviest part of the screen and you may not be aiming for that effect and it may well detract from the information being presented on other parts of the screen. The weight of an element can be judged using these basic rules.
  • Bigger areas are heavier than smaller areas.
  • Darker areas are heaver than lighter areas.
  • Saturated colors are heavier than unsaturated colors.
  • A stronger border is heavier than no border or a thin one.
  • Texture is heavier than no texture. The denser the texture, the heavier.
  • Colors like red and orange are heavier than calm colors like blue or green.
The human eye is an odd thing it "likes" patterns it can understand easily. The eye understands balance and when faced with something that is out of kilter it will look at the heavy side first as we know that heavy things (in general) carry more importance than light things so in the absence of balance we look for heavy to try and make sense of the imbalance.

We achieve this by scanning a page, painting or website with our eyes looking for balance/imbalance and the thing with the most "Weight". Yahoo! have done some interesting research on tracking the eyes of visitors to various web sites and they have discovered that initially
  • People scan the main (heaviest) part of the page first, this should give us "Context"
  • They make decisions about the page in as little as three seconds based on that scan
  • If they decide to stay, they move their attention to the top half of the screen.
When people do decide to read a page, their eyes sweep horizontally from left to right, often focusing initially on a roughly triangular area in the upper-left corner of a webpage but are dragged towards the "Heavier" parts of the screen or page. Being a designer you can leverage this to your advantage by balancing your page in such a way that you allow your design to lead your users eyes through their visit, both encouraging them to stay and if they do stay making their visit pleasing to look at and use.

There are 3 types of Visual Balance

1. Symmetrical (sometimes called formal) Balance
Symmetrical balance is mirror image balance. If you draw a line down the center of the page, all the objects on one side of the screen are mirrored on the other side (they may not be identical objects, but they are similar in terms of numbers of objects, colors and other elements. Sometimes they are completely identical
Here is a web site that is very nearly completely symmetrical on a vertical access down the middle of the screen. Each side left and right has a similar "weight" and is "balanced".

It is also worthy of note that while the page is balanced Left to Right, it is in a state of imbalance top to bottom. the top is "lighter" and the bottom "heavier". This leads the eye from the top of the page down to the heavier bottom of the page, which is the direction that the designer wants you to take.

Also note the slightly larger tree in the bottom right below "Flexibility", this little bit of imbalance will underline the Flexibility link visually and we will unconsciously be more interested from a visual key in that part of the screen. the designer has done this deliberately to accent the importance they feel in "Flexibility"


2. Asymmetric (Sometimes called Informal) Balance
Asymmetrical balance occurs when several smaller items on one side are balanced by a large item on the other side, or smaller items are placed further away from the center of the screen than larger items. One darker item may need to be balanced by several lighter items.

This example shows an Asymmetric design that it is balanced. The darker right hand panel is smaller that the combined left hand text panels. It is also worthy of note that the eye again is taken from the lighter left most panel through the heavier middle panel and then finally to the left hand heavier panel.


Note in the middle panel the collection of 15 thumnails is at the top.. making the centre column slightly top heavy .. this along with the larger font in the the left hand panel keep the reader's eye in the top half and content rich part of the page.

Although asymmetrical balance may appear more casual and less planned, it is usually harder to to use because the designer must plan the layout very carefully to ensure that it is still balanced. An unbalanced page or screen creates a feeling of tension, as if the page or screen might tip, or things might slide off the side, just as the unbalanced scales would tip to one side.


3. Radial Symmetry
The third type of balance is radial balance, where all elements radiate out from a center point in a circular fashion. It is very easy to maintain a focal point in radial balance, since all the elements lead your eye toward the center.

In this example whilst the designer has nodded at symmetry they have not got it right at all,  the columns are not symmetrical vertically or horizontally. The differences in width are un-balanced, The colours are un-balanced, the lightness/darkness is un-balanced.  You will find your eye scanning up and down left and right in the vain hoping of finding both balance and a place that can be a focus and a place to start.


 So Balance is VERY important in directing your users/visitors to the bits of your app/site you want them to focus on first and then lead them on into content and from their into the depths of your other content.

But BALANCE does not operate in isolation, careful use of proportion helps both balance and allows you to lead the user even more skillfully into your app, and Proportion is what I will look at tomorrow.

Disqus for Domi-No-Yes-Maybe