tips

Developer Interviews – Code first approach

August 3, 2012 Developer Hub, Off-track, Personal ,

 

One of challenges that I’ve seen people facing while executing projects is that they often end up having people in their team  (many a times screened by some experts) who are not good at writing quality code.  There could be many arguments that writing code is not the only thing when working in an IT organization, but I have closely observed and built my theory.

Most of the projects that we execute or applications that we build do not require us to write code from scratch.  Which means, either someone has already written some code (also means the design already exists) and we are extending the design specifications, or we just maintaining it only as much as it is required to keep our end-users happy.  Software evolves, it is not created!

I am sure some of the readers would be working on green-field projects and they would disagree to the above said.  I, myself, have worked on several green-field projects but these projects are very rare to find.  Most often, projects that are on the verge of retiring tend to produce green-field projects or projects that cater to a distinct set of requirements to be used for a specific purpose turn out to be green-field projects.  But this number is small. Or putting it in other words, the profit made from these projects is less.

Believe me, the skills required to design a green-field project are same as required to maintain a version of a “live” project.  That’s where the catch is.  Maintenance projects aren’t easier to develop.  Writing code within the boundaries of design created by someone is more complex than defining your own boundaries and writing code within them.  Oh, of course if we do not want the code to be maintainable, readable, scalable then we ought not worry about code quality in a maintenance project.

Software evolves, it is not created!  And this evolution requires developers to be able to write code while they perform other monitoring, reporting and rewarding tasks.  And even if you or your team members are engaged in any non-development tasks, being able to write code is the easiest way to hone your analytical skills.

So with this philosophy, I prefer candidates who may not necessarily perform the task of development on a regular basis but can write code if the need be.  Now, you don’t need to be code masters.  You need to be logic-crackers and the “CAN-DO”-attitude man.

When interviewing a candidate we usually check his communication skills and attitude, technical & analytical skills if he is required to write code, presentation, leadership and risk taking abilities for senior roles and …. (may be a HR can add more qualities screened).  But all roles need the candidate to be sound in logic.  So for testing logic, I prefer to give some very simple program to write in any language of their choice.  English is also one of the languages!  Believe me I see 40% rejections at this stage of interview.  Candidates with niche skills sometimes are not able to think through the solution.  May be it is the stress, or may be it is that they never expected a question that simple.  By asking someone to write code, you aren’t checking their development-quotient. You are instead checking if they will be able to apply logic (I am not referring to Mathematics, here) in problems of smaller or larger scale.

Like say, a favourite question of mine is,

With simple mathematical equations, write a program that will swap two numbers

There are several solutions to this problem.  What this problem statement refers to is applying the logic we learnt long ago.

Another simple program that I generally ask them to write is,

While iterating through 1 to 100, for every odd number print “Thumbs” and for even numbers print “Up”.  For a prime number, print “ThumbsUp”

One more,

If for every 3 steps that I take ahead, I take 1 step back.  When would I cross a point that is 100 steps ahead of me?

That’s again mathematics – no programming language knowledge required.   And if you are speaking to a candidate who knows a programming language, you better ask them to write a simple program of say factorial, or Fibonacci series.  We are not looking at perfect answers here.  We are looking at how they analyse a problem, their approach, their willingness to do something that they haven’t done since long.

When questioning on software design there are ample of questions available on the Internet and almost all candidates would have gone through them.  But a real time problem can be a googly to most brilliant minds.  Even I’ve faced a googly in a discussion I’ve had sometime ago.  Again, one of my favourite design puzzles is,

We are required to build a tic-tac-toe game for 2 players, X and O, who take turns marking the spaces in a 3×3 grid. The X player usually goes first. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.

If you were to design this game (not develop), identify the classes that you would create?

Most of the candidates, here, misinterpret the question.  They start describing the interfaces and inheritance they would use; or would start with a Windows application and define UI elements like grid, buttons, etc. Everything is given as an answer, but the names of classes.

Problem statements could be many.  Puzzles could be endless. When you are hiring someone, get the man who could sit besides you and challenge your logic and quotient.  Not one that keeps appreciating you even if you are wrong!  We after all want to come up with variant thoughts and innovation at work!

Update: This article has been update on 21 Nov 2012.  It has been enhanced and I have correct some of the statements that I seem were originally not clear and may appear incorrect.  All websites that pull content from my site should update the article or retain this version only.

Installing Buddypress Template Pack

January 3, 2012 Wordpress ,

This post is very specific to installing non-Buddypress compliant themes on Buddypress enabled WordPress website.  So for those who don’t know what is Buddypress – Buddypress is a plugin that enables creating public/private social sites with features such as Blogging, Tweets, Forums, Groups, Activity Streams, Discussions and many more.  More features can be enabled by installed 100s of Buddypress plugins.  You can read more here

 

Problem with Buddypress –

Buddypress creates new or uses existing pages for its features. But it does not display any page content and instead replaces the page content by its standard pages.  This means that if you have a page called ‘Groups’ and it is blank but if it is configured with Buddypress you can still view the Groups page. 

Now if you install any non-Buddypress-ready theme with Buddpress enabled, you will see the actual Groups page (that can be blank, or may contain something) but not the Buddypress Groups page.

Think of it.  You have less than 50 Buddypress-compatible themes in market (as of 3 Jan 2012) and over 10000s non-compliant theme.

The solution – Buddypress Template Pack

You can install a plugin named ‘Buddypress Template Pack’ to convert any Buddypress non-compliant theme to a compliant theme.  However, this template pack does not convert each theme into Buddypress theme.  It finds out links and redirects them to use Buddypress behavior.

That’s as simple as said.  Download it from here

But many users face issues while activating this plugin

  • Error 404 – Page Not Found
  • Error 500 – Internal Server Error

and you could be just another one getting this error.  This error is primarily because the currently activated theme is creating hindrance in changing the settings.  These errors have an easy fix :

  • Deactivate the plugin.  If you are unable to, then go to \wp-content\plugin and append the folder name by TEMP
  • Enable a theme that is non-compliant to Buddypress.  You can use a default theme for the time.
  • Activate the plugin.  If you have renamed the plugin folder, you should revert that change.
  • Enable a Buddypress theme
  • Run through the wizard of plugin to do the settings.

That should help you get going!

Fix: Program does not contain a static ‘Main’ method suitable for an entry point

October 18, 2011 CSharp, Visual Studio, Winform, WPF , , , ,

This does not require a detailed post and just requires a quick solution for the problem-

Understanding the problem… Why? When?

When you convert a Winform application into a WPF application –  In a Winform or a Console application, you need a static Main method that acts as an entry point to your executable.  In a WPF application, you do not require any such static class to be present at the compile time.  You need an App.xaml file that appears something like this

[sourcecode language=’xml’]



[/sourcecode]

Here StartupUri represents the first/launch WPF Window or a Page and the App.xaml.cs is very short and simple

[sourcecode language=’csharp’] using System.Windows;

namespace MyWPFApplication
{
///

/// Interaction logic for App.xaml
///

public partial class App : Application
{

}
}
[/sourcecode]

When you migrate a Winform application to WPF application, you can add this file explicitly to your project to get started. But when you would compile, you will find a compilation issue

Program does not contain a static ‘Main’ method suitable for an entry point

So the compiler treats App.xaml just like any other WPF page instead of a special class which we call it as ApplicationDefinition class.

What is the fix?

 

Check the properties of App.xaml. Change the Build Action to ApplicationDefinition and re-compile.

This also means, you can have any XAML file to be your ApplicationDefinition file.  But it is preferable to name it App.xaml since it is industry standard and adds consistency to all your projects.

 

 

 

Winform Tip#10: Getting File Properties

July 25, 2009 CSharp, Visual Studio, Winform , , ,

Instantiate a FileInfo object with the full path as constructor arg. Then simply call FileInfo.Extension and you will get just the extension of the file.

 

FileInfo finfo = new FileInfo(strFileName);
Console.WriteLine(finfo.Extension);

Similarly, you can get more properties

Winform Tip#9: ColorPicker

July 24, 2009 CSharp, Visual Studio, Winform , , ,

Choose a textbox over which we will test this experiment:
[sourcecode language=’csharp’] ColorDialog colorDialog1 = new ColorDialog();

//fontDialog1.ShowColor = true;

if(colorDialog1.ShowDialog() != DialogResult.Cancel )
{
txtMessage.ForeColor = colorDialog1.Color;
}
txtMessage.Text = “Test for ColorPicker”;

[/sourcecode]

Another tip in this: Similar is for FontDialog. Try using it 🙂

Winform Tip#8: Clearing cache Webbrowser

July 20, 2009 CSharp, Winform , , ,

Check out: http://support.microsoft.com/support/kb/articles/q326/2/01.asp

It is indeed a good read.

Winform Tip#7:Browser within Winform

July 5, 2009 CSharp, Winform , , ,

WebBrowser control can be used inside a form to display HTML contents and listen to events such as NavigateComplete or BeforeNavigate

Use of ActiveX wrappers over old DLLs is not prefered.

Winform tip#6:DataGrid vs DataGridView

July 1, 2009 CSharp, Winform , , ,

DataGridView is an enhanced version of DataGrid.  Some of the features lacking in DataGrid are:

  1. Multiple column types
  2. Multiple ways to display data
  3. Multiple ways to customize the display of data
  4. Multiple options for changing cell, row, column, and header appearance and behavior

Winform Tip#5: Programmatically maximize or minimize a form

June 30, 2009 CSharp, Winform , , ,

Use the form’s WindowState property.

To minimize:

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;

 

To maximize:

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

Winform Tip#4: Deployment in Winform

June 12, 2009 CSharp, Winform , , ,

Best way to deploy is by using ClickOnce deployment. This allows user to get regular updates, patches to the product while conforming to the security standards.

Read: http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx

Follow on Feedly