Quick Contact

T: +66 (0) 89 488 0397
T: +44 (0) 151 324 1586
E: hello@codebox.co.uk

Twitter: @codeboxdev

Thailand Address
164/137 Moo 1
T. Pimonrad
A. Bangbuatong
11110
THAILAND

UK Address
79 Cortsway
Greasby
Merseyside
CH49 2NA

CodeBox Blog

  • RSS

Statistics

  • Entries (12)
  • Comments (2)

About the Author

Chris Iveson, CodeBox OwnerChris Iveson has been developing software professionally on Microsoft based systems for over 12 years, building web and Windows-based solutions for the maritime and offshore industries. Chris has been based in Thailand since 2001, working with several shipping companies in the South-East Asia region, and enjoying learning the "ins and outs" of being based in Asia. When not attached to an keyboard attached to an LCD screen, Chris can be found either down the gym, or championing the latest top British TV.

Chris's LinkedIn Profile

Rolling Blog Content on Static HTML Site 

Posted by Chris Tuesday, July 31, 2012 3:45:00 AM

The problem:
A static html site, which the site owners cannot upgrade to a more dynamic site at time of writing, is required to present a summary of the latest Blog posts (hosted on another WordPress site and available via RSS) on one or more of the static pages.

Proposed Solutions:

Initial thoughts were to have client-side Java script executing on the static pages required to present the content, reading the RSS feed in dynamically and transforming it into HTML on the page.

 

Unfortunately this approach isn't a perfect solution, particularly in regards to how the pages are indexed by search engines spiders. Because such spiders don't execute any JavaScript on the pages they index, the HTML rendered by the JavaScript processing the feeds are never indexed. Owing to this, the search engine spiders will never "see" the blog content, unless it's linked to from another source.

 

What is needed is some method whereby the static content within the raw html files can be updated dynamically by another process. Given the format of the feed is XML, it would make sense to transform the feed into HTML using XSLT. Our process could then read in the XML feed, apply the XSLT to generate the HTML clipping, then insert it dynamically into the static HTML file using some form of placeholder.

 

To do this using Microsoft.Net is a fairly trivial task; the libraries within the Net framework contain many methods of manipulating XML data.

 

The two main transform the RSS feed and insert it into a specified HTML file are presented below:

 

    static string transformFeed(string feedUrl                                string xlstFile)
    {
      var xslt = new XslCompiledTransform();
      MemoryStream outStream = new MemoryStream();
      xslt.Load(xlstFile);
 
      // create the writer which will output the 
      // transformed xml
      var sb = new StringBuilder();
      var tt = new XmlWriterSettings();
      tt.Encoding = Encoding.Unicode;
      
      var results = XmlWriter.Create(
                   new StringWriter(sb), tt);
      xslt.Transform(feedUrlnullresults);
      return sb.ToString();
    }
 
    static void applyToHtml(string transformedRss                            string marker,
                            string source                            string destination)
    {
      var reader = new StreamReader(source);
      var writer = new StreamWriter(destination                                    false);  
 
      // read through the source HTML file on a 
      // line-by-line basis
      while (!reader.EndOfStream)
      {
        var line = reader.ReadLine();
        line = line.Replace(markertransformedRss);
        writer.WriteLine(line);
      }
      reader.Close();
      writer.Close();
    }

The source for the complete application (click to download) contains an example XSLT file, which can be supplied to the above functions via command line arguments (parsed using the NDesk Options program option parser). The arguments required are as follows:

-f The URI of the RSS feed to process

-x The local XSLT file to use to transform the RSS feed

-s The local HTML template file containing the marker

-m The marker to find and replace within the HTML template

-d The location of the final HTML file containing the processed feed.

 

For example, using the following parameters to launch the app...

 

RssInserter.exe -s C:\temp\index-template.html 
-d C:\temp\index.html -x C:\temp\feedparser.xslt 
-f http://someblog.com/feed -m "<!--SOMEMARKER-->"

 

... will open the (ficticious) RSS feed someblog.com/feed, transform it using the feedpaser.xslt file, then insert its contents into the index-template.html file whereever it finds the marker <!--SOMEMARKER-->. The final contents will be outputted into the index.html file.

 

Of course, all this is dependent on being able to run the process on the same machine hosting the static website. If it is possible to do this, it's also highly likely the server is already capable of running dynamic content. However, in situations where the static content is hosted remotely and only accessible via FTP, it wouldn't be too difficult to create the HTML from an RSS feed on a third server. This third server could host the process by implementing it on an ASP.net page, which is then hit periodically by a service such as Monitor.Us. The process on the ASP.net page could then upload the final HTML server to the remote static site via FTP each time a change to the feed has been detected.

 

Implementing A CheckBoxList-Style Interface in ASP.net MVC3 

Posted by Chris Monday, October 24, 2011 2:05:00 PM

Searching around, this is a task which appears to catch a few people out. One method of implementing a list of checkboxes has been summarised quite well over on StackOverflow. The problem I found with this summarisation however is it didn't quite document to update database entities, particularly entities which provide M:M (many-to-many) relationships between two other entities (e.g. Books and Categories, Courses and Students etc).

So first let's get started with the code for those entities, which should make it more clearer what we're trying to achieve:

namespace SomeSite.Domain.Entities
{
  [Table(Name = "Books")]
  public class Book
  {
    [ScaffoldColumn(false)]
    [Column(IsPrimaryKey = true, 
            IsDbGenerated = true, 
            AutoSync = AutoSync.OnInsert)]

    public int BookID { get; set; }
    
    [Display(Name = "Book Name")]
    [Required(ErrorMessage = 
      "Please enter an Book name")]
    [Column] public string BookName { get; set; }

    [Display(Name = "Book Author")]
    [Required(ErrorMessage = 
      "Please enter an Book author")]
    [Column] public string BookName { get; set; }

    private EntitySet<BookCategory> 
      _bookCategorys = new EntitySet<BookCategory>();

    [System.Data.Linq.Mapping.Association(
      Name = "FK_Categories_Books", 
      Storage = "_BookCategories", 
      OtherKey = "BookID", ThisKey = "BookID")]

    public ICollection<BookCategory> 
      BookCategories
    {
      get { return _BookCategories; }
      set { _BookCategories.Assign(value); }
    }
  }

  [Table(Name = "BookCategories")]
  public class BookCategory
  {
    [ScaffoldColumn(false)]
    [Column(IsPrimaryKey = true, 
            IsDbGenerated = true, 
            AutoSync = AutoSync.OnInsert)]
    public int BookCategoryID;

    [Column] public int BookID;

    private EntityRef _book = 
      new EntityRef();

    [System.Data.Linq.Mapping.Association(
       Name = "FK_BookCategories_Books", 
       IsForeignKey = true, 
       Storage = "_book", 
       ThisKey = "BookID", 
       OtherKey = "BookID")]

    public Book Book
    {
      get { return _Book.Entity; }
      set { _Book.Entity = value; }
    }

    [Column] public int CategoryID;
    private EntityRef _category = 
      new EntityRef();

    [System.Data.Linq.Mapping.Association(
      Name = "FK_BookCategories_Categories", 
      IsForeignKey = true, 
      Storage = "_category", 
      ThisKey = "CategoryID", 
      OtherKey = "CategoryID")]

    public Category Category
    {
      get { return _Category.Entity; }
      set { _Category.Entity = value; }
    }
  }

  [Table(Name = "Categories")]
  public class Category
  {
    [ScaffoldColumn(false)]
    [Column(IsPrimaryKey = true, 
            IsDbGenerated = true, 
            AutoSync = AutoSync.OnInsert)]
    public int CategoryID { get; set; }
    
    [Display(Name = "Category Name")]
    [Required( ErrorMessage = 
      "Please enter an Category name")]
    [Column] public string CategoryName { get; set; }

    private EntitySet<BookCategory> 
      _BookCategories = 
      new EntitySet<BookCategory>();

    [System.Data.Linq.Mapping.Association(
       Name = "FK_Categories_Books", 
       Storage = "_BookCategoriess", 
       OtherKey = "CategoryID", 
       ThisKey = "CategoryID")]

    public ICollection<BookCategory> 
      BookCategories
    {
      get { return _BookCategories; }
      set { _BookCategories.Assign(value); }
    }
  }
}

Looks complex, but really three simple entities - two containing data ("Book" and "Category"), with a third "BookCategory" entity providing the many-to-many relationship. The entity classes have been marked up with LinqToSql and data modelling attributes which determine how they are presented to the user and entered into the database.

Problem is if we want to create a MVC3 web form allowing a user to specify the name, author and categories of a book, we can't just throw the Book entity as the model between the controller and the view. Doing so will give us the Name and Author prompts, but nothing else. What's needed is specific model which references the Book object we want to modify, along with the available categories for the user to select:

namespace SomeSite.WebUI.Models
{
  public class EditBookModel
  {
    IRepository repository;

    public EditBookModel() { }

    public IRepository Repository
    {
      get { return repository; }
      set { this.repository = value; }
    }

    public EditBookModel(IRepository Repository)
    {
      repository = Repository;
      this.Book = new Book();
      populateCategories();
    }

    public EditBookModel(IRepository Repository, 
                        int BookID)
    {
      repository = Repository;
      this.Book = repository.Books
        .First(x => x.BookID == BookID);
      populateCategories();
    }

    private void populateCategories()
    {
      PresentedCategories = 
        new List<SelectableItem>();

      foreach (Category Category in 
               repository.Categories)
        PresentedCategories.Add(new SelectableItem {
          ItemID = Category.CategoryID,
          ItemName = Category.CategoryName, 
          IsSelected = Book.BookCategories
            .Any(x => x.CategoryID == 
                         Category.CategoryID)
        });
    }

    public void Update()
    {
      repository.Save<Book>(this.Book);

      var selectedCategories = PresentedCategories
        .Where(x => x.IsSelected);

      // delete any assigned Categories 
      // that have not been selected
      foreach (var BookCategory in 
              this.Book.BookCategories)
        if (!selectedCategories
            .Any(x => x.ItemID == 
                         BookCategory.CategoryID))
          repository.Delete<BookCategory>(BookCategory);

      foreach (var selectedCategory 
               in selectedCategories)
      {
        // it's not any of the currently
        // assigned Categories
        if (!this.Book.BookCategories
             .Any(x => x.CategoryID == 
                          selectedCategory.ItemID))
        {
          // add it
          var BookCategory = new BookCategory
          {
            BookID = this.Book.BookID,
            CategoryID = selectedCategory.ItemID
          };
          repository.Save<BookCategory>(BookCategory);
        }
      }
    }
    
    public Book Book 
     { get; set; }
    public IList<SelectableItem> PresentedCategories 
     { get; set; }
  } 

  public class SelectableItem
  {
    public int ItemID { get; set; }
    public string ItemName { get; set; }
    public bool IsSelected { get; set; }
  }
}

Again, complex look but really pretty simple. Two constructors - one which takes a repository object only and to be sent to the view when adding a new book, the other which takes a repository object and book ID, to be called when updating an existing book. Both of these constructors call the "populateCategories()" function which iterates through the available categories populating a List collection of "SelectableItem" objects. It is these SelectableItem objects in the model which will be used to present the checkboxes. Note that we don't use a list of Category objects here - reason being we'd be sending unnecessary information (the other members in the Category class) to the browser and back. Using this approach the SelectableItem class can also be reused for areas where other lists of checkboxes are required.

Lastly there's an "Update()" public method which iterates through the existing categories associated with the book and removes any BookCategory records from the database that have not been selected, and then iterates through the selected categories in the SelectableItem list, creating new BookCateogory records which do not exist.

Next up is the view. There's actually two of them - one to display the edit book web form, another to dictate how each instance of a "SelectableItem" object should appear. First off, the EditBook.cshtml web form:

@model SomeSite.WebUI.Models.EditBookModel

<h2>Admin : Edit Book @Model.Book.BookName</h2>
@using (Html.BeginForm("EditBook", "Admin")) { 
  @Html.ValidationSummary() 
  @Html.HiddenFor(x => x.Book.AccountID) 
  @Html.EditorFor(x => x.Book)
  @Html.EditorFor(x => x.PresentedCategories) 
  <input type="submit" value="Save" /> 
  @Html.ActionLink("Cancel and return to List", 
                   "Book") 
} 

Now, the SelectableItem.cshtml file. This needs to go under a "EditorTemplates" sub-directory under the "Views" directory where the EditBook.cshtml resides in the project, or in the "/Views/Shared/EditorTemplates" directory (more good info on these EditorTemplate models can be found here):

@model SomeSite.WebUI.Models.SelectableItem
<div>
  @Html.HiddenFor(x => x.ItemID)
  @Html.CheckBoxFor(x => x.IsSelected)
  @Html.LabelFor(x => x.IsSelected, Model.ItemName) 
</div>

Lastly, the controller which implements the "EditBook" methods:

namespace SomeSite.WebUI.Controllers
{
  // DI-style constructors which accept 
  // the "repository" object go here
  
  public class AdminController : Controller
  {
	public ViewResult AddBook()
    {
      return View("EditBook", new Book());
    }

    public ViewResult EditBook(int BookID)
    {
      var editedBook = 
        new EditBookModel(repository, BookID);
      return View(editedBook);
    }

    [HttpPost]
    public ActionResult 
      EditBook(EditBookModel EditedBook)
    {
      if (ModelState.IsValid)
      {
        EditedBook.Repository = repository;
        EditedBook.Update();
        return RedirectToAction("Index");
      }
      else
      {
        return View(EditedBook);
      }
    }
  }
}

As you can see, the controller is also relatively simple as the majority of work updating the entity classes is done within the EditBookModel class.

Okay, so it's not quite as simple as placing a CheckBoxList control on a webform, which is populated with a few lines within a "codebehind" file. However it's much lighter than than the Web Forms approach, and the code above can easily be engineered for reuse.

All wonderful friendly feedback appreciated :)

Software Documentation, The Agile Way 

Posted by Chris Monday, October 17, 2011 11:45:00 AM

Software Documentation and Agile?It's a question that every software developer faces sooner or later, and to which sheepish answers are usually given in response. The question - in question - is usually along the lines of "is this software documented?". And the answers are sheepish - not because the real answer is at risk of being disappointing - but mainly because the question itself can be considered vague from the perspective of the developer. What sort of software documentation is the person requesting it after? Architectural and design documentation? Documentation of the source code? How much depth is required behind the documentation? Who is the intended audience of this documentation?

Well more often than not this question is being asked by the person people the software for the liability purposes; addressing the age-old concern of what do they do should the original developers be rendered unavailable for whatever reason. However what is often not realised by such people is that for many developers - myself very much included - when reviewing new source code for the first time, it's not the documentation which is first referred to, but the actual source code itself. The only written documentation we're generally interested in initially is anything that describes what the system is intended to achieve. From that point onwards, it's usually a case of examining the system itself and the source code behind it to discover how it's done. If anything is then unclear or ambiguous whatever documentation there is then referred to, and often with disappointing results; developers are infamous for approaching the act of documentation with the same enthusiasm of answering the original documentation question mentioned above.

This is not to say such documentation is useless; one motivating reason for documenting software from the perspective of the developer is to state the reasoning behind design decisions which may otherwise not become obvious to other developers until well into the software development process. As an example, such design decisions could be whether to hold all customer records in memory from the beginning, or whether to load when the user requests the customer details. Or whether to calculate customer invoice charges as items are added to an invoice, or when the final invoice is produced for the customer etc. Documentation is also required to inform other developers of the correct way to "consume" their code e.g. in what order members of an object (objects being the individual building blocks of a software application) should be called, the correct values which should be assigned to such members and their parameters etc.
 
The good news is that the people behind the development tools used by such developers, and the people behind the software development methodologies employed by the developers (such as Agile) are all to aware of these shortcomings in software documentation, constructing the development tools and methodologies to deal with these shortcomings:
  • Many development tools, such as Microsoft's Visual Studio and the Java-based Eclipse development environment, allow developers to document the code within the source code file itself through the use of XML comments and Javadocs. Documentation of this kind is then highly visible to other developers through pop-ups which appear as the developers type when they incorporate source from other developers into their own.
     
  • The unit tests produced by developers practicing Test-Driven-Development (TDD), heavily promoted in Agile development methodologies, arguably serve as a form of software documentation which other developers can refer to. Indeed, some of the evolving TDD styles, such as Behaviour Driven Development, use the system's requirements  - authored in a specific grammatical structure - to outline the tests the system being developed must pass during the implementation process.
     
  • Agile development methodologies encourage "highly readable code", which can be achieved in most programming languages by assigning the previously mentioned objects, their members and any variables (temporary areas of memory to store application data) names that would be meaningful to other developers. This can result in such names being considerably long e.g. "customerInvoice", "shoppingCartViewModel" etc. The people behind the development tools recognise this, however, providing software developers "auto-completion" tools which automatically prompt developers with the full name of the variable or object after the developer types the first few characters.
For an example of "highly readable" code, consider the below source:
 
(Don't worry - this is aimed at non-programmers. I fully expect actual programmers to rip this code apart :)
decimal calcTotal(decimal tax)
{
  decimal total = 0;
  for(x = 0; x < this.invoiceItems.Count; x++)
    total += this.invoiceItems[x].Cost;
  total = total * (1 + (taxAmount / 100));
  this.InvoiceTotal = total;
}
Now here's the "highly readable" version:
decimal calculateInvoiceTotal(decimal taxToBeApplied)
{
  decimal finalInvoiceTotal = 0;

  foreach(invoiceItem in this.invoiceItems) 
    finalInvoiceTotal += invoiceItem.Cost;

  finalInvoiceTotal = addTaxToAmount(finalInvoiceTotal, 
                                     taxToBeApplied);
}

decimal addTaxToAmount(decimal amount, decimal taxLevel)
{
  decimal taxMultiplier = (taxLevel / 100) + 1;
  return (amount * taxMultiplier);
}

While the highly readable version is longer, it should be much more obvious as to what the code is intending to accomplish, and therefore obvious where to place any future modifications to the invoice calculation routines. Nit-pickers may say that the longer code may function slower owing to the additional steps in place to make it more readable. While this is somewhat true (though not always), with today's processors the additional cost is negligible. This negligible penalty is also compensated further down the road with the possibility of less time spent on maintenance during the maintenance phase.

It's the maintainability issue that anybody requesting software development services should question, and software developers should be happy to answer. We at CodeBox strive to make our code self-documenting and highly readable, placing the customer firmly in control of - and at ease with - their own product.

Software Development Outsourced Overseas with Agile 

Posted by Chris Sunday, October 09, 2011 2:52:00 PM

The Chao Prya river in BangkokThe very mention of outsourcing software development overseas can set off alarm bells. These fears are quite understandable; trust is being placed in people located some considerable distance away to develop an application which will no doubt have its own unique complexities. Will these complexities be understood correctly? Will the application function exactly as expected? What guarantees are there of the software being completed within the original timeframes promised?

Agile software development approaches address these very typical concerns through the presence of an "On-site Customer", whose role is to ensure the focus of the development team remains on-track. The On-Site Customer is somebody employed by the customer requesting the development and temporarily located with the development team for the duration of the project, or a permanent member of the Agile software development team who represents the customer and maintains a close relationship with them while development is in progress.

Given that teleportation may never be likely, the former option of having a representative from the customer present with the development team in Thailand is probably not really an option for most people. In truth, even for Agile teams located close to the customer this is still not a feasible option, specifically when the customer is a small business with limited resources. This leaves us with the latter option of having somebody represent the customers interests during while development is ongoing. How effective this person is at representing the customer clearly depends on how well that person can communicate with the customer over the distance.

Now even up to five years ago I would of said this can be difficult. In the past five years however there has been a boom of collaborative-based applications and services aimed specifically at assisting communication between people over large distances. IP-based communication tools such as Skype provide highly reliable voice and video conferencing, while Web 2.0 collaboration tools such as Basecamp and Trello give remote teams full visibility of tasks pending, completed and requiring further attention. It will always be difficult to match the effectiveness of face-to-face communication, however virtual communication methods now hold onto a well-deserved second place.

The one issue which remains, specifically with overseas outsourcing, is the unavoidable time zone difference. Thailand is 7 hours ahead of UK time (6 hours during British Summer Time), giving us a "handover period" of two or three hours falling at the start of the UK working day. Historically, throughout my time at CodeBox and other Thai-based companies collaborating with the UK, this time has been ample to discuss, and demonstrate if need be, the days the developments. We at CodeBox are also happy to adjust our working day by a few hours if it is deemed more time is required for any reason. (Adjusting work hours is quite commonplace in Bangkok to avoid the cities formidable rush-hours!). 

For Agile development methods to be effective, the customer must feel they are being represented adequately; frequent communication is the key to securing this representation. We believe the technologies are now available to support such high levels of communication between people, regardless of the distances involved.

The New Amazon Kindle Fire Tablet and e-Reader 

Posted by Chris Friday, September 30, 2011 6:35:00 AM

Amazon's new Kindle FireEven if you have a slight interest in Tech-related news it's unlikely the announcement of the new Kindle Fire will have slipped your attention. In short, they will soon be releasing a new tablet to the market which looks aligned to compete directly with the Apple iPad, and also introducing a new low-end e-reader at $79 USD. Now I'm an iPad owner and think the iPad is a great bit of kit; the battery life is tremendous and the screen size means I can browse the web on the move without the limitations traditionally associated with small-screen devices such as smartphones. However, the one iPad application I use more than any other is the Kindle e-reader. It's solely because of this application the amount I read now has jumped dramatically compared to that of two years ago; it's ridiculously quick and easy to purchase new books, and the range of books available beats any English-language book store in Thailand hands-down. 

The main reason for choosing the iPad over than the Kindle e-reader however was owing to the price difference when it was purchased. The introductory price for the Kindle was a huge $399, which (if I recall correctly) hadn't moved that much when the iPad first hit the streets. Given that the iPad could be an e-reader and much, much more, the decision to pay extra for the iPad wasn't a difficult one to make.
 
Amazon's new Kindle device, the Kindle Fire, is certainly priced more competitively to the iPad, at $199 USD per device. In my opinion, what will ultimately determine its success however is the range and quality of applications available for it. At the risk of sounding like a "fanboy", Apple has massive research and development resources which have produced a very impressive array of products over the years. Whether Amazon can ensure its device and applications are up to a similar standard remains to be seen.
 
Amazon's new low-end Kindle e-ReaderWhat did catch my attention, more than Amazon's new tablet, was the new Kindle e-reader mentioned above at $79 USD. At this price I would happily have one alongside my iPad, and would probably find myself using it more than the iPad. Looking at the promotional photos the only concern is the size; although I have the Kindle app running on my phone reading on it just isn't the same compared to reading on the larger tablet screen.
 
Interesting times ahead for both tablets and e-book readers. Looking forward to seeing the devices out here!

Maintaining Software Quality: Reusing Code 

Posted by Chris Thursday, September 29, 2011 12:11:00 PM

The attitude towards software reuse could well be a way to determine the young, enthusiastic developer from the older, more experienced developers. The lesser experienced developer is often more than happy to reinvent the wheel, as it could serve as a good opportunity to learn and possibly improve on what's been done before. In contrast, the more experienced developer will often be questioning if what is required has been previously developed in some shape or form before. This isn't owing to a lack of enthusiasm from the more experienced developers, but because reusing code brings two well-known benefits:

  • Perhaps the most obvious is the reduction in development time required when reusing software. If an existing software component can be used from elsewhere development time is reduced down integrating the reused component into the application.
     
  • From a quality assurance perspective, if reusable components are available they have most likely been delivered to the end user and had a good number of bugs previously "ironed out". Reused software components are therefore often more reliable than new components developed from scratch.
(For the purposes of this article, a software component is a piece of an application which completes a specific task, such as encrypting a password and validating it in a database, or prepares text entered by a user for presenting on a web page.)
 
It's for these two reasons software reuse is considered the "holy grail" of software development; imagine if applications could be built by picking software components from here and there and somehow visually piecing them together? No more lines and lines of obscure, cryptic code or mysterious technical jargon understood by a select few; the possibilities of software development could well be in the hands of every computer user out there....
 
The good news is that this is the way software development is heading. Modern software development platforms such as Java and Microsoft.Net, responsible for powering many of the web, desktop and mobile applications out there today, are geared towards component-based software development and reuse. The bad news is that, despite some valiant efforts, such as the Android App Inventor, drag-n-drop based software development for the mainstream computer user is still some way off. Why?
 
From the perspective of the software developers, software reuse is hard; particularly engineering software into components for reuse elsewhere. While much time can be shaved off the development of an application which reuses components, creating such components for reuse from existing software is a much more time-consuming process. Thought must be given as to how the component will appear to the developers wanting to reuse it (the interfaces). The component must be tested thoroughly so that can function in a "Standalone" mode, outside the software it originated from. The interfaces themselves must be documented so that the application developers know how to use the component correctly. Any dependencies and limitations of the component must also be documented so that application developers don't waste time trying to integrate a component that ultimately might not be a good fit. The list goes on...
 
These difficulties should prevent software developers from considering reusing software where possible, however. It just means some thought must be given as to what parts of software could be reused before spending time creating reusable components from them. Here at CodeBox we use a "two stage reuse" approach; while an application is underdevelopment, if it is felt the functionality being developed could have the potential to be reused as a component elsewhere, its existence is marked in a component reuse repository (or library) in a "Stage 1" section. If any of the (currently no-reuse-friendly) components in the Stage 1 section are later required in another application elsewhere, they are developed into reusable components and stored in a "Stage 2" section. This approach ensures that all developers are aware of what components are available, or could be available, thus minimising the possibility of unnecessary duplicate development efforts. It also prevents time being wasted creating reusable components that are ultimately never reused.
 
Reusing tried-and-tested code from elsewhere is a proven method of improving the quality of software and reducing development time. However an important attribute of achieving effective reuse is having a carefully considered software policy, otherwise much time can be wasted creating reusable components which are ultimately never needed.

Website Design vs Web Application Development 

Posted by Chris Friday, September 23, 2011 3:12:00 AM

Like most people maintaining a website I've been doing some research using tools provided by search engine companies as to what people are searching for when looking for web development services. Perhaps unsurprisingly, the most popular keyword - by a country mile - is "website design", with more development based keywords such as "web development", "application development" and "web application development" falling pretty far behind.

But does the person searching for "website design" actually require website design services? What defines a "web application" and when does the customer need one of those instead? Let's start by addressing website design itself. In my mind, website design is the process of designing the appearance (look and feel) of a website, then combining this with actual content to make a complete website. If a customer is looking for a static brochure website displaying products and services, with About and Contact pages thrown in, it is most likely website design services are all what's needed.
 
So how are web applications different? Wikipedia defines an "application" as "computer software designed to help the user to perform specific tasks". To achieve this such applications require inputs from the end user. In web applications, these are usually in the shape of forms containing textboxes, WYSIWYG editors and buttons. The web application will then often process these inputs, then display output (content) specific to that user. A process often referred to as "dynamic content".
 
So rule number one of web applications: Web apps take input from users, then use this input to display user-defined, dynamic output, or content.
 
The problem with this definition is that there are a wide variety of web applications available which are intended to make life easier for the owner of a website, but give few benefits to the end user (if any). Such applications include website content management applications (such as Drupal, Joomla! and mojoPortal - used by this site), blogging applications (Wordpress, BlogEngine.Net) and forums (Invision, phpBB). If a customer requires a site running any of these applications, do they need application development services? Usually the answer is no, as there's a very large number of existing products available which can often be installed in-house by the website design companies. However if any of these solutions do not exactly meet your requirements, and/or need customisation in some way, there's a good chance you may need web application development services
 
Hence rule number two: Web applications usually have a unique purpose which target a specific group of users, and often serving each user equally.
 
For the record (and as a bit of a plug), website design services from elsewhere were drafted in to create this website. The guys behind it are thedesginloft.co.uk who specialise in website design services for the content management application, mojoPoral.
 
But what about Adobe Flash applications? Flash applications can process inputs according to rule #1, and are often built for a specific purpose, thus satisfying rule #2. A good example is the Speedtest.net application used to determine the speed of your Internet connection. Many website design companies offer Flash development services, but can this be considered web application development? To me, this all depends if the data used by the Flash application is stored remotely - "in the cloud", as it were. Examples of this include Flash applications which require some form of authentication to access individual data, such as Lovelycharts.
 
So rule three: Web applications generally store data remotely and often centrally, perhaps for the purposes of sharing data with other users
 
To recap on the above three rules: if the website you are looking for requires user input, has a specific, unique purpose and is required to store data centrally "in the cloud", it is within some certainty you are looking for web application development services rather than website design services.
 
So do you need web application development services? Perhaps you still might be unsure? Contact CodeBox, or leave a message below, and we'll see what we can do to help.

Maintaining Software Quality: Checklists 

Posted by Chris Friday, September 16, 2011 4:30:00 AM

The mention of the word “checklists” instantly sparks thoughts of a dull and dreary procedural workflow, with conformity valued over creativity. This impression would be accurate if it were only checklists used throughout the entire development process from start to finish. However this clearly isn’t the case; running through the items on a checklist is an activity which should occur after the creative contributions have been made during the design and implementation phases. And, providing the items on the checklist have been considered carefully, such checklists should rarely take longer than a few minutes to complete. Keeping such checklists short is a quality the author of such lists should aim for, as long lists will ultimately deter the developers from using them correctly.

What items should be in such checklists? Well this varies from team to team, but for some all-encompassing items to help ensure the future maintainability of the software:
  • Are the variable names used meaningful? A meaningful variable name is often the best indication of the purpose of the variable.
  • Are the function names meaningful? This applies to function names of all visibility, as later on the  a “private” function may need to be refactored into a "public" class.
  • Have variable and function names been given correct CapitalCase and camelCase casing? The Microsoft rule is CaptialCase for “public” and “protected” methods, camelCase for private.
  • Are functions and methods more than fifteen lines long? Long procedures (functions and methods) are often an indication the procedure is completing more than one task, and could therefore be refactored into multiple smaller procedures.
  • Do classes consist of more than say three or four pages of code? Large classes are often an indication the class is performing multiple roles and therefore not "cohesive" – an important quality attribute of object orientated software development.
Scanning the code for the items on the list shouldn’t take too long, and refactoring tools - often built into the Integrated Development Environment (IDE) - can greatly reduce the time taken to make such modifications, such as the renaming of variable and procedures throughout the entire code.
 
As mentioned, the lists used by the team are likely to be very unique to the team itself. The checklists themselves needn’t be “set in stone” either; they should evolve as the development teams identify common errors which keep reoccurring. Again, this is keeping in mind that a fundamental quality of a successful checklist is that it should be quick to verify, with each item not taking more than a minute or two.
 
In the Agile world James Shore refers to such lists as “Done Done” checklists. Hit the link for ideas on what could be included in such lists at the end of an Agile development iteration, before the software is handed over to the testers for exploratory testing.

Maintaining Software Quality: Peer Reviews 

Posted by Chris Friday, September 09, 2011 3:12:00 AM

Overall software quality is a concern of not just the customer and the end user of the software, but also the developers working on and maintaining the software. Maintaining software quality is desirable for a several reasons; perhaps most obvious of which is to reduce bugs (errors) within the software, which can then lead to faults, which - in worst case scenarios - leads to the software failing. Other notable reasons for wanting to maintain software quality is to increase performance and reliability, ensure software validation (“is the software doing the right thing?”) and verification (“is the software being implemented correctly?”), and decrease the amount of time required to maintain the software after its release to the end users.

Many Agile methodologies have their own unique ways of maintaining software quality, such as Pair-Programming and Test Driven Development (TDD) – these very effective methods will be discussed in later posts. For now, I will focus on one method of maintaining quality which can be applied to all methodologies, Peer Reviews (sometimes referred to as Fagan Reviews).
 
Peer reviews are structured review sessions of all project outputs, whether they are project design documentation, source code or test plans, and usually involve four people or more people:
  • a “moderator” –usually not directly involved with the project, assigned to oversee and record the review process and ensure personal agendas do not become involved, 
  • the “author” of the artifact under review – to answer questions from the reviewers, 
  • Two or more “reviewers” – to examine the artifacts under review and query the representative about any issues identified within the artifact.
A “reader” may also be present to conduct the review session, along with a “recorder” to record all defects identified by the reviewers which the author has agreed to correct.
 
What can quickly be determined by reading the above process is that such reviews take time; time to arrange and time to conduct. They also require the attendance of several members of the development team, which will invariably disrupt the schedules of their other development tasks. It is therefore probably safe to conclude that such reviews are best suited to large development teams working on projects with timescales of six months or longer.
 
For smaller development teams working on projects with shorter timescales, perhaps peer reviews following the procedure outlined above can be considered overkill. Agile has an answer to Peer Reviews, which is appropriately labeled Pair Programming; Pair Programming dictates two developers are sharing a computer while implementing code, rather than one, which ensures source code is constantly being reviewed as it is being developed. Pair Programming will be discussed further in an upcoming blog post.

Choosing a Virtual Private Server 

Posted by Admin Friday, September 02, 2011 3:37:00 AM

Over the past few weeks we've been investigating Windows virtual private server options for a client. Given the relative cheapness of VPS's compared to the full dedicated server alternative, it was decided to purchase a few VPS's at various points on the globe for a single month only, so that performance could be compared side-by-side.

What we quickly discovered was that memory made the single biggest difference in terms of performance. Of the servers we rented, at one side of the memory extreme was a Windows 2008 Server hosted in Singapore (much closer to where we are geographically) running just 512MB of dedicated memory. At the other side, over in Texas, US, was another Windows 2008 Server running a whole 2GB. From a fresh restart of IIS, the 512MB Singapore server took 30 seconds for the ASP.NET web application to fire up, while the 2GB server took a mere 2 seconds.
 
It also must be noted that, cost-wise, there wasn't much difference between these two options; the 2GB server was close to $60 USD per month, while the 512MB server was about $50 USD (at today's exchange rates). Given the difference in performance making the decision to spend the additional $10 per month was a no-brainer, regardless of the US server being much further away from the majority of its current users.
 
So the takeaway is - when looking for a Windows VPS, the single biggest factor for improving performance was the amount of RAM. It also might be worth shopping around like we did to help discover the best option, rather than rely solely on the standard matrixes provided.
 
And, just as a plug, we finally opted for the Windows Super VPS provided here.
Page 1 of 2 1 2 > >>

What Our Clients Say

While there are many eCommerce applications available on the web, it was difficult to nail down a solution which would meet our highly unique requirements. CodeBox were quick to suggest alternate and viable solutions, recommending extending an off-the-shelf solution rather than reinventing the wheel entirely. We decided to proceed with this approach with zero regrets, supported by Codebox's uncompromising professionalism and development skills. We would have no hesitation on choosing CodeBox for any new IT projects we choose to pursue.

Mr. Evans, Switch Media, UK

From the start CodeBox demonstrated they had an understanding of our needs, articulating them back to us, along with their own creative ideas on how to address our needs, before proceeding with any development work. The invoicing product they delivered is a perfect fit, mostly owing to a regular stream of feedback and results we could actually see and comment on! We are happy to recommend CodeBox and look forward to working with them again.

Mr. McBain, Premier Debt Recovery, UK

CodeBox have been consistent in providing practical, jargon free advice and uncompromising professionalism throughout their development of our customer support system. Their "can-do" approach and consistently dependable communication skills have been an asset in their deliverance of a solution which has helped massively improve our relationship with our own customers.

Mr. Pawsey, A++, Thailand

Codebox were an invaluable resource during our early concept and design phases. They lived up to their straight-forward reputation resulting in our entering the prototype stage well ahead of schedule (and well below original budget!). Codebox = clarity: Something we look forward to further benefitting from during the next phases of our development project.

W.J. Christensen, MarineComm Project Group, UK