Pair programming Dojo Experience

I and my friend did a Dojo last month you can find it here. Below are the experience we had.

Gautam’s learning:

  1. How much the experiences of the 2 developers worked in different environments differ from one another. His way of coding, ways of finding & implementing solutions etc.
  2. Working with Vikram also forced myself to think of different ways to prove my point and to keep patients when there is discussion on a particular topic (Specially when we discussed about the starting point of the tests execution.)
  3. As far as coding is concerned I learn few shortcuts from tools and learned a better technique of renaming variables and functions which I knew how to do it but never thought of implementing not sure why.
  4. Above all I did my first TDD during this Dojo so got to learn a lot about it. Also learned about how keep your excitement in control while implementing various functionalists while working with TDD.
  5. Overall it was a small session of about 2 hours but we learned a lot from each other and looking forward to continue this Dojo.

My learning:

  1. How a solution approach is different of a person for instance: Gautam was insisting to add few more test cases to make sure the code is working were as I wanted to follow the rules that was instructed.
  2. The names of methods came lot better with 2 pairs of eyes.
  3. When we pair up with new individual how we must slow our self and the fellow member while learning new skills. Patience is the key.
  4. Learned a handful of key shortcuts which was a normal habit for the fellow member
  5. Adapting to work with new laptop with some of the keys placed totally difference from mine.

Even though most of our experience are alike, but adding it explicitly made a lot more sense of understanding.

Happy Pairing!

Advertisements

Android Apps for software developers

Here is a list of three apps I frequently make use during/for my software development activity.

3 Android apps I use are :

  1. Stack Overflow
  2. Pomodoro
  3. Twitter

Stack Overflow : It doesn’t need any introduction. If you really care about your craft try to contribute to the community. Answer the questions out there in a more human way possible. When I am not in front of my computer. I just have to see it on the app with the notification coming on the top. Thus letting know any progress in my previously answered or edited question. It helps to keep the score.

Pomodoro : Its is a time management technique. A very simple one but not easy to practice. In crisp it helps you to focus on a task for 25 minutes. Its a timer that goes of every 25 mins followed with a 5 minute break called as Pomodoro time. The apps give you a sticky note to write down your current task. The main challenge here is to focus on your working during those 25 minutes. Initially you can make a list of distractions during the Pomodoro time. Later have action plan to overcome the distraction. Find details on Pomodoro Technique.

Twitter : WHAT!! Yes you must be wondering how on earth can twitter help you become a better developer? But really if you use the tool effectively it is really helpful. It can play a role of aggregator of information. You can select people whom you want to follow, be it technical, leadership, personal development or entrepreneur. Make sure that they don’t spam your tweet feed. Also remember you can always un follow people. Go through your tweet feed when you are waiting for something. The wasted time could be converted into learning. And yes you can follow me @vikramshettyc

Also share your list of Android app on your mobile phone.

Happy learning!!!

Beautiful Code

The code which is understandable, maintainable, robust, decoupled and neat can be called as beautiful code. Many may definitely argue with me, for the justification of the definition. The bigger questions here is not what the definition of Beautiful Code, it’s about how do we learn to take our code in direction of Beautiful Code.

A simple human nature is when we understand a concept we embrace it without conflict. For instance every programmer understands conditional “if“. So when it is in your code you don’t feel alienated but when you find it spread all over the code block you feel so frustrated. We may conclude a stage of beautiful code looks like, code must be easy to understand and easy to change. See I mentioned the word easy.

Here are few tactics to sharpen our skills, understand our code and embrace to change.

  1. Learn & Practice Test Driven Development period
  2. Create the written one page goal of beautiful code standard your team considers to be good enough. Thus creating clarity in achievable goal.
  3. Make a list of coding style changes you want to see in your teams code e.g: No single letter variable or Code should read like English. Compile a list of 10 items. You can use any method to conclude but make sure everyone contributes to the list.
  4. Learn new technical skills every week. This could be as simple as using a keyboard shortcuts, implementing new language feature, or implementing design patterns. The key is that it must go into production code. Make it a part of daily routine.
  5. Give a small token of appreciation on daily achivements thus creating a growth culture. It could be as simple as clapping in a stand up meeting for a team member.

Happy Coding!

Go Code Refactoring

Code refactoring is must have skills in our tool box.

Wikipedia gives below mentioned definition

Code refactoring is the process of restructuring existing computer code without changing its external behavior.

There is a classic book on Refactoring by Martin Fowler.

The topic is vast when there is a whole book written. I am trying to mention 3 easy steps we took in our recent project to get started:

  1. Renaming variables and method names. In all the modern IDE there is a feature of renaming the variables and method names. It’s safe because it will not break your compilation and still guarantee your code will be read better. The code is better from the time you do your first rename.
  2. Delete all commented code. It is self-explanatory. An excuse given is I may need the code in future. You can get your code back by using source control system, So use source control system to archive your code. Thus reducing the lines of code you don’t have to browse through your code at all.
  3. Extract method is one of the handy ways when your method starts growing huge. If we us the help of modern IDE it has the feature to do it safely. We have to be careful but IDE will help us in a great extent. This technique will also help in reading your code better.

Happy Refactoring!

CSS sprites repeatable

CSS sprites Wiki says:

To reduce the number of requests the browser makes to the server, some web designerscombine numerous small images or icons into a larger image called a sprite sheet

You can read advantage of CSS sprites here. Example of CSS sprites can be found here.

Background: Now the catch we had was while using CSS sprite to create repeatable image effect. When we increased width using css we saw the adjacent image repeating.

Solution: We used a single image vertical css sprite: image source.

Complete solution in here.

Happy Programming!

Simple way to dynamically load text to marquee

There might be many other way to load text dynamically to marquee, like javascript, Ajax or Jquery library. But I will show a very easy way using HTML and  Asp.Net

The aspx page will look like

<marquee direction="left"  onmouseover="this.stop()" 
onmouseout="this.start()" scrolldelay="100" 
style="height: 127px; width: 457px;">
    <asp:Literal ID="ltDisplay" runat="server">
    </asp:Literal>
</marquee>

The code behind page will look like

 protected void Page_Load(object sender, EventArgs e){ 
ltDisplay.Text = SomeMethodCallingActualText();  
}

Happy Coding!

2000 things

While browsing though internet I got a web site name csharp.2000things.com. The idea of this blog is to know 2000 things about C#. It is Sean Sexton. So the question is what should we do with this great resource. It has very small description with example on various topics like Data Types, Events, Interface, methods etc.

Reading style:

  1. Selecting total post you can read per day.
  2. Create a schedule for couple of months to read it.
  3. Some will be like brushing old concepts.
  4. Some will be new for you.
  5. You can also write the code like a KATA and muscle memory it.

Happy Reading!

Auto deployment

You can always get the How To @ msdn for setting up build server on Microsoft Team Foundation Server. I will list down few of my leanings while we tried setting up build server for more than 20 Dot Net projects.

Some points to remember while setting up the build server.

  1. Every action from check-in to deployment in the development server must be automated.
  2. Don’t do a Big up-front build server project setup for all projects. Start with couple of different kinds.
  3. Keep the merges to minimum. Avoid merges totally if possible.
  4. Keep a set of Automated Tests for sanity.
  5. Keep enough space on the build server.

Some of the above points might sound trivial but when you have lot of human intervention to deploy a build on the development server. Humans will become bottle neck when there are multiple deployments lined up. Make sure you setup a complete automated build with one click deployment even if it means to spend 2 weeks at office as it will pay off in long run.

Jumpstart a new team member

We came across a scenario where a new member joined our team. Now we wanted to know how does the new member get along with other members. Below mentioned are the activity we did to find out.

Idea & Agenda:

  1. Schedule non-stop time of at least 4-5 hours.
  2. Target to complete end to end functionality of small feature.
  3. End of 4-5 hour we should get product which can be used by end users.
  4. New member must pair program with each member.
  5. Have enough water and some snacks.

Objective of the exercise

  1. To understand the work style between team and new team member.
  2. To understand the capacity & capability with new team member.
  3. To make the new member get adapt to team culture.
  4. Team member making sure they use unique practices.

Happy Teamwork!

Use of Action (Function programming) for better code health continued

Please read Part 1 of this post here.

But with the following code I can just do away with making change only to one place.

Class HandelException {
 function HandleError(Action success,
Action <Exception> fail, Action final){
 try{
 sucess();
 }
 catch(Exception e){
 Log(e.Message);
 fail();
 }
 finally{
 final();
 //Do some funky stuff here;
 }

 }
}

Class A {
 int i;
 int j;

 function Add(int arg1, int arg2)
 {
 //Comment:
 HandelException.HandleError(sucess,fail,final);
 HandelException.HandleError(
 () => {return arg1 + arg1;}, //success
 (e) => {RaiseException(
  "Addition Failed in Add()"); }, //fail
 () => {/* clean up code */} //final
 )

 }

 function Sub(int arg1, int arg2)
 {
 () => {return arg1 - arg1;}, //success
 (e) => {RaiseException(
"Addition Failed in Sub()"); }, //fail
 () => {/*clean up code*/} //final
 }
}

See the magic here… we are not passing any parameters to the handler class.

  • We just provide the function parameters that we might want to use in the consuming (Class A) class.
  • We might want to use the exception (here -> e parameter for fail action)  for propagating user friendly message to higher layers)
  •  Now Class A concentrates more on its given responsibility (do some Math work) than the other clattery codes. It’s easy to spot logic errors there.
  •  Let say if we want to audit log all the calls to methods. Just add a logger statement before and after  sucess()  in HandelException.HandleError -> Try Block that will do the trick.

Hope this serves the purpose of explaining the use of <actions>. There are more things to it will cover it some other time.