Menu

Friday, 26 April 2013

Know your theory


How well do you know your theory? 

The explosion in software technology in the last 20 years, specifically in the software development arena has given birth to experts in certain and specific technology territories. Employees exposed to dedicated technologies or solutions over a duration will characteristically furnish themselves as experts in specific technical areas. This however is perfectly natural since with extended practice anyone becomes an expert.

Technical interviews are hard. They are hard because the interview questions can be chosen from a wide technical landscape. The interviewer will certainly ask questions which pillar the role offered but could also ask questions designed to either snag the interviewee or, boost the ego of the interviewer. It is highly likely that the potential candidate will not answer all the questions correctly specifically if the interviewer asks fruitless questions on finer technical details. It is impossible for the candidate to know everything.

Aptitude

Therefore a good strategy in a technical interview is to ensure that the candidate understands, and really does understand programming basics regardless of which technical paradigm surrounds the potential role. Aptitude is the ability to learn oneself into the position. Essentially asking the question, does the candidate exhibit the qualities to quickly learn themselves into the position. During the interview, the interviewer should determine if the interviewee satisfies this premise. Arguably, organisations will want to fill positions with team members who match the skills of the position. A good developer who really understands the fundamental basics will surely satisfy the sought after aptitude and once hired quickly fill the technical voids as required by the job description.

The answers to the sample programming theory questions below will indeed consciously acquaint the interviewer to the level of theory understood by the interviewee.

What are the principles of object oriented design? (Hint: there are only 4)

What is polymorphism?

Why do we do polymorphism? Least. what is the purpose of polymorphism?

What are the purpose of private methods?

What is the difference between a stub and a mock object?

Our unit tests take 45 minutes to run, what do you think could be the problem?

Explain what is the difference between the factory method pattern and the abstract factory pattern?

What is REST and how does REST work?

Are you familiar with SOLID?

Explain what is the Liskov substitution principle?

What are the advantages and disadvantages of database indexes?

What is velocity and how is it measured?

How do you technically keep up to date?

In an interview, a candidate will claim to be an expert in a certain area, boasting their strengths. Their strengths have been of course moulded from years of not deviating from the technologies described by their peers. Unfortunately strengths may not always be enough. Only once a developer truly understands the basics of programming theory can they consider themselves an expert.

Thursday, 21 February 2013

The role of a software developer

With the increasing array of technologies supported by various expert skills coupled with the demands of business, the fundamental basics of what it means to be a software developer remains the same. Regardless of technology or skill level, the role of a software developer is defined as follows:

A software developer is someone who develops quality software on time which delivers business value and upholds customer satisfaction.

The definition of the role of a software developer upholds the basic requirements of what it actually means to be a software developer regardless of the technology and business demands. Dissecting the role of a software developer unravels the premise on which the definition has been assembled.

A software developer

The software developer is the subject in the role of a software developer. The subject defines who or what is being described. Arguably, the subject in this context can be either interpreted as stereotypical or generalised but fundamentally it is aptitude which should be considered. The aspiring software developer may not have the correct experience nor applicable skills rather does the person have the ability to learn themselves into a software developer position. Does the person have the aptitude to be a software developer?

Develops quality software

Quality software is measured on how well the software has solved the user's problem. Essentially this means how satisfied the user is with the software. Low quality software, software which exhibits bugs, performance issues, data inconsistencies, lack of security and so on, only add to the user's problem. Being quality oriented also means being customer oriented. High quality software exactly meets the user's expectations.

To develop quality software the developer first needs to be customer oriented and then selects the correct tools and processes to support the development of quality software. The tools and processes are only supportive of quality and do not measure the actual quality of the software.

More about the definition of quality can be found here.

On time

Developers must hurry but never rush. Rushing leads to mistakes which inevitably results in poor quality software. However, software which is developed in a hurry allows for quality features to be delivered frequently and on time while the business can still maintain its competitiveness. The business environment will always be competitive and its the responsibility of the software developers to support the rapidly changing business environment.

Which delivers business value

Software development is fun. Nonetheless, the software development team is surrounded by a business and the business has the assumption of generating profits. The team has an obligation to support the business by developing software which coincides with the direction of the business. Basically, the team develops the product or service which the business can sell to generate value.

Upholds customer satisfaction

The absolute aspiration of software is to solve a user's problem. The customer or end user's satisfaction directly correlates to how well the software solution has solved the user's problem. Therefore, a software developer should always be customer oriented which will lead to better quality software and translate into more satisfied users.

In conclusion, important skills like, listening, understanding, communicating, supporting, collaborating, talking and many more are also essential to be a software developer. In the book, The Pragmatic Programmer, the author asserts that developers should not judge their daily productivity on the amount of lines code which has been written. Therefore being a software developer is not only about producing lines of code but also interacting with the business and understanding its customers.

Saturday, 9 February 2013

A surgeon's precision tools


A surgeon is well trained professional. A surgeon must be precise. Their tools are of the highest quality steel and the blades are always acutely sharp. Before each use, the tools are sterilised and placed within the surgeon's reach. Software developers can also consider themselves surgeons.

Visual Studio is a powerful software development tool used to build desktop and web applications on top of the .Net framework. An abundant array of useful plugins and libraries can be installed for Visual Studio to increase the efficiency and accuracy of any developer. Listed below is a set of very powerful tools which prepares a developer to achieve surgical precision.

ReSharper

http://www.jetbrains.com/resharper/

Without a doubt, most .net developers nowadays are using ReSharper. ReSharper not only increases efficiency with its wealth of short-cut keys but ReSharper hints are continuously teaching the developer. Although not free, a must have for any .net developer.

StyleCop for Resharper

http://stylecopforresharper.codeplex.com/

StyleCop is a set of configurable rules and coding standards which ensures all developers in the team adhere to the same set of coding styles. StyleCop for ReSharper is a plugin which invokes ReSharper to highlight the lines of code which do not conform to the StyleCop rules and standards. Maintainability is dramatically improved since all the code developed looks the same.

CodeMaid

http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496

This visual studio plugin promises to do your dirty work. CodeMaid fixes and cleans up source code files upon the save of the file. Sure it can be argued that ReSharper does mostly the same, however ReSharper cleanups are behind a shortcut key whereas CodeMaid does the job on the save the file. CodeMaid automatically fixes StyleCop rule violations.

FxCop

http://www.microsoft.com/en-us/download/details.aspx?id=6544

FxCop is a rule base code analysis tools which discovers logical problems in the code. Peer code reviews are important and FxCop can be considered as the first peer code reviewer. Logical bugs which are often omitted in unit tests can be trapped by FxCop. FxCop can be set up to be run as a post build event in Visual Studio.

Gendarme

http://www.mono-project.com/Gendarme

Like FxCop, Gendarme is a rule based code analysis tool. Gendarme can be considered stricter than FxCop but does analyse the code in more depth than FxCop. Gendarme is best set up on a continuous integration server as the analysis execution is rather slow on larger solutions.

NUnit

http://www.nunit.org/

The most commonly used unit test framework, NUnit. Readily available documentation and easily set up. Specifically build for .Net and integrates well with ReSharper.

NCrunch

http://www.ncrunch.net/

NCrunch is like the scalpel in a surgeon's toolbox. It is a must have tool. The unit test result feedback loop is dramatically shortened with NCrunch, so much that the unit test results are revealed to the developer without the need to save or build the application. NCrunch constantly builds the application and runs the unit tests in the background while the developer is writing the code. Unfortunately NCrunch is longer free however the value of this tool is well worth the investment.

Fluent Assertions

http://fluentassertions.codeplex.com/

Fluent assertions is a natural way to write and read the test results against the expected results. The documention is thorough and easy to follow. In the NUnit framework validating a result would be in the form of an assert, eg. Assert.AreEqual(5, result). With FluentAssertions, the result is checked naturally as it should be read, eg. result.Should().Be(5). FluentAssertions also supports asserting of arrays and lists.

NSubstitute

http://nsubstitute.github.com/

NSubstitute is a simple and easy to implement stubing and mocking framework. The documentation is well laid out and easily referenced. Long are the days debugging the complex lamba expressions in RhinoMocks.

SpecFlow

http://www.specflow.org/specflownew/

Behaviour Driven Developer (BDD) or Acceptance Driven Developement (ATDD) is a technique in software development allowing the business domain to write tests in a logical readable format which are then translated into re-executable tests. SpecFlow is the binding framework between the business domain and the developer. Worth noting that BDD does however focus mainly on integration tests and therefore as the test suite grows the execution time slows.

Sunday, 13 January 2013

What is the difference between a stub and a mock?

Unit testing is an essential practice in software development which aims to improve the overall quality of software. With unit testing, the software developer can continuously corroborate changes in the software. Unit tests provide the developer with instant feedback when a logical error has been introduced. The prompt feedback is vital for catching costly bugs earlier which results in better quality software.

Unit testing does not test the interactions between systems nor interactions in the system. Rather unit tests test small units of work in the software. For example, an add method in a calculator can be unit tested. The unit test will validate the addition of two numbers.

Controlled replacement for a dependency

By definition, a stub and a mock is a controlled replacement for a dependency. Dependencies between objects always exist even if the software is considered loosely coupled. Therefore stub and mock objects are inserted to replace the actual dependencies between objects in the system. In essence, fake objects. Stubs and mocks allow the software developer to take control of the dependencies to ensure the software is correctly unit tested. By controlling the dependencies the developer can manipulate how the dependencies interact and thus test for many possible scenarios.

Essentially a stub and a mock object are the same thing. There is however, one subtle yet extremely important difference. A stub cannot fail a test, whereas a mock can fail a test. A stub only fakes a dependency by returning values specified by the unit test. A mock object however, tests the actual dependency. For example, the add method of a calculator stub will return a certain value regardless of the input, the mock will test if the add method was actually accessed.



A simple example like baking a loaf of bread can illustrate a stub or mock. The bread is dependent on the yeast to rise. A stub object, like baking power, would replace the yeast which would yield the same rising affect. The baking powder could also be a mock object, although the mock has replaced the yeast, it will also determine if the bread has risen or not.