Vanguard Coder

Simple Life of a Keen Developer

What’s Wrong with Coding Challenges

leave a comment

I’ve had a handful of coding challenges to do in short space of a week and have seen a lot of variability. Some employers as you to write a program that does something like converting numbers to words – this is a short algorithm and could be done in under 100 lines. I’ve been praised for a good clear design and readability, but at other times have been rejected because they wanted to see design patterns and more “OO principles” applied. However, in the development industry – all unnecessary “overkill” code is a waste and should not be done without a good reason.

I’ve had other challenges asking for console input/output, which didn’t emphasis on if they wanted TDD (which should be the case by default).

A good problem gives a business situation rather than asking to write a program that does something. A shopping cart with an addition issue of applying offers – buy X and get X or Y at a discount or free. Z% discount on a product or a category, etc… seems to be one of the most common challenges.

 

 

Written by zkashan

January 31st, 2014 at 8:44 pm

Posted in Uncategorized

What is the Most Complex Piece of Software You’ve Worked On?

leave a comment

I get asked this question a lot in interviews, and it’s one of those wooly type questions that people like to ask and get a predictable rehearsed response back.

Until very recently, I didn’t know what the response should be, after all, isn’t everything complex until you understand it?

The interviewers are probably reflecting on their own systems which may look simple, but may have grown over time. The best response is to take any project you’ve worked on, and talk about the number of different sub-components that were there, how you looked at it from a high level view from a clients perspective, and the low level from a developers perspective.

 

Written by zkashan

January 22nd, 2014 at 9:05 am

Posted in Uncategorized

Marketing new Framworks

leave a comment

Written by zkashan

January 17th, 2014 at 6:27 am

Posted in Uncategorized

Is Microsoft Certification (MCSD: Web Apps) worth it?

leave a comment

A few month ago, I decided to update my certification and sit for MCSD: Web Apps exams.

In UK, it’s not a must have. There are a lot of great developers that are not certified. However, any candidate that goes
through the recruitment process has to prove to non-devs (HR, recruiters and hiring managers) that he is worth the time and effort to be considered as an added advantage (rather than a filter) for an interview.

Job seekers that go to meetups, events and talk don’t necessarily have to flash their MCSD certificate for the added advantage.

Overall, I think if you’ve got the time, it’s a nice challenge to do.

In order to prepare for the exams these are the PluralSight courses I did:

070-480 (Programming in HTML5 with JavaScript and CSS3):

070-486 (Developing ASP.NET MVC 4 Web Applications):

070-487 (Developing Windows Azure and Web Services):

 

Written by zkashan

January 15th, 2014 at 10:43 am

Posted in Uncategorized

Infinite Scrolling in SPA w/ Durandal

leave a comment

Working with Single Page Apps (SPA), and listening to how John Papa explains it, I’ve become a huge fan of Durandal, and whole-heartedly feel it’s the future. It’s inevitable, that infinite scrolling will have to be implemented.

This means.

1. Skipping what’s already been loaded, and load new items,

2. Ensuring the correct data is loaded, (e.g. if it’s sorted by name, price, etc…)

3. If the infinite scroll is no longer infinite, to not to raise events.

Interestingly, the two variants of I’ve seen are loading based on page – where a page contains a fixed number of items, However, it’s counter intuitive to define a page, as a page no longer exists in infinite scroll, but rather number of elements the user is able to see, thus, an item based scroll seems more intuitive.

Another common issue I’ve seen is working with percentage.

Let’s say a screen displays 20 items, and the window holds 100 items. Each time the person scrolls 80% we load a 100 more. It works fine for the first few scrolls, however, lets say the user is viewing 1000 more, and has reached 800, loading a 100 more might be unnecessary as he is not entirely near the end.

Scrolling is not too daunting to build – esp with Breeze as it is aware of line and we can write skip(numberOfItemsLoaded).Take(numberOfItemsToLoad)

My implementation involved letting Durandal add scroll event on document load, which unbound the scroll event, load more information and attach the event again. This is necessary as the event could be raised when the user is scrolling through the lower parts of the page causing a few multiples of item sets to be loaded.

Written by zkashan

July 11th, 2013 at 7:04 pm

Posted in Uncategorized

Agile Development Practices by Country

leave a comment

Agile development processes are practiced either at grassroots where all people in the organization or sub-group play an active part in improving, following practices, and contributing to the processes. The alternative is to do what everyone else is doing (Drone-driven-development), or resisting change and sticking with age old practices, tools, and thus development speed, and user feedback and cycles.

Using job aggregation websites and forums, I analysed the quality of jobs, and requirements in UK, UAE, India – primarily because I know people working in these countries and the time spent to research each country  is large. If anyone want to help me in refining the criteria and and expand the list of countries, I’m more than happy to work together.

The criteria is:

1. Number of development (C#/Java) jobs posted requiring Agile developmental skills.

2. I also include how many SAP jobs exist to see industry focus.

I’ll exclude personal feedback from developers as maintaining some manual systems e.g. zipfiles instead of SVN, and QAs that only do manual testing.

Normalised Agile ranking:

UK – 100          (40% of all jobs are agile), C#/Java market share – 70% vs SAP. C#/Java are equally spread.

UAE – 12          (5% jobs are agile), C#/Java market share – 10%  vs SAP.

India –  37      (15% jobs are agile), Java/C# market share 70% vs SAP. Heavy skew towards Java

Conclusions:

UK is in an ideal position to focus on true  innovation and development and lead the way for others to follow. Not being platform specific they can exploit newer innovations rather than rely on vendor to supply approve supported modules and changes.

UAE is a SAP based economy. With C#/Java holding a very small proportion of the economy compared with SAP, and of the C#/Java jobs, a miniscule have agile listed as their requirements. UAE is likely to rely entirely on vendor products and development abroad rather than innovate and develop locally. This is likely to be the more expensive way in the long run, but the premium is noticeable.

India, like UK has a high number of C#/Java jobs as compared to SAP. However, Java holds a significant market share.

My thoughts:

I’ve generally seen companies eventually isolate and remove SAP, and other large systems as it’s expensive and fewer developers are are available, and consultants are required to maintain them which become more expensive as the technology gets out of date. There has been some effort to enhance SAP, however, it is a follower rather than a leader when it comes to innovation.

 

Written by zkashan

March 24th, 2013 at 4:34 pm

Posted in Uncategorized

Biztalk – Adopt and Remove

leave a comment

Biztalk is perhaps the most interesting product implemented by Microsoft. I’ve personally worked on many projects involving Biztalk. In many, I introduced and integrated Biztalk, in others, I implemented replacement for parts of it.

Problems primarily range from stability, finding people who know it at least to the level where Biztalk databases is corrupt, or loosing messages, and trying to look at the deep dark internals to find out where things went wrong.

Companies are sold Biztalk through slick offerings and presentations showing how simple and great it is from the business perspective, along with success stories such as in Thetrainline.com by Cap Gemini and Pershing by Microsoft . However, there are no follow-up stories if Biztalk is continued to be used, expanded, frozen or decommissioned after a few months or a few years of use.

Some companies eventually find less value, however, others fight to keep it in by looking for Biztalk experts that know how to firefight, or create roles such as Biztalk Lead (so leading a team of Biztalk developers?) – which might be trying to patch issues with the software rather than fixing them. This generally happens in large public bodies in small countries where the HR is centralized, but is not necessarily limited to it.

Biztalk is considered as a bloatware by a lot of Developers (not all), and there isn’t a shortage of companies adopting and removing Biztalk, and looking for viable alternatives. A blog by Biztalk MVP is an interesting read, and if adopting Biztalk, or getting rid of it, a question asked on stackoverflow was interesting as well.

Biztalk isn’t the only product going down this route. If the product offers drag and drop development to a certain extent, it’s worth having a second look.

Written by zkashan

October 28th, 2012 at 11:32 am

Posted in Uncategorized

Singleton Gymnastics

leave a comment

As books on C#5.0 (using .Net 4.5 framework) are being released, I remember during the pre-.Net 4.0 dates the awesome amounts of gymnastics that were done around the simplest design pattern – the Singleton.
Some involved double checking (in and outside the lock), setting up Memory Barriers. Most of this discussion can be read here. Finally System.Lazy came about and the rest was history.

I wonder wonder what’ll the most popular feature in that C#5.0 uses with .Net 4.5


public sealed class IrritatingConstructor
{
    private static readonly Lazy<IrritatingConstructor> lazy =
        new Lazy<IrritatingConstructor>(() => new IrritatingConstructor());

    public static IrritatingConstructor Instance
    {
        get
        {
            return lazy.Value;
        }
    }

    private IrritatingConstructor()
    {
    }
}

Written by zkashan

July 3rd, 2012 at 7:50 pm

Posted in Uncategorized

Visual Studios Unit Test MsTests OutOfMemoryException

leave a comment

With time in some code bases containing a mixture of old code over a decade may end up with a lot of files and thousands of unit tests. The project may not have been refactored and a lot of technical debt has built up. Visual Studio may start of complain and give Out Of Memory Exception and not run your unit tests. A quick fix is to add a registry entry as pointed out here.

Add the following entry: HKLM\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\EnableCMI = 0 (DWORD)

This will turn off auto discovery of unit tests, so compiling after changing unit test names or added new tests will be required.

Not a perfect fix, but something to keep you going for longer when you don’t have any other option.

 

 

Written by zkashan

July 1st, 2012 at 6:53 am

Posted in Uncategorized

Smelly IFs

leave a comment

In my years of experience, the most common repeat offender I’ve seen is the excessive use of IF Statements. As a result. I’ve joined the Anti-IF Campaign.

It results in code that is hard to change, maintains, and does not use composition, inheritance, or design patterns to write meaningful code. It is just a code that runs. I’ve spent hours trying to find out bugs in if statements written in butterfly form (nesting going 3-5 levels deep). Try adding a feature to an If statement at the 3rd level which goes down 5 levels. This won’t give you much confidence that it won’t have unintended side effects.

There are some examples in which it may be hard to get rid of such as Mark Needam pointed out unless some overkill solution is applied (Attributes, Validation blocks), but the other common offenders can be removed.

Scenario #1

if ( expression == true)
{
    return true;
}
else
{
    return false;
}

This could be shortened to:

return expression;
Scenario #2

if ( expression = somestring)
{
    return processA;
}
else
{
    return processB;
}

This could be shortened to (VB, or use ?: in C#)

DirectCast(IIF(expression=something), processA, ProcessB), returntype)

The disadvantages is both – processA and ProcessB will be evaluated, possibly making the process inefficient. In 2008, If method was introduced, and direct casting is not necessary. So this can be changed to:

if (expression == something), processA, ProcessB)

Scenario #3

Avoid If at the start of a method and end if near the end. If should not span the whole method.

Scenario #4

If you have nested if’s, see if there are better alternatives. This makes maintenance and manageability of the code difficult. Excessive if’s points towards procedural code, thus should be limited (but not necessarily entirely avoided).

Scenario #5

public void MethodA() {
    if (condition1) // note first line is an if
    {
        50 lines, nesting goes down to three level
    }
else if (condition2)
    {
       similar issue as above
    }
else if (condition3)
    {
        similar issue as above
    }
}

This is probably bad design, and could be replaced by various patterns to make life easier.



Written by zkashan

May 21st, 2012 at 8:48 pm

Posted in Uncategorized