Archive by Author

Revisiting Algorithms: Fibonacci Sequence

I am starting new posts that visit many of the familiar algorithms that we have already learnt in the past. I will use C# as the primary language to represent these algorithms. To start, let us start with a very simple example, Fibonacci Series. 0,1,1,2,3,5,8,13,21,..etc are typically called Fibonacci numbers. These numbers were well known in ancient India. In short, each number is a sum of the previous two numbers with the seed values being 0, 1. The following is the C# code that outputs a series of Fibonacci numbers with input being the number of Fibonacci numbers to generate.

   1:  public static int[] GenerateFibonacciNumbers(int n)
   2:  {
   3:      int[] arr = new int[n];
   4:      arr[0] = 0;
   5:      arr[1] = 1;
   6:      for (int i = 2; i < n; i++)
   7:      {
   8:          arr[i] = arr[i - 1] + arr[i - 2];
   9:      }
  10:      return arr;
  11:  }

My lessons from the book, The Power of full engagement.

The Power of full engagement is written by Jim Loehr and Tony Schwartz. The book provides a very compelling argument for change. The central philosophy of this book revolves around using four forms of energy. These are physical, emotional, mental and spiritual energies that will help us to overcome our performance barriers and peak at critical moments. I put the salient points of this book in this presentation.

 

 

To obtain a quick snapshot of your current energy management strengths and challenges, go to http://www.hpinstitute.ca/assessments_free.html

Great tools for diagramming and presentations.

I use these tools for making my presentations and for some initial planning. These are great handy tools.

http://www.Prezi.com for making presentations. Free for 100 MB.

http://www.websequencediagrams.com for generating sequence diagrams.

http://creately.com/ for online diagrams and collaboration.

http://www.gliffy.com/ for flow charts.

A side by side comparison of Java and .Net acronyms

Often times, we jump from one platform to another while working on projects. This is a simple concise table which compares Java and .Net and explains the meanings of the various acronyms.

 

Java .NET Description
Java C#, VB.NET etc programming language.
Java virtual machine (JVM) Common Language runtime (CLR) JVM compiles bytecode into native executable instructions.
Java Enterprise Edition (JEE) ASP.NET, Sharepoint, WCF, etc., Enterprise web development.
Java FX Silverlight, WPF Rich applications
Java Development Kit (JDK) .Net framework multiple versions are supported.
Spring MVC, Struts 2 ASP.NET MVC, Spring.Net MVC MVC frameworks.
JSP pages ASPX pages pages that serve dynamic content form server.
web.xml web.config web application configuration files.
Eclipse based tools Visual Studio Team System IDE for development
Apache, Tomcat, JBoss, etc., IIS web server
Maven, Ant MSBuild, Nant Build frameworks
Junit Nunit unit testing frameworks

 

Please let me know if I missed any obvious ones or if you notice any incorrect comparisons.

Learning new programming language

This was my reply to a question posted on StackOverflow about learning new languages. You can find the question and more discussion at

http://stackoverflow.com/questions/1041687/learning-a-language-while-on-a-project

I would like to mention ALT.NET here

Self-organizing, ad-hoc community of developers bound by a desire to improve ourselves, challenge assumptions, and help each other pursue excellence in the practice of software development.

So in the spirit of ALT.NET, it is challenging but useful to reach out of your comfort zone to learn new languages. Some things that really helped me are as follows:

  1. Understand the history behind a language or script. Knowing evolution helps a lot.
  2. Pick the right book. Research StackOverflow and Amazon.com to find the right book to help you ease the growing pains.
  3. OOP is fairly common in most of the mature languages, so you can skip many of the chapters related to OOP in many books. Syntax learning will be a gradual process. I commonly bookmark some quick handy guides for that.
  4. Read as many community forums as possible to understand the common pitfalls of the new language.
  5. Attend some local meetups to interact with the community and share your pains.
  6. Take one pitch at a time by building small not so complicated applications and thereby gaining momentum.
  7. Make sure you create a reference frame for what you need to learn. Things like how security, logging, multithreading are handled.
  8. Be Open minded, you can be critical, but if you hate something then do not learn that language.

Finally, I think it is worthwhile to learn one strong languages like C# or Java, one functional language and one scripting language like ruby or python.

These things helped me tremendously and I think it will help all software engineers and architects to really gear for any development environment.

My first Hello world program in Objective-C

Here is my first program that I wrote in Objective-C, and keeping with the tradition, it has to be the Hello World program.

   1:  /* This is a simple hello world program */
   2:   
   3:  /* Includes the systems file Foundation.h that has some 
         specific classes. */
   4:  #import <Foundation/Foundation.h>
   5:   
   6:  //Begin Execution
   7:  int main (int argc, const char *argv[])
   8:  {
   9:     /* For now, the below code is mainly for memory 
          management. Reserves space in memory. */
  10:     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  11:     /* NSLog is a function that displays the argument you 
          pass along with some other information.*/
  12:     NSLog (@"Hello World");
  13:     //Release the allocated memory pool
  14:     [pool drain];
  15:     //Terminate the execution of main. 
  16:     return 0;
  17:  }
 
 

Since my current background is C#, I am quite happy to find the delimiter ‘;’ is the same in Objective-C;). However what is unsettling to me is the whole memory management. I got really comfortable with .net garbage collection. Commenting style is pretty much the same as others. I mixed up the commenting style to show both styles are possible. Microsoft looks like a saint to me compared to Apple when it comes to forcing me to develop on a MAC. Anyway’s, I will be sharing more code samples, more information in the coming days as I progress through my quest to build the greatest IPhone App.

Getting started with IPhone Development

I will be doing a lot of learning around IPhone and its App development in the coming days. Hopefully my blog posts will help somebody like me who is looking to get started with IPhone development. I will be covering more topics in the coming days as I get myself up-to-date with this technology. To get started, I am creating a list of resources that I can access during my learning phase. Having a finite list that won’t grow over time is important to quickly get up-to-speed on some new platform and then use your experience to write good software. So, in this spirit, as a good first step, I created the following list of resources.

Firstly the book which everyone considers a bible for IPhone development is Programming in Objective-C 2.0, by Stephen G. Kochan. It is currently in its second edition.

Programming in Objective-C 2.0, Second Edition - Graphically Rich Book

Next are some favorite sites, tips that I collected to get myself started on IPhone development.

IPhone Development: 12 Tips To Get You Started

CS193P - Cocoa Programming | Announcements(Stanford Course)

iCodeBlog

Cocoa Is My Girlfriend

AppsAmuck IPhone Development Tutorials and Examples

Cocoa with Love

http://www.iphonesdkarticles.com/

CocoaLab

Hopefully, all these tutorials will help me build my first IPhone App.

So, my next steps are as follows:

  • Setting up a development environment.
  • Become a registered IPhone developer.
  • Create a list of best practices for IPhone app development.
  • Study architectures of existing apps to gain better understanding.

My Gravatar from Expression Design

Not sure why I spent an hour or so trying to build my gravatar using Expression Design, but I did. I am very happy with the end result. Working with Expression Design gave me a good hang of things, specially the flow of the brush stroke, the dash attribute and many more.

Here is the image (size to fit my blog)

 

TreeHouse

Here is the Avatar version -

TreeHouse

 

I have started liking Expression Design, seems very simple to use.

5 must have books for programmers

Every programmer should have these books on his or her shelf.  The authors of these books cover a wide range of material in the form of design patterns, real-life experiences, code samples,  and software construction. They present the material really well in a platform agnostic way. If you are serious about your career in computer programming, these books can help you build great reliable software. These books are not ranked and are in no particular order. I linked each of these books to Amazon but you can find them at other stores as well.

 

Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides
Code Complete by Steve McConnell
Pragmatic Programmer by Andrew Hunt, David Thomas
Refactoring: Improving the Design of Existing Code by Martin Fowler
The Art of Computer Programming: Fundamental Algorithms by Donald E. Knuth

ASP.NET MVC Round up

ASP.NET MVC enables developers to easily build web applications using a model-view-controller pattern.  It enables full control over HTML markup and URL structure, and facilitates unit testing and a test driven development workflow. It is free and fully supported by Microsoft.  Below are some links that I feel provide a great roundup for tracking ASP.NET MVC.

Rob Connery is building a storefront using ASP.NET MVC. He has over 26 webcasts and blog posts, documenting the building of an e-commerce storefront using ASP.NET MVC. He uses Domain-Driven-Design and other design patterns to build his storefront. I recommend his entire series for anyone starting out on ASP.NET MVC.

Scott Guthrie on ASP.NET MVC. I don’t think ScottGu needs any introduction.

Phil Haack is the Project Manager on the ASP.NET MVC project. He gave a great presentation at MIX’09 called Microsoft ASP.NET Model View Controller (MVC): Ninja on Fire Black Belt Tips. He followed it up with a blog article on his site where he uses JQuery Grid with ASP.NET MVC.

Scott Hanselman gave a great presentation at MIX’09 demonstrating his nerd-dinner application built on ASP.NET MVC.

Stephen Walther has a series dedicated to ASP.NET MVC. He provides some great tips, sample code and much more on his blog.

Related Links