Categories
Power Dynamics

The Eclipse of the Democratic Delusion

 edical  rofessional stock

No post-agrarian society has ever transferred all power to the people, but some have been fairly successful at involving broad cross-sections of their populace in the decision-making process through stage-managed consultation exercises. At various stages in history we may have fleetingly entertained the illusion of people power in workers' councils set up in the midst of revolutionary uprisings or in experimental communes, but sooner or later new elites would emerge as most practical day-to-day decisions have to be delegated to professionals well versed not just in their field of expertise, but in the nuts and bolts of an interconnected system. The trouble with complex societies reliant on modern technology to help us overcome nature's limitations is our growing dependence on external forces over which we only have theoretical control. The managerial classes, usually specialised much more in arts or liberal studies than hard science, have long endeavoured to isolate and tame the talented engineering classes by rewarding them handsomely for their excellence, but limiting their remit to a small piece of a much larger jigsaw puzzle. If your field of expertise is developing the encryption software for remote access locks purportedly to protect home owners, you cannot be held responsible if your application is used for nefarious purposes, e.g. enabling the police to gain easy access to the private properties of political dissidents.

A key component of the social pact that emerged in most Western (and some Eastern) countries in the four decades following the historical watershed of the Second World War was the enlightenment concept that all human beings are equally valid. Whoever we may be, we all have our needs, feelings and, most important, sense of self. It doesn't matter whether you're a mere street cleaner or the CEO of a large enterprise, you have just one vote in a democratic consultation. In theory the street cleaner is as free to express her views and campaign for her political ideas as a multibillionaire. In practice business leaders can buy influence through their control of the media, funding of academia and lobby groups. Corporations can literally buy the opposition and bankroll campaign groups whose deceptively progressive causes may have hidden agendas.

However, nobody could pretend for long that we are all the same. Arguably our advanced civilisations would fall apart if we were all perfectly homogenised clones devoid of independent thoughts, unless there were some upper tier of more self-aware and analytically minded engineers, whether human or just humanoid robots. In many ways we have replaced earlier deference to our religious and royal leaders with our worship of celebrity opinion leaders and technocratic gurus. Just as we try to sell ourselves the illusion of parallel social progress and material growth, we become forever more dependent on technology few understand. Yet is it unreasonable to ask if we can demand endless entitlements without assuming attendant responsibilities or if we can exert any meaningful control over our labyrinthine system without actively participating in its administration (a task which requires detailed knowledge of complex scientific issues)? In the past we could hold our masters to account by threatening to withdraw our labour. A lorry driver may not have a degree in nuclear physics, but until recently transport workers played a key role in the functioning of finely tuned system. Now it's only a matter of time before all but the shortest deliveries will be made by driverless vehicles or drones. Robots may malfunction, but they do not consciously decide to withdraw their labour. A faulty robot can easily be repaired or replaced without any concerns about its welfare or feelings.

Epistocracy or Expertocracy

Recent democratic consultations in the UK, US, Italy, Austria and Eastern Europe have yielded results that have disappointed the more metropolitan intelligentsia. Yet rather than overtly overturn the democratic will of the people, transnational power brokers have preferred to exert gentle economic pressure on their elected leaders to guide each country towards global governance, albeit with some degree of localisation. When voters fail to endorse progressive policies, the establishment media will dismiss their outlook as populist. Some on the wishful-thinking kum-ba-yah left struggle to understand why the descendants of the local working classes oppose progressive policies such as welcoming more immigrants and greater cultural diversity or embracing the redefinition of families and genders. More surprising is the finding that low to middle income workers are growing sceptical of the benefits of more welfare dependency, as they see their workless neighbours earn more on state handouts than they get toiling away 40 or more hours a week. Sadly as smart automation replaces medium-skill jobs, industrious strugglers will either have to retrain in more cerebral pursuits, a transition that's not always very easy, or give up and join the growing welfare classes. This begs the question if our rulers will ever allow mere consumers with little expertise in any scientific field any meaningful say in the way society is run. And by scientific fields I do not just mean nuclear physics or biogenetics, but social sciences. In the recent debate on gender theory, we've seen the way influential lobbies treat the views of laypersons. If most commoners believe there are only two biological sexes and thus only two accompanying gender roles because that reality is deeply embedded in our collective psyche and confirmed by our everyday experiences, then anointed opinion leaders see it as their duty to educate us. Experts used to mean specialists in particular fields who may share their knowledge with the rest of us so we can make more informed choices. However, experts are often wrong, either because their expertise is too narrow or because their bosses want to pursue an ideological agenda. An expert working for a large organisation is more likely to consider the common good of society than personal needs as people become little more statistics and their bosses are more concerned with maintaining social order than empowering individuals.

Modern multi-party democracies with universal suffrage are a relatively recent development. For much of history parliamentary politics was a game mainly for the landed gentry. Even in the USA the franchise was limited to property owning men until reforms in the late 19th century. As recently as 1970, not only was the whole of Eastern Europe behind the Iron Curtain with only state-managed political parties, but Spain, Portugal and Greece all had paternalistic dictatorships that preferred occasional plebiscites with state-managed media over pluralism with a free press. One may reasonably argue that ruling elites only allow multi-party democracy when they can tame their populace and contain radical dissident to the fringes by providing widespread prosperity and social cohesion through inclusive cultural values. This made sense in an age when advanced societies relied on the efforts of most working-age adults. If society could no longer function without the specialised endeavours of most pre-retirement adults, its managerial classes had both to reward and to respect their underlings. Back in the 1970s key groups of skilled workers could literally bring the country's economy to a halt. While that may inconvenience ordinary people with disruptions of essential service like electricity, railways or coal supply, many could still recall coping with much worse mishaps during the Second World War, in its immediate aftermath or even during natural disasters such as the harsh winter of 1946 / 47. People were still prepared to make do with temporary hardships for the greater good. Business leaders and state planners knew that in order to keep the economy afloat and retain their privileged positions, they had to make concessions to organised labour. While low-skill workers are easily expendable, high-skill professionals need years of hands-on experience as well as a mindset that nurtures technical excellence. Many of today's brightest college students do not learn practical engineering skills at all, but rather how to manage engineering projects, treating the many tricky technical tasks that past generations took countless years to learn as little more than abstract academic subjects. The trials and tribulations of a ship welder gain the same strategic importance as dealing with the mental health of a former employee of a typewriter factory who has failed to transition to a new trade. If a job is both mission-critical and cannot yet be automated, project managers have to deal with human resources. The terminological shift from workforce, personnel or staff to human resources reflects a move away from lifelong professions, often working at the same company for most of one's working life, to temporary agency work or, as some call it, the gig economy. This works well for some intellectually demanding and highly dynamic professions such as software developers. Your market worth depends not just on your portfolio of experience, but also on your proven ability to learn new techniques. If you've specialised in an outmoded language such as Cobol and refuse to learn any more modern programming paradigms, you may find your employability wanes over the years, while if you combine your knowledge of legacy technology stacks with more modern frameworks you may well get a lucrative gig migrating an old code base to a more efficient, versatile and powerful system. Sadly, there is dwindling demand for hyperactive code monkeys who keep, figuratively speaking, reinventing the wheel. Why would you pay someone to solve a problem that has been solved thousands of times before or has a specialised shortcut function of your framework of choice? The only logical answers is that the code monkey is unaware of simpler time-saving options or the project manager has little idea of what the human resource is actually doing. It's usually a bit of both, but often managers will prefer mediocre, but docile, developers over accomplished software engineers whose ingenuity may win them too much power. As time goes by, we can only expect ever greater levels of specialisation in emotional and analytical intelligence to the exclusion of mediocre all-rounders, who have no niche competitive advantages in any endeavour that cannot be assigned to artificially intelligent robots.

Whereas the working classes once meant most economically active adults on low or medium pay, in the near future it may refer to a privileged group of professionals whose talent is mission-critical. Many others may be employed in some perfunctory roles as customer support advisors or lifestyle awareness raisers, mainly to humanise our interaction with a machine-operated system. Such auxiliary workers are expendable. A supermarket with automatic checkouts, RFID-tagged products and shelf-stacking robots could with current technology already run smoothly without human resources, but most customers still like to interact with real flesh-and-blood human beings, whose roles will only be advisory.

Let us just imagine what would happen if all social workers and health and safety inspectors went on strike. Would the economy grind to halt? Would vital services be interrupted? Would there be an instant breakdown in law and order? The answer is in the short-term nothing would change, but over time the managerial classes would have to find other means to monitor their finely tuned system.

https://www.youtube.com/embed/RFV8IkY52iY

The problem with Marxism

Marxist theory foresaw a class struggle in which the workers would rise up to overthrow their capitalist bosses and seize control of the commanding heights of the economy. We may debate whether this could ever have been achieved without transferring power to a new ruling elite or destroying an economy dependent on the technological innovation of highly motivated skilled professionals, but the shrinking size of the proletariat may soon make this controversy rather academic. This begs the question what pressure can the welfare-dependent classes exert on the technocratic and administrative classes?

I suspect our rulers will keep alive democratic consultations in some form, but that professional policy makers and opinion leaders will restrict mainstream debate to a narrow range of policy options. All other perspectives will be labelled extremist, reactionary or delusional and at odds with official sources of scientific truth. Slowly but surely the professional elites have begun to treat populist opinions, e.g. favouring traditional two-parent families or compact nation states, as mental health issues that they need to address with better education and more extensive social surveillance. All four main parties in the Scottish Parliament support what we can best call the progressive agenda, with a few of caveats to placate conservative popular opinion. Ruth Davidson of the Scottish Conservative Party has not only championed gay rights as newly wed lesbian women expecting her first child from the local fertility clinic, but she has argued vociferously for high levels of net migration and continued membership of European Union. In effect social conservatives in Scotland have no elected representatives. Yet a recent opinion poll in the Sun found that only 15% of Scottish youngsters between the ages of 18 and 25 wanted higher levels of immigration and most wanted a reduction, although the effects of mass migration are much less pronounced in provincial Scotland outside Glasgow and Edinburgh. I wonder what percentage of Scottish parents welcome their government's decision to teach gender theory (the idea that gender is a social construct and you can choose your gender identity) to primary school children. I suspect it may be even lower than 15%, but this policy is supported by over 80% of parliamentarians and the official Conservative position is we should wait until children are 8 rather than introduce such concepts as young as 5 years of age.

Jason Brennan calls this new form of rule by the enlightened elite Epistocracy formalising the current roles of unaccountable policy planning institutes in setting the agenda for the infantilised masses, whose disapproval in any consultation exercises may only temporarily slow the pace of change and prompt social engineers to adjust their persuasion strategies. That's why complex subjects such as migration are often reduced to feelings rather than objective analysis of decades of social research. By emotionalising complex subjects and artificially creating new victim groups, opinion leaders can dismiss thoughtful dissent as hate speech.

Once we have defined progress as a transition to a technocratic utopia, in which human feelings are treated as medical conditions and all human interactions are micromanaged to ensure social stability and protect the interests of the professional elites, we need only debate how to persuade the masses to accept their new engineered reality.

Categories
All in the Mind Power Dynamics

Your services are no longer required

Universal Basic Income for all (Terms and conditions apply)

On behalf of trendsetting businesses around the world, we'd like to thank all semi-skilled workers for your tireless devotion to the complex industrial system on which we all depend. We are truly grateful to all our past and present colleagues and business partners including production line operatives, meat packers, welders, textile workers, millers, steelworkers, coal miners, mechanics, electricians, plumbers, builders, carpenters, farm labourers, fruit pickers, truckers, bus drivers, cleaners, shop assistants, cooks, waiters, typists, accountants and the thousands of other specialised roles that have served us well over the last 250 years.

Over the decades we have endeavoured to improve working conditions, raise salaries and address emotional issues such as stress, anxiety and interpersonal relations that may arise in the modern workplace. However, we have always had to strike a fine balance between the wellbeing of our staff and our commercial viability.

To this end, our team of robotics engineers and artificial intelligence programmers have now successfully developed a range of smart automatons who will relieve you of your daily drudgery and let you spend more time with your friends and family, unleashing a new world of playful creativity and exploration. As a sign of our lasting appreciation we have lobbied your governments to provide a global basic income, which you may spend online or at any of our authorised retail outlets or leisure centres. In keeping with our commitment to universal human rights and inter-community tolerance, we will extend our universal basic income to all world citizens, irrespective of gender identity, sexual orientation, disability, religious affiliation, ethnic origin or mental health challenges, provided you agree to our terms and conditions* and cooperate fully with our friendly social harmony supervisors.

  • Mark Zuckerberg, CEO of Facebook source
  • Elon Musk, CEO of SpaceX source
  • Jeff Bezos, CEO of Amazon
  • Larry Page, CEO of Alphabet Inc
  • George Soros, primary supporter of the Open Society Foundation

The above announcement is of course fictitious, but based on current social trends. A populace fully controlled by a technocratic elite and totally subservient to an army of humanoid robots, social workers and psychiatric nurses is no longer science fiction, it's an emerging reality. The main questions relate to its implications for personal freedom and our sense of purpose in life as well as the likelihood of societal breakdown if things do not work out as planned.

Categories
Computing

Why are there so many recruiters?

I don't know about you, but 90% or more of my linkedin contact requests come from recruiters. I don't accept them all. Am I the kind of talented high-flyer you would want to headhunt? Probably not, in person I'm rather shy and certainly not management material. I suppose I just know a few esoteric programming tricks and have a good understanding of data and information architecture. What's more, apart from a few modules taken as part of an Open University degree, I'm entirely self-taught. With all these young whizkids graduating in IT-related degrees in a country obsessed with electronic gadgets multimedia wizardry, you'd think I'd have plenty of competition from young twenty-somethings. Despite high youth unemployment and free access to tutorials on just about any programming framework that takes your fancy, relatively few youngsters get beyond writing a few lines of Javascript. Unfortunately the tech industry does not need mediocre code monkeys who can churn out repetitive procedural scripts, for that task can be fully automated. In the software industry you do not judge someone's productivity by the amount of code they write or even by the number of hours they work, but how well their application performs. To produce lean and mean applications, you need to get your head around various programming algorithms and design patterns. Yes, it really does matter if you pass a variable by reference or by value or if you clumsily copy and paste variants of some old procedural routine rather than encapsulate it in a neat reusable function.

A good developer never stops learning new techniques to write better, more expressive, more maintainable and more efficient code, rather than clever tricks to automate monotonous tasks. That means good hands-on developers are nearly always geeks, as we have to dedicate much of our time to learning new languages and cutting-edge techniques We can learn some things by social osmosis, but only if we understand core concepts that relate to direct experience. Indeed if a subject does not actively interest us, that's what most of us do. We rely on other people's expertise, but know enough about the subject to avoid getting ripped off. In some academic fields a specialist in someone who has researched a subject extensively, but in most hard sciences specialists are people with active hands-on experience. Unless you have written and tested applications with complex and irregular business logic, you wouldn't be able to appreciate what application developers do. They just sit in front of screens writing quirky symbols with a few English-like key words. Concepts such as design patterns mean little if you have just learned how to do a simple loop. Now suppose you need to hire a new developer, for sake of argument, let's just assume you need a good NodeJS specialist. Who could possibly judge if a candidate knows their stuff? They may have an excellent CV, good qualifications and some good references, but in today's fast-changing world, these mean very little. Millions have worked directly or indirectly for major media multinationals. If you say you worked on the BBC news Website, which bit did you do? Did you just design a prototype for a new button or test a new interactive widget on different browsers? Does your recruiter really understand what skills are required?

Recruiter
Hello, Neil. It's Ryan Adams here. Look we've got a Drupal gig on at Arty Farty New Age Media over in Soho. They need a hard-core backend guy like yourself for a couple of weeks. Would £400 a day tempt you?
Me
Well, actually I'm very busy at moment (trying to fix someone else's awful code), but might be available in a couple of weeks (just in case my contract is cut short).
Recruiter
They really need someone to start straight away. This is for a massive media campaign of a leading household brand.
Me
What happened to the previous developer?
Recruiter
Oh, he had issues, some of kind of personality clash, I think. How about £450 a day?
Me
If we continue this conversation, my contract here will be terminated. Let me get back to undoing the mess the last developer here created.
Recruiter
Is your boss looking for any new developers?

One way or another for every real hands-on developer out there there's at least one recruiter, one project manager, 1 business analyst, a marketing wonk and an accountant (because many IT professionals are contractors with their own limited companies). For some jobs in London's frenetic media sector, I've been contacted by five or more recruiters from different agencies for the same job. "Do you have experience with Solr, the Zend framework, Git and IPTV?" enquires a 22 year old IT graduate. These are really just buzzwords, which mean little until more details are revealed. In most cases they just need an experienced developer who happens to have a used the required programming language in the context of a specific framework and has worked in small teams with agile methodology. Requiring a good understanding of business processes is a good way to weed out self-taught novice programmers or inexperienced IT graduates.

For over 20 years the UK education system has produced millions of graduates who can, figuratively speaking, talk the talk, and not so many who can walk the walk. Although our way of life relies on complex technology, few have more than a cursory overview of its inner workings, but millions are employed in managing the complex human interactions between business owners, government agencies and mission-critical human resources. If all recruiters went on strike tomorrow, no essential services would be disrupted. Life would carry on as usual, except slowly lead developers would have to spend a little more time hunting new talent and would probably choose other geeks just like themselves. That is precisely the scenario, that upper management would prefer to avoid. They do not want a new category of indispensable engineers who can hold their business to ransom. They do not want technical experts to see the whole picture or even gain credit for the fruits of their labour. Meeting business requirements often means just accepting you're a cog in a much bigger machine and cannot work out of sync with all the other cogs, chains, pulleys and lubricating fluids.

Categories
Computing

The Copy and Paste Design Pattern

copy paste

All good programmers understand the concept of design patterns, creational patterns, structural patterns and behavioural patterns. We apply these patterns in different aspects of our projects. It's good to recognise common patterns so we can generalise routines into reusable functions, methods or classes. I won't bore you with the details because you can learn more from a wealth of other online resources, but two key principles underly all design patterns:

  1. Think strategically about your application architecture
  2. Do not Repeat Yourself, aka, DRY. Organise your code so common routines can be reapplied.

Great, but in my humble experience we should add probably the most common design pattern of them all, though strictly speaking it's an anti-pattern: Adaptive Copy & Paste. The core idea here is if it works for somebody else you can just copy, paste and post-edit their code. Sometimes you can begin with some really good snippets of well-structured and commented code, but all too often online code samples are just formulaic and adapted from textbook boilerplate code. I've seen blocks of code pasted into Javascript files with references to StackOverflow.com complete with source URLs and deployed on high-traffic live sites. Let me show you a simple example:

var GBPExchangeRates = {
    USD: 1.52,
    EUR: 1.38,
    CDN: 1.57,
    SKR: 12.89,
    AUD: 1.45,
    CHF: 1.76
  };

  function convertGBPToEuro(GBPVal) {
    if (typeof GBPVal == 'string') {
        GBPVal = GBPVal.repplace(/[^0-9.]/g,'');
        if (GBPVal.length>0) {
            GBPVal = parseFloat(GBPVal);
        }
    }
        if (typeof GBPVal == 'number') {
        return GBPVal * GBPExchangeRates.EUR
    }
    return 0;
  }

  function convertGBPToUSD(GBPVal) {
    if (typeof GBPVal == 'string') {
        GBPVal = GBPVal.repplace(/[^0-9.]/g,'');
        if (GBPVal.length>0) {
            GBPVal = parseFloat(GBPVal);
        }
    }
    if (typeof GBPVal == 'number') {
        return GBPVal * GBPExchangeRates.USD
    }
    return 0;
  }
  
  var coffeePriceGBP = 1.90;
  
  var teaPriceGBP = 1.10;
  
  var orangeJuicePriceGBP = 1.50;
  
  var coffeePriceEUR = convertGBPToEuro(coffeePriceGBP);
  
  var teaPriceEUR = convertGBPToEuro(teaPriceGBP);
  
  var orangeJuicePriceEUR = convertGBPToEuro(orangeJuicePriceGBP);
  
  var coffeePriceUSD = convertGBPToUSD(coffeePriceGBP);
  
  var teaPriceUSD = convertGBPToUSD(teaPriceGBP);
  
  var orangeJuicePriceUSD = convertGBPToUSD(orangeJuicePriceGBP);
  

For a beginner, this is honestly not that bad at all. First we set up a simple object of common currencies with their exchange rates. In the real world this may come from some sort of feed. Next we devise a neat function to convert our GBP prices to Euros. Just to make it failsafe, we make sure we can handle strings with a mixture of numerals and currency symbols, which may include commas or other symbols than decimal points. If we only ever had to convert between British pounds and Euros, that would be just fine, though we may convert all prices via some sort of loop rather than make separate calls for each prices. Here for just three prices and three currencies, we need to set nine explicit price variants and six explicit function calls.

However, later an intrepid project manager decides we need to support other currencies and may need to convert other units too, such as measurements or clothes sizes, so a busy code monkey promptly copies, pastes and adapts the first method to USD. Not too bad we only have two functions, but they contain much shared logic. Indeed the only difference in the conversion rate. We should break down this logic into steps. First we test if the input is a number (Javascript has a generic Number type that covers both floats and integers). Next we strip any non-numeric characters and cast to a float if the result is not empty. Only then do we apply our conversion rate. The above code could be even worse. We could have opted to hard-code the conversion rate. This may work for constants, such inches to centimetres, but it doesn't work for variables like exchange rates. What we need a generic method to convert number-like strings to true floats and another generic method to apply conversion rates from simple key/value objects.
Javascript makes it very easy for us to apply the decorator pattern by extending an object's prototype. This allows us to chain methods in a very self-descriptive way.

String.prototype.numeralsOnly = function() {
    return this.replace(/[^0-9.]/g,'');
}

String.prototype.toFloat = function() {
    var self = this.numeralsOnly();
    if (self.length < 1) {
        self = 0;
    }
    return  parseFloat(self);
}

Number.prototype.toFloat = function() {
    return parseFloat(this);
}

Object.prototype.matchFloat = function(key) {
var obj = this, val;
    if (obj instanceof Object) {
        if (obj.hasOwnProperty(key)) {
            val = obj[key];
            if (val) {
                return val.toFloat();
            }
        }
    }
    return 0;
}

Number.prototype.convert = function(fromUnit,toUnit,units) {
    if (units instanceof Object) {
        return this * (
        units.matchFloat(toUnit) / units.matchFloat(fromUnit)
        );
    }
}

We then apply a simple conversion table:

  var rates = {
    GBP: 1,
    USD: 1.53,
    EUR: 1.37,
    YEN: 132.2,
    RUB: 12.7
  };

Then if we were to allow users to convert to the currency of their choice, we could simply add prices in the base currency (in this case GBP) via some hidden element and then apply the conversion factor via the Document Object Model (or DOM):

  $('table thead .currencies .option').on('click',function(e){
    var it = $(this),
      tb = it.parent().parent().parent().parent(),
      selEl = it.parent().find('.selected');
    if (selEl.length < 1) {
      selEl = it.parent('em').first();
    }
    var selCurr = selEl.text().trim().toUpperCase(), tgCurr = it.text().trim().toUpperCase();
    tb.find('.price').each(function(i){
      var td = $(this),
      nVl = td.attr('data-gbp').toFloat().convert('GBP',tgCurr,rates);
      td.html(nVl.toFixed(2));
    });
    
  });

This may look like more code, but we now have a solution that works with any currencies and any number of data items to be converted. Moreover, our convert method may be applied to any units. If we wanted to present volumes in either millilitres or fluid ounces we would just include our decorator methods as a library, set up a conversion table and write a short DOM script. 90% of the code would have been tested for other use cases:

var volumeUnits = {
    ml: 1,
    l: 1000,
    floz: 29.5625
}

Good programmers always think out of the box, not just how to solve the current problem as presented by a project manager, but how do I solve other problems like this? More important, we should ask how to make our code more maintainable and easier to test.

Common Mistakes

  1. Placing editorial content in code files that only developers know how to edit: e.g. A senior manager has decided to edit some text on your company's online shop. The only reason she needs to involve you in this editorial change is because your predecessor placed the text in a template or even worse embedded it verbatim on line 1451 of a fat controller file. What should you do? To make your life easy you could just edit the offending line and write a note for future developers that this text is hard-coded in such and such a file. Management will then think that whenever they wish to edit content they need to ask your project manager to ask you to apply some cryptic code change. However, later they will review their IT budget and decide you are too expensive and then outsource the whole project to a low-wage country or replace it with a state-of-the-art content management system that let's them edit any content without any programming knowledge. What you should do is suggest all such content should be editable in a special admin area and all hard-coded text, media or numbers should be replaced with references to editable content.
  2. Quoting one programming language in another: This is surprisingly common. The main reason for doing so is to inject server-side variables into client-side scripts, e.g. using PHP to build a Javascript routine with a few variables generated dynamically by the server. Not only does this make your Javascript very hard to debug, but it inevitably leads to more repetitive and thus slower Javascript. If you want to fetch data from the back-end, you should inject it as hidden attributes that Javascript can read or simply inject some JSON easily converted from native server-side objects or make an asynchronously request with a JSON response. Keep your javascript lean and mean and ideally in separate files, so your browser can cache these resources more efficiently. If you're using backbone.js or jQuery or other framework, these can be loaded from a content delivery network or CDN.
  3. Repeating routines: Whenever you find yourself repeating a routine more than once, you need a new function or at they very least a loop:
    var d = new Date(item.created);
   item.created_date = d.getDate() + '/' + (d.getMonth()+1) + '/' + d.getFullYear();
   
   var d = new Date(item.modified);
   item.modified_date = d.getDate() + '/' + (d.getMonth()+1) + '/' + d.getFullYear();

This is messy. What we need is a generic date conversion function:

var isoDateToEuroDate = function(strDate) {
    var d = new Date(strDate);
     return d.getDate() . zeropad(2) + '/' + (d.getMonth()+1) . zeropad(2) + '/' + d.getFullYear();
}

And if we're doing a lot of date manipulation,we might like to include a date library to make our code simpler. Your bosses may not notice that you are just writing the same code over and over again, but if your code becomes very expensive to maintain, they will either ditch it or outsource your work to some hapless code monkeys on a fraction of your wage.

Categories
Computing

Old Browsers

If the main body of this page has rounded corners and subtle drop-shadow effects with a stylish Diavlo font face instead of Arial / Helvetica / sans-serif, chances are you are already using a modern browser. If you see square borders and a default sans-serif font, then you should be aware your browser doesn't support the latest Web standards making the life of Web designers rather difficult. This site looks great on Android phones and tablets, iPhones and iPads, but will look rather dated in Internet Explorer 6, 7 and 8.

Modern browsers such as recent versions of Firefox, Chrome, Safari, Opera and Microsoft's upcoming Internet Explorer 9 support CSS 3 meaning effects that previously required a complex maze of background graphics and endless hours of testing of different variants of major browsers can now be achieved with a few lines of code.
Newer browsers also render javascript much faster, making it easier to develop Web applications that look and feel like native applications.

Still using Internet Explorer 6?

Here are just some of the reasons you might want to upgrade:

  • It does not support W3C standards.
  • It is not compatible with CSS3 and only partially supports CSS2.
  • It has a very low score in Acid 3 test.
  • It is insecure and slow.
  • Several movements against this browser have sprung up: IE Death March, Dear IE6, Stop IE6.
  • Google has officially stopped supporting it in its Web applications.
  • A funeral has been celebrated
  • Microsoft has discontinued support, focussing on its next generation IE9
  • The browser lives on in intranets reliant on dated and inherently insecure Active-X technology and unpatched versions of Windows XP. IE7 was released in early 2006.

We strongly recommend that you download one of the following browsers:

Bad Boy Browsers

When the Internet took off in the mid to late 90s, most sites were, by today's standards, rather basic pages, often handcoded and uploaded via FTP.  Tim Berners Lee invented HTML as a medium for linking a web of related text documents. Indeed the image tag was added almost as an afterthought in HTML 2. However, as the World Wide Web expanded, the two main browsers of the era, Netscape Navigator and Internet Explorer, added a plethora a style tags and designers began to use tables, originally intended only for tabular data, to implement complex pixel-perfect designs. By the late 90s most commercial sites were a maze of nested , , and
tags with reams of inline style information. When Internet Explorer won the first round of the browser wars, its quirky implementation of the World Wide Web Consortium's (W3C) HTML 4.0 and CSS1 became the de-facto standard and Microsoft didn't see fit to update its IE6 browser released in 2001 until 2006. While innovative in its time, IE6 is simply ancient in terms of Web evolution. HTML is only 17 years old and IE6 over 9 years. For more advanced behaviour Microsoft introduced its own proprietary scripting language, Active X, integrated with its proprietary operating systems Windows 95/98/200/XP. While this faciliated the development of Web applications and their interaction with native Windows TM programs, it was a security nightmare outside firewall-protected intranets. As Web usage expanded exponentially post 2002 with the advent of broadband services, demand grew for better integration of images, audio and video as well as cross-platform Web applications, but mainstream browser technology clearly prevented further progress without resorting third-party plug-ins such as Adobe TM Flash or more recently Microsoft Silverlight. This means not only purchasing proprietary software (Adobe Flash Studio, Illustrator and/or Photoshop or M$ Visual Studio), but also hiring expensive AS3 developers instead of letting a Web designer accomplish the same ends. While such third-party solutions can provide impressive results for some games and special effects, they are not integrated with other Web standards such as HTML, CSS (Cascading Style-Sheets), Javascript and the little-known SVG standard (Scalar Vector Graphics). It has largely been the open-source community, the Mozilla Foundation and more recently a rather ironically, Apple Inc., to insist on Web standards for multimedia. HTML5 now supports not only more advanced style effects, but also video, audio and canvas elements enabling videos, sound clips and vector-graphic animation to be embedded into your browser natively and directly manipulated by Javascript. Recently we've seem huge gains in browser performance with Chrome, Safari and Opera regularly claiming the top spot with Firefox 4 catching up fast. Even Microsoft, with its new IE9 browser (only compatible with Windows Vista and 7), has shifted its focus from Silverlight to HTML5.
For once we have good news for Web Developers and bad news for vendors of proprietary solutions.