Agility In Design

The overall design and user experience have a much greater precedence in web development than they do in traditional software engineering. In this era of “Web 2.0″, agility in design is essential to the success of any web application. As much as it pains me to stake this, as a developer, but we all know that visual effect amount to going on for 100% of initial impression.

It Human Nature, we just can’t help aesthetic judgement.

When leading projects, this poses an additional consideration in planning for the development lifecycle.

At what stage does the design kick in?

Typically, development can be driven by design. If all of the designs are produced up front, it can lead to lost time from the development team in fixing issues caused during development. However, if the designs aren’t produced until the end of the cycle, it can lead to scope creep, additional features expected by designers that have not been created by developers as they were not part of the initial scope definition.

As an alternate, design can become a part of the sprint process, if you are being agile about it. Though this can lead to a combination of the above issues, but with a much smaller feedback cycle. This is ideal as it can lead to hidden, un-scoped features being made transparent, though can still eat up a lot of development time when the functionality calls for a change in design, or vice versa.

Agility In Design is an essential part of web development, if working to a set design. But the Agility must come from all of those concerned. The development team can’t expect the design team to change everything for them, and the design team cat expect that of the development team. Everything must work well together and compromise must be given, where warranted.

There is a third approach, which is one being used on the current project I am working on. Design and Development are running simultaneously, with a development team and a separate design team. The design’s scope creep is rejected, with only agreed on features and functionality being delivered, and the development team don’t have to tread carefully around the implemented design.

This is made possible through a template design approach. The systems templates will change over time, through any number of implementations, and we are reacting t this early by ensuring we develop without a UI, so it can instead be supplanted into the finished project, in multiple forms over multiple instantiations.

To me, this is a better defined Agility In Design. The system does not care about or rely on it’s aesthetics, which can be easily adapted around the functionality.

New functionality required by new designs goes where it belongs, into a prioritised backlog of work, and scope creep ends up where it belongs, in one of the many office bins.

Whilst this approach is, to date, working brilliantly within our team, It may not necessarily be the best approach for all projects. Every project is different, as is every team, and it will always remain that the best option is to play to your strengths, making the decisions around what resources you have available, for how long, and the skillset encompassed within.

I will consider this approach in future projects, but as for it’s success, only time will tell.

23. October 2014 by Adam Riddick
Categories: Design & Practice | Leave a comment

SSRS Performance with Option(Recompile)

Sometimes, SQL Server isn’t as great as it usually is and can cause SSRS Performance issues when running queries that execute fast inside SSMS.

Just the other week I was writing a simple join script against close to 200k records in each of the 3 join tables. The script in question was for a report with a certain degree of complexity, meaning a lot of options and filter where being made available to those viewing the report. This in turn, meant a lot of variable parameters within the report query.

This report came with SSRS Performance issues. The query itself ran in less than two seconds inside SSMS, but gave up running after 4 minutes through SSRS.

Continue Reading →

15. October 2014 by Adam Riddick
Categories: Business Intelligence, SQL, Tips | Leave a comment

Sql Server Reporting Google Chrome Fix

Two weeks ago, I blogged about the need for Reporting Systems to support and influence the decisions being made by any organisation. Today, I’ll explore a Sql Server Reporting Google Chrome Fix, to enable the viewing of SSRS reports in the Google Chrome Browser.

In the article two weeks back, I mentioned the availability of many different reporting systems, from Sql server Reporting through to Crystal Reports. The organisations I have worked in have used one of these solutions, though have found more success with Sql Server Reporting. It’s no secret that Google Chrome is a popular browser, or that Sql Server Reporting doesn’t play nice with Chrome.

This is why we require a Sql Server Reporting Google Chrome Fix. And it’s pretty straight forward.

Continue Reading →

11. October 2014 by Adam Riddick
Categories: Business Intelligence, SQL, Tips | Leave a comment

Editable User Friendly URL Structure in MVC

User Friendly URL’s

There is a logic behind user friendly URL structures on a website. No matter what you call them, Clean, User Friendly, SEO Friendly, or Semantic URL’s, the purpose behind them is to improve a website experience by ensuring the website URL’s maintain an intuitive meaning amongst non-expert end user’s.

I’ll explore this in a little more depth.

www.mywebsite.com/?q=hG728kos99Dmmhe%77cv

www.mywebsite.com/mens/shoes/loafers

Considering the above two URL’s, it’s clear to see the latter user friendly URL has a much clearer meaning to the user, and can potentially be easily altered, in a breadcrumb manner, to easily navigate the structure of your website.

Imagine trying to edit the first URL to show trainers instead of loafers, wouldn’t know where to start right?

Continue Reading →

02. October 2014 by Adam Riddick
Categories: ASP.Net, C# | Leave a comment

Reporting Systems: A Requirement’s Document

Reporting Systems: The Needs

Reports, Reports, Reports.

There isn’t a single reason as to why a business maintains a set of reports, but the information provided by a solid reporting structure can be the difference between a booming business, and a receding one.

A report could have been made for legal reasons, a financial audit trail for example. They could offer operational insight to the businesses capacity, and be used to monitor behavioural patterns through the business operation, which allows for judgement calls to be created based on historical patterns, such as staffing levels and stock control.

No matter the reason for the report, when it has been correctly represented, it can make the world of difference to a business. Though, the opposite can be said of a poor report backed by poor data, which highlights the need for business analysts who understand the patterns in data and can act upon poor information, ensuring decisions won’t be made on erroneous information.

But static reports can’t do that. As the needs of an organisation change, the reporting solution in place must adapt to accommodate the new requirements. The reporting system is an assistant to that change, enabling a smoother transition from the old and into the new.

Reporting Systems: The Truth

Continue Reading →

25. September 2014 by Adam Riddick
Categories: Business Intelligence | 1 comment

C# Inherit from multiple interfaces with clashing method names

Recently, in one of those many projects on the go, I was working on an interface between two individual systems that are required to talk to each other. I can’t discuss much about the project itself, white label and all, but I can abstract to a level to explain the solution to a problem I stumbled across, which was the need to Inherit from multiple interfaces with clashing method names.

As you are probably aware, in the C# environment you can inherit from multiple interfaces without any great difficulties, we use the following template;


public interface IFoo

{

    void DoFoo();

}

public interface IBar

{

    void DoBar();

}

public class FooBar : IFoo, IBar

{

    public void DoFoo()

    { //Foo Happens }

    public void DoBar()

    { //Bar Happens }

}

But a less known concept is the ability to inherit from multiple interfaces with clashing method names, but first let me explain.

I’ll use the example of a solution to log stock values between two systems, let’s say they are stock provisioning systems. Each system allocates stock to varying clients by different means, one through a web interface, an e-commerce system, and the other through the manual scanning of a products barcode by a store worker (For completeness, well say this is an Argos style store, in which you order your goods and wait for the warehouse team to bring them down). Reporting is required to allow real-time transfer of the data into a single logging file.

To this end, a solution is being implemented in the middle of the two systems, we’ll call them A and B.

Continue Reading →

18. September 2014 by Adam Riddick
Categories: C#, Tips | Leave a comment

C# Dynamically Load Types From DLL

Reflection is a great way to allow us to Dynamically Load Types From External DLL’s.

I love reflection. I learned about Reflection when I started creating FakeModel, and haven’t looked back since. I use Reflection in many projects for lots of different purposes, and it solves problems in each and every one of them that would have required architectural changes without it. One such problem can be solved using reflections ability to dynamically load types from external DLL’s at runtime.

In order to dynamically load types from external dll’s, we can use the following snippet;


string dllPath = "c:\users\mypath\somewhere\else\myassembly.dll";

Assembly assembly = Assembly.LoadFrom(dllPath);

Type type = assembly.GetType("MyType");

dynamic instanceOfMyType = Activator.CreateInstance(type);

//We can now call the methods, but won't have intellisense

string result = instanceOfMyType.MyMethod("A Parameter", 7);

Which is rather straight forward.

As we use the dynamic keyword, we won’t get intellisense and the compiler won’t generate errors if calls against instanceOfMyType are wrong, keep this in mind when testing.

First, we define the full path to the dll file. This could be done searching directories and filtering files, or by direct access if you know the location.

Adding Some Peace Of Mind

The above snippet is great, but will fall flat on its face in the presence of a tampered DLL. For example, if somebody got hold of the dll and create a constructor on “MyType” which wiped the hard disk, we’d have some pretty unhappy clients.

To protect against this, we can use a checksum against the DLL. This will require pre-computation of the checksum so that a valid checksum can be used. For this, MD5 will suffice as it is faster than other Hashing algorithms.


static byte[] generateMD5(String filepath)
{
    using (FileStream stream = File.OpenRead(filepath))
    {
        return MD5.Create().ComputeHash(stream);
    }
}

Once we have a pre-computed hash value, we can check that against the DLL as we load it, giving the Hash and the method used to produce the hash as parameters;


string dllPath = "c:\users\mypath\somewhere\else\myassembly.dll";

//byte[] hash = ... Pre-Computed Hash Here, or the line below ...

byte[] hash = generateMD5 (dllPath);

Assembly assembly = Assembly.LoadFrom(dllPath, hash, AssemblyHashAlgorithm.MD5);

Type type = assembly.GetType("MyType");

dynamic instanceOfMyType = Activator.CreateInstance(type);

//We can now call the methods, but won't have intellisense

string result = instanceOfMyType.MyMethod("A Parameter", 7);

With the help of this snippet it’s possible to dynamically load types from dll’s at runtime in a secure manner.

Of course, you may want to go one further and add further security to the DLL itself.

 

You can read more about reflection on MSDN.

11. September 2014 by Adam Riddick
Categories: C# | Leave a comment

Introducing Foreign Key Constraint May Cause Cycles Or Multiple Cascade Paths

Introducing Foreign Key Constraint May Cause Cycles Or Multiple Cascade Paths

“Introducing Foreign Key Constraint May Cause Cycles Or Multiple Cascade Paths” may be a message you have seen before when using Entity Framework. The error message is thrown when a relationship being built by Entity Framework has multiple paths in which it can cascade a delete, without knowing which to choose.

Entity Framework doesn’t contain a mechanism to make a choice on a cascade path, so we must remove the cascade for the relationship to work.

Before exploring the fix, well take a look at a scenario that will cause the “Introducing Foreign Key Constraint May Cause Cycles Or Multiple Cascade Paths” error.

Introducing Foreign Key Constraint May Cause Cycles Or Multiple Cascade Paths

Introducing Foreign Key Constraint May Cause Cycles Or Multiple Cascade Paths

Continue Reading →

03. September 2014 by Adam Riddick
Categories: Databases, Entity Framework | Leave a comment

Isolating Unit Tests with Microsoft Fakes

Isolating unit tests is a large requirement of unit testing. Quite often, individual units of code will rely on, or access,  other sections to do their processing. For example, a method that saves an entity to the database will call a method in a repository that is responsible for the actual saving.

Such methods, as they stand, can only be unit tested by containing the requirement. For example, to unit test saving to the database you would require a database for testing, or do something ill-advised and test against a live database. Which is a bad idea, even inside a Transaction (Once upon a time I was very naïve and did this myself, tut tut!).

Thankfully, Isolating Unit Tests doesn’t have to be difficult.

There are many approaches to Isolating Unit Tests, which I suppose depends on the Unit Test Framework you are using. Personally, I use MsTest, Visual Studio’s built in testing suite, and to date I have found no reason to change, and within MsTest we can utilise Microsoft Fakes when Isolating Unit Tests.

Continue Reading →

23. August 2014 by Adam Riddick
Categories: C#, Testing, Tips | Leave a comment

MemoryCache V1.2.0

Announcing MemoryCache V1.2.0

Yesterday I was giving some thought to my small collection of NuGet packages, and I had told myself that MemoryCache V1.2.0 was just about due. Then I recieved an email shortly after 11pm last night from Erik Zettersten putting forward an idea that would improve the usage of MemoryCache.  So I decided to spend some time on some improvements to MemoryCache, and here we are with MemoryCache V1.2.0.

Erik pointed out that a setup, such as the following, could be improved with an Update method, which would improve the first block of code.


if (Cache.Exists(key))
 {
         int newItem = (int)Cache.Get(key)++;
         Cache.Remove(key);
         Cache.Store(key, newItem);
 }
 else
 {
         Cache.Store(key, 1);
         Cache.AddExpiration(key, 1000);
 }

Erik also pointed out a frustration. MemoryCache would not retain the original expiration, and to keep the original expiration, some form of tracking would be required. He suggested an Update method that would persist the original expiration time.

Continue Reading →

14. August 2014 by Adam Riddick
Categories: MemoryCache, News | Leave a comment

← Older posts