Thursday, December 19, 2013

Getting Started with Accpac Programming

Recently I have accepted a new position at Kerr Consulting that specializes in integrating ERP and other financial software packages such as Quick Books with existing software. Most of our work is related to Sage products and I have been specifically tasked with becoming an expert at Sage 300 ERP (Accpac) programming.


A Simple Example

I find it difficult to find simple examples when getting started programming any new platform. So I will start out with a very basic example of how to simply connect to Accpac.

Dependencies

  • We are programming with the .NET Framework version 4.5 and MS Visual Studio 2012. There is no problem with downgrading to lower versions of .NET and Visual Studio.
  • We are using Sage 300 ERP 2012/ 6.1 for the example code. This must be installed on your system in order to write software for sage.
  • Additionally you will need to install the Sage 300 ERP SDK v2012 that should be provided for you. The installation is named SDK61A.exe in my system.

References

You must make a reference to the AccPac COM library in order to access the SDK in .NET. Under your project right click on References and click Add Reference… Then click on the COM tree node on the left hand side of the form. Check the item named ACCPAC COM API Object 1.0 and then click ok to finish adding the reference. You can see where I have added the reference to my project below:



The Code

After your reference is added to your project the below code can be used to connect to Accpac and retrieve the Application Version you are programming on.

namespace Example1
{
    class Program
    {
        static void Main(string[] args)
        {
            var accpacSession = new AccpacSession();

            //Initialize the session. You will need to pass another version instead of 61A.
            //for AppVersion. I am using 6.1A so I pass 61A here.
            accpacSession.Init("", "XY", "XY1000", "61A");

            //This is the default setup for SAMINC but it might be different on your system
            accpacSession.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Now, 0, String.Empty);

            //Write out the Application Version. It should be 61A just as you passed to Init.
            Console.WriteLine(accpacSession.AppVersion);

            //Always close the session when you are done.
            accpacSession.Close(); 
        }
    }
}

Where to Get More Help


  • The best resource for SDK help is Stephen Smith’s blog. There is a ton of information there that you won’t find anywhere else including the Sage documentation.
  • There is also a wiki page for Sage 300 ERP that has a variety of examples. However, you will have to be a member of the developer network to view or updated it.




Thursday, April 18, 2013

I Knew a Programmer that Went Completely Insane

Not long ago one of our programmers just lost it and he lost it good. He walked into the manager’s office and began screaming strange things. If I didn't know him as well as I did I would have thought that he was on some kind of drug. But what had really happened was nothing short of a complete mental breakdown.

He was one of the hardest workers I had seen in the industry. He would frequently stay after hours to work on projects; He was always available when management needed someone to rush a job out over the weekend. During this time the Company was not making money and they needed the work done as quickly as possible, so any software that had to be rushed to a customer was automatically assigned to him. His willingness to push himself to get a job done is what they liked about him.

However, his productivity was not so great when he landed in a mental institution. I was the one that the company sent to visit him in the hospital to check on him after his breakdown. He asked me for a pen and a piece of paper so he could write a program down. "I think I still got it" he said, as he sat there in his hospital robe. He wrote two lines of code on the piece of paper and then began to weep uncontrollably. The company let him go after about three months in a hospital and a few threatening phone calls. He ranted about how he should be the CEO and that he was going to be the new face of the company.

 Later he spoke about how the effort he put into the company should have given him more respect and a better position. Despite being well treated and paid, for his hard work, he was still looked at as just a worker that produced well. He was never considered to be a key player in the company.

It may be hard to swallow but the extra effort and hours that you put into your job as a software developer does not usually amount to someone higher up thinking you should run the company. It has been my experience that good producers are more likely to be asked to continue to produce. If they moved you to a higher position and better pay then who would produce the software?

All too often we lose site of the human factors in software. It doesn't matter if management pushes people to overwork or if it was their own bright idea to get ahead. The result is always the same. People are just people. They are not machines that can produce day after day without some kind of human interaction. In the end everyone needs a life. 

Source

LIFE

Good Reading


Peopleware: Productive Projects and Teams (Second Edition)
This was required reading when I was going to school. It is an excellent book for both programmers and managers alike.


Death March (2nd Edition)
This is another great book on the human factor of software development. After reading this, I realized that I had been on several "death marches" myself.


Monday, April 15, 2013

Extension Methods

Extension methods in .NET are methods that can be attached to another class without changing that class. In .NET extending a class is not the same thing as inheriting from a class. Extension methods only serve as a syntax shortcut to add helper type methods to an existing type or class.

Using Extension Methods

In both C# and VB.NET you can write a static class with static members to create your own extension methods. Below is an example of an extension method called SplitByPipe that extends the system type String to support splitting the string by a pipe character.

   1:  public static class StringEx
   2:  {
   3:    public static string[] SplitByPipe(this String s)
   4:    {
   5:       return s.Split('|');
   6:    }
   7:  }
   1:  class Program
   2:  {
   3:    static void Main(string[] args)
   4:    {
   5:       string input = "string1|string2|string3";
   6:       var result = input.SplitByPipe();
   7:       Console.WriteLine(result[1]);
   8:    }
   9:  }

You can also extend generic methods. When you create a generic extension method you must add the type parameter, in this case T, to both the method name and the this parameter type name. See the below example:

   1:  public  class MyClass<T>
   2:  {
   3:    public T Value { get; set; }
   4:  }
   5:  public  static  class MyClassEx
   6:  {
   7:    public static void MyEx<T>(this MyClass<T> mc)
   8:    {
   9:       Console.WriteLine(mc.Value);
  10:    }
  11:  }

Limitations

The this reserved word before the first parameter of the string is required. It tells the compiler what class you are extending. The this keyword must also be the first parameter in the parameters list . You can add other parameters to the function but they can not have a this proceeding them.

The class and the method must both be declared static. This is a strange case where you are actually calling a static method but you usually call it using the instance of a class. If you want to call it as a static and not as an instance method than you must call it using the static class. In this case you would call StringEx.SplitByPipe(input).

You can not override a base method using an extension method. Although the compiler will not give an error, it will not work. Methods declared in the actual class will always take precedence and the custom extension will be ignored. However, if you have an extension method with the same name as a base method but different parameters, the extension method will be called and not the base method. The method signature has to be unique not the actual method name.

You can only override methods. C# does not provide any functionality to extend properties. The only alternative is to use the naming convention using methods: getMyProperty(...) and setMyProperty(...). That will not provide actual property syntax but it is standard naming when you can not use properties.

Your extension method's namespace must be included in order to show up. Just including the namespace of the base class will not import the namespace of the extension method. Extension methods are often included in a seperate assembly so you would first add the external assembly as a reference and then add the using statements to your codebase.

Why Use Extension Methods

While extension methods are in no way required to make a good .NET application they are very useful when it comes to writing utility type functions on an existing framework or even within your own code base. It is usually not considered best practice to inherit off of common and built in types like String and Integer. Doing so can make your code less portable and non-standard.

It is also worth mentioning that some classes in C# are sealed so you can not extend them using inheritance and you would have to explicitly declare them as partial in order to add to the class using a partial.

When Should You NOT Use Extension Methods

Extension methods can help you to avoid incrimenting a version number on a assembly by allowing modification to your class outside of its actual library. MyLibrary.dll might contain the core functionality while MyLibraryEx.dll would include extensions to that library. This can make sense when the extensions are not required in the core library and they logically fit together. However, if your only goal is to avoid recompiling an assembly than it is not a good idea. Multiple libraries that do not go together will only serve to complicate your references and make it difficult during deployment and troubleshooting.

If you are generating code using t4 or other scripting languages than a partial is more appropriate. A partial will give you more power and flexibility when you control the actual base class.

Inheritance may be more appropriate if the functionality fits more into the actual core requirements of your software and are always required. For instance if you have an animal super class and both feline and canine sub classes than it would make more sense to use inheritance instead of implementing feline and canine extension methods.

As with any programming feature, it can be overused and abused. If more of your solution is extension methods than other types of code than you may be overusing them. Generally my solutions only have a few extension methods that are used when I think the core framework should have implemented something or when it just makes the program easier to read.

What About Before Extension Methods

Before extension methods plain old static classes were used and the programmer would just pass an instance of the class into the static method. These are often called helper methods or helper classes. Helper methods are still in use even with the introduction of extension methods.

More Tips

  • You can implement more than one extension method type in one class. It is possible to extend both String and Integer within the same static class.
  • There is no naming convention enforced by the compiler. Extension classes do not have to end with Ex and the file does not have to end with Ex either.

Sources


More Resources


C#/.NET Little Wonders: Extension Methods Demystified


Updated: Generics can be extended. I removed it from the limitations.

Friday, April 12, 2013

Why You Shouldn't Use Privates Anymore

For nearly half of my career I thought that hiding member variables and methods with private and protected was one of the best ways to write better code. You have probably been taught in school or have read several well written articles of why using private makes your code better.
In theory hiding the details of the class using a private can have the following benefits:

  • Reduces the complexity of the code by limiting communication between modules.
  • Hides implementation details so that you can focus on the what instead of the how.
  • Prevents access to dangerous variables that could unintentionally cause the class to break.
  • Reduces the scope of a member to just your class.

All though I have found that the above are true there are an equal amount of negative consequences for using private scoped members. The negative impact of this design choice, in my opinion are far worse than the actual positives involved. There are other ways to achieve the above goals without the usage of private members.

Limiting communication between modules is a concept that comes from a psychologist named George Miller.  Millers Law basically states that human beings on average can not handle more than 5 plus or minus 2 ideas, entities or objects at one time. I am always aware of this basic principle when designing both user interfaces and when coding.

It is not necessary to lock the inner workings of the class up so that no one can see whats going on inside. If you opened the hood of a car it wouldn't help for them to hide the spark plugs so you couldn't see how it works. Limiting communication between modules and hiding implementation details can be achieved by using either a purely abstract class or an interface.

Using interfaces to communicate between modules it turns out solves a-lot of the problems that private variables where solving. So the question is why do both? Well, it turns out that most developers have not been using interfaces for this purpose. It was not until Test Driven Development came along that private members have become the enemy.

The main reason that TDD hates private members is due to its negative impact on the test-ability of a class. TDD coders like to take a class and write test code that changes variables, and dependencies in order to run automatic scenarios to verify its functionality. If members and variables are private it only serves to make unit testing harder. Due to the fact that test-ability was not a key metric in traditional software engineering methodology, this was overlooked.

Preventing access to dangerous variables may save some headaches in some situations. However, I think that we should let the developers decide what they should or should not be accessed. If the developer is not accessing an interface and has access to the implementation than changing the wrong variable is not the responsibility of the original class creator.

In practice I have seen private variables cause entire classes to be re-written when all that was needed was an override of a single member variable or a trivial function. There is no doubt that the intent in those cases was to prevent developers from tinkering with things they shouldn't be. Why are we arbitrarily deciding what should or should not be "override-able" in our base classes?

If you really want to reduce the scope of a member variable than interfaces are the way to go. I don't care about the scope of a class member if it is not an interface. So let your interfaces handle communication and stop trying to force good developers from solve problems within your solutions.


Tuesday, April 9, 2013

Do I Need a Degree to Write Software?

Many people over the years have asked me if they need a degree in Computer Science to get a programming job. Technically a degree is in not required to be a programmer. However, I believe that the degree program that I completed was invaluable to my career.

Most all jobs I have applied for consider 5 years experience in the field as equivalent to a degree. I once thought that only programmers with degrees really have a well rounded background in in the fundamentals. But despite my belief in the core curriculum as minimum of skills required to be a good programmer, I have known good developers with no degree that knew all the fundamentals. I also have seen developers with excellent degrees that did not know the first thing about coding.

The real asset that you get from completing a degree in Computer Science is from the actual knowledge you acquire and the guidance you get from experienced professionals that have studied the subject at length. If you just learned how to dupe the professors and you never truly learned what they were teaching than it will most likely be found out in the interview process.

I could care less about the degree you have when I am involved in hiring developers. Would I care about is what you know. If you managed to get to the interview and you don't have a degree than it means I don't care. What I do care about is that you have the ability to write good code and you  have an understanding of everything from Computer Architecture to Software Engineering. You don't need to go to school to do that but it may help to have a structured learning environment.

There are some places that will not consider non-degree developers. I find that very rare in the industry. Once you have the experience, most places will not look at the degree or lack thereof. Having said that, not having a degree could limit your options and may mean that someone else with the same qualifications and experience gets the job and you don't.

If you do decide that school is just not for you than set yourself on a path to being a competent Software Professional by making your own learning plan.  Because you don't have to worry about classes that are not directly related to your profession you can focus all of your energy on Computer Science Subjects. The following is a minimum for a programmer to know:
  • Learn Assembly - Some developers sware that learning assembly first is the best way to be a good developer.  This is because all other languages just translate into binary and assembly is just a human readable form of binary.
  • Programming 101 - Pick up a bug on beginning programming in C#, VB.NET, Java or whatever language you want to use. I would suggest a strong type language for your first Language.
  • Object Oriented Programming - OO is everywhere right now and even if you don't like it you will need to at least understand it. I don't like how OO is mixed in to basic programming classes. A good book to start learning OO is The Object Oriented Thought Process.
  • Advanced Programming - Once you think you have mastered basic programming then move on to a more advanced book on the same language. Go past just basic for loops and variable assignments.
  • Data Structures - You need to implement your own data structures in order to write real world applications. Chances are that you will not actually write these data structures but you will use 3rd party implementations of hash tables, linked lists, stacks and tree structures etc. You don't want to learn this on the fly and it should be mastered before attempting more advanced programming subjects.
  • Computer Architecture - Learning what the underlying workings of a computer can help when programming. You don't need to be an electrical engineer but a basic knowledge of and gates, boolean logic, assembly language etc will help you down the road.
  • Client Server Architecture - Learn the ins and outs of how the web works. Even if you don't want to be a web developer, everything is online now days. You need to know how to call web services and hook into online api. Understand how TCPIP works and know "How the Web Works".
  • Object Oriented Design - Get a good book on pure object oriented design and become best friends with it. Take it to lunch and hang out with it when you get off of work. The reason is you will be using it everywhere in software. You can program with only a shallow understanding of OO but a deep knowledge will let you use 3rd party tools and api's to there max potential.
  • Traditional Software Engineering - Pick up an older book on software engineering and spend a good amount of time mastering the subject. Looking on the internet is probably not going to help here. Structured Design is a must read in my opinion. The software industry is really split three ways between companies who use no methodology, ones who use traditional approaches, and ones who use Agile processes.
  • Agile Development - Agile development is used heavily. Knowing what you are talking about in this area is important. Agile and traditional techniques but heads. Even if you think agile is the only way to do things its best to have a full understanding of the traditional techniques. This is because Agile is really takes a-lot from the lessons of traditional engineering.
  • Project Management - Even though you are a programmer and may never manage a project you need to know how software should be managed. Software Project Management is radically different from traditional Management. There is a range of techniques so don't just take one as law. The Mythical Man Month is an absolute must in my opinion. Also read books on agile project management.
  • Database Management - Although its helpful to learn SQL statements you need an academic book on the fundamental design of databases. This should teach you how to spot a bad database and how to fix it. It will help you make decisions on how to write your own tables etc. This is good as a last course because engineering plays into this.
  • User Experience - There are many books written on ui design and user experience. I would suggest reading several of them. In addition there are standards written by Microsoft and other large companies. Take advantage of millions of dollars worth of research and read what they have to say. There is nothing worse than a bad user interface to a software package. Even if you don't make user screens this can help you write better software.
  • Learn a core API/SDK - While you are trying to master other subjects make sure to learn a core industry api for what you want to develop. For me this is a user interface api such as winforms/ASP.NET or WPF. However, you may not be writing user interfaces maybe this means a graphical api like GTK or DirectX. Perhaps it means diving deeper into low level driver programming or mastering an SQL variant.
Mastering a subject takes more effort than just casual reading. Don't just read a book but study it. This means reading the same chapter over and over. Quizzing yourself on the subject. Learning does not take place within a short period of time. Read a book all the way and then spend a set amount of time really mastering what it says. Programming is learned by doing and not by reading. If the book has practice exams and exercises do them all. I can guarantee that the real world will have harder tests than the ones in your book.

While you are trying to master the art of programming you should be looking for an entry level position. If you can't find one than start your own open source project or even a project for money on your own. Even if you fail or get fired don't give up. I wrote my first program when I was 15 before I went to school. It is that experience that has helped me to get into the profession.

You should be looking to fulfill that 5 years of experience. Pay is not that important when you first start out. Experience matters, if you can get yourself in the door with a company than hold on until you feel you can get hired elsewhere.

related blogs:
do you need a degree for game dev


Monday, April 8, 2013

Should I Take Programming Burnout Seriously?

Should I Take Programming Burnout Seriously?

 Yes! If you are suffering  burnout take it very seriously as it could cause medical problems and it could be a sign of more serious mental illnesses. The advise that I give on the subject is in no way to be considered "professional advise". If you are having issues with burnout I suggest that you seek help from a professional.

You could actually be suffering from severe depression. According to the Mayo Clinic:
 Ignored or unaddressed job burnout can have significant consequences, including:
  • Excessive stress
  • Fatigue
  • Insomnia
  • A negative spillover into personal relationships or home life
  • Depression
  • Anxiety
  • Alcohol or substance abuse
  • Heart disease
  • High cholesterol
  • Type 2 diabetes, especially in women
  • Stroke
  • Obesity
  • Vulnerability to illnesses


 

What Causes Burnout?

The biggest cause of burnout is you. You are most likely an overachiever that wants nothing more than to prove to yourself and to others that you are a great developer. Its this can do attitude that most likely made you a highly skilled and a highly sought out software professional. However, if you don't take care of yourself than who cares if you are an awesome developer.

What Can I do To Prevent Burnout

In order to prevent burnout and for that matter other mental disorders you need to maintain balance in your life. It may have been fine when you where 15 to program until 3am and through the weekend. But...you were not a full time programmer and you had other things to keep you busy.  Its not good for anyone to stare at strange symbols all day and all night. You need to maintain balance in your life by:
  • Involving yourself in a hobby
  • Take a vacation
  • Hang out with people
  • Get enough sleep
  • Get a life
A good way to maintain balance is to involve yourself in a hobby. When I got severely burnout I started gardening, began bowling, took-up reading ( non-programming books ) and I began learning Spanish. The best part about taking up a hobby is if you do get burned out you can just get involved in your hobby and not worry that programming is no longer fun to you.

If you started working as a programmer than it is no longer something you do as a hobby "for fun". No matter what kind of project you are doing on the side or how much fun you think it is. So just say no to programming at home. You want to write something more interesting find another job.

If its been a while than you need to take a vacation. No programming computers on your vacation time either! Take it with real people not virtual ones. Believe me its a-lot cheaper to pay $3,000+ on a week vacation than it is to have to switch jobs because of burnout.

Hang out with people more often to keep the non-computer social interaction up. I know that people are much harder to communicate with than computers and you may feel socially awkward and just want to get back to the old keyboard and monitor but hangout with people anyways. If you must find people as geeky as you to hang out with. Or even find a girl that will put up with you.

Get some sleep for crying out loud. Pulling all nighters is not really productive. Your brain actually needs sleep in order to function. Have you ever noticed that you solve difficult problems after getting a good nights sleep and coming back to the problem.

Get a Life! There is life outside of work so go live it. Do something fun for a change. I know you think programming is fun but its really not. Spending time with your friends and family, going to a ballgame with your niece or nephew, volunteering is fun. So get a life and don't drive yourself into an insane asylum trying to be a "master programmer".

Am I too Young to Burnout?

There is no age restriction when it comes to burnout. I was severely burned out after only 2 years in the profession and had to take six months off from programming before I want to do it again. I thought that the urge to develop software was gone for good. But in fact I have been programming for 9 years after that experience and my desire to programming came back in full.

What do I do if I can't Program Computers?

If you are completely burned out from programming you may be asking yourself how you are going to make money in the future. I know that you may be thinking that programming will never be something you ever want to do again but the desire to program computers will most likely come back. Even though it feels permanent it most likely is not.
Having said that, you will need to do one of the following:
  • Take a leave of absence
  • Switch to a different role in the same company
  • Reduce your work load at your current job
  • Find a temporary source of income while you recover.
  • Find a permanent new profession
If I had to choose I would pick a leave of absence. This may allow you to keep your position while you recover. Don't feel that you have to come back too soon and don't give into pressure from your company. You may find that you are more valuable than you thought. You can just say its a personal matter that you have to attend to. You may find it better to just flat out tell your boss the situation. If it is a seasoned software development team they may know about creative burnout and know what to do. Whatever you do do it gracefully and don't burn any bridges.

You could inquire about switching to a different role within the same company. You may just be burned out on the type of programming you are doing or you may just be burned out on the coding end. Perhaps your company has different roles that you could be useful in. Even though you don't churn code anymore the company may find it beneficial to retain you as say a QA guy while you help with the transition of another developer.

If your are burned out than you need to reduce your work load. This is true weather you switch roles or switch companies all together. Burnout occurs when you are overworked and it most likely is self-inflicted. Let your manager know you are overloaded and think you can't handle a large work load right now. I know if you are an over achiever, like me, this is very difficult to say but it could save your job in this case.

If you think is better to move on than you need to find a temporary source of income. Don't worry about it being a permanent career path just get some money coming in. If you are single this is pretty easy, move in with your parents or find a good friend to live with for a while so you can deal with a reduced salary. When the desire to code comes back you can start looking for a new job then.

I would only advise finding a permenant new profession after taking a substantial period of time off. After a few months of not coding pick up a compiler and see if you want to code again. If you don't want to than wait a little longer. Some programmers take over a year off before the desire comes back. Burnouts can range in severity of a just bored to in need of medical attention.

references:
Stack-exchange: Am I too young to burn out?
Job burnout: How to spot it and take action

Hail Knuth

After committing some very bad programming sins I felt bad enough to confess them to a fellow developer. After hearing my confession he compelled me to say 100 "Hail Knuths", and to sin no more.

Hail Knuth, full of experience, the source is with thee; blessed art thou amongst software engineers, and blessed is the fruit of thy methodologies, common sense.
Holy Knuth, Father of Design, pray for us hackers, now and at the hour of our death march. Amen.


I also found it lifted my spirits to say this when faced with a horrible list of bugs in really bad code:

Yea, thou I walk through the endless call stack of death, I will fear no bugs; for I understand system design and I know that this is not my fault and I already have my resume online.
Amen


I have several of these passages that I wrote from taking bible versus and switching the the subject matter to programming. I have hesitated to post them from fear of it being construed as some type of disrespect towards Christianity. Nothing could be farther from the truth as I am a practicing Christian myself.

I also thought it might not be a good thing to mix religion and computer science together. Not that I am ashamed of my faith at all but because its so nice to have an outlet where religion is not a topic. I think its funny how much ideology is involved in software development. We hold what some people say as almost biblical. Arguing with Knuth is probably as close to blasphemy as you can get in the programming world.


Saturday, April 6, 2013

Why Estimates are Worthless

Software estimates are most often completely worthless and a waste of time for everyone involved. Its a waste of time for the manager because the estimates that they get are usually shallow and only reflect what the manager wants to happen. Its a waste of time for the developer because of countless hours pondering what something will cost and why it would cost that, only to find out after completing the task how many things he/she missed.

 

The Ego

Estimation is in the realm of the what ifs and and maybe ifs and is usually grounded more in guesswork than in science. Egos often get in the way of good estimates when the programmers are involved. As for managers the pressure to deliver features in a certain amount of time instead of getting an accurate view of how much time a task will take.

The Unknowns

One of the big differences between Software Construction and physical construction is the amount of unknown involved. Out of all the different software projects I have been involved in, not one of them was exactly the same or even close to being the same. In fact most all of them involved a drastic change in technologies and in business domain. This sort of shift makes it difficult to predict what is going to happen in the project. Inventory applications have different kinds of problems than shrink wrap CAD programs for instance.
However, when I had my house built I asked how long it would take. I was given a reply that it always takes between 2 and 4 months and they are pretty sure it was going to take 3 months. It took exactly 3 months to complete. The reason they could be so accurate and so fast at putting my house up was not that it was easy to build a house but because there were really very few variables and unknowns in building a house. They had built several of these houses and they were the same house with minor changes that made my house look a little different from another house down the road that they had built. Experience building a house almost identical to mine is what made them so accurate at predicting how long it would take to complete mine.

Experience

I would submit to you that this type of experience for building software is almost never going to happen. However, professionals who have been working in the industry find it difficult to admit to upper managers that they do not have enough experience in the areas that they are estimating to give an accurate estimate. Often times developers understand the problem is lack of experience but are too afraid or think it would be foolish to inform their managers.
One of the biggest reasons for lack of experience is the size of the knowledge base needed to develop software. The size of the tools we use is enormous and they are adding to them every day. What you may have picked up last week can be eliminated by new features and fixes to the tools. Good developers learn how to be good at figuring out 3rd party and built in tools rather than memorizing them and mastering them.

The Dynamic Nature of Programming Software

I have never been a plumber but I imagine that installing plumbing in a new house remains the same for some time maybe even years before advances in technology makes them learn new things. I doubt that in the middle of fixing a sink they realize the pipes that were top of the line 6 months ago are obsolete now and need to be completely removed and replaced.
The dynamic nature of the business makes mastering programming virtually impossible for us mere mortals and therefore also impossible to predict.Estimates without padding to account for unknown api and technology shifts are naive to say the least and foolish and stupid to say the most. For this reason I have seen frustration on the side of both project managers and programmers alike. The programmers know why its a waste of time but the reasoning makes them sound like they don't know the profession.

Managerial Tactics

For a-lot of managers estimates are just a way of cracking a whip and motivating team members with a deadline. It is said that "If you give someone a week to complete a task it will take a week if you give them a day it will take a day." Unfortunately this is a traditional management technique that fails to realize one thing. We are not building cars or cookie cutter houses. No amount of motivation is going to get a developer to write a program in 2 days that takes a week. One of the biggest problems is no one actually knows a realistic time for the task to be completed. So in an attempt to motivate employees an laughable estimate is put into law. Because there is no possibility to hit the deadline the developers get demotivated and start ignoring all deadlines.

Psychics and Crystal Balls

Think twice before pushing for estimates on all of your projects. There are alternatives to controlling budget other than trying to predict the future like you are a psychic with a crystal ball. Instead try to reduce the scope of your project and reduce the risk. In other words do less and deliver on time. This has been a corner stone of the Agile process and I would say its one of the main reasons that Agile has been successful. Stop wasting your time going to software fortune tellers and just manage the project right. Don't get out out of control with features and make sure you are releasing features on a regular short cycle.

Good Reason for Estimates

I understand that some projects are different. Some projects involve a lot of upfront analysis and careful planning. Sometimes we are trying to determine if a project is worth it or if we should try something else. Fixed bid projects for contractors/consultants cause a hurdle for the project and the powers at be and large corporate policies can keep projects from working on an incremental approach. Just remember that most developers and managers just can't estimate. Most of the time it is just a waste of time even if you think there is a good reasons to estimate. It just gives you a false sense of security. And the way software projects work, you probably wont realize the project was never going to be done anywhere close to the estimate until the deadline is almost done and everyone looks up and says "How the hell are we going to be done next week?". In the end even if you need it to work it just doesn't.





Tuesday, April 2, 2013

How to Estimate Software the WRONG Way

Negotiate with the Software Developers

One of the best ways you can screw up when making an estimate is to try to negotiate the time frame with the developers. Programmers generally don't realize they are being negotiated with so this is easy pickings. They actually have no leeway in their estimates and end up telling the manager what she wants to hear.This makes matters worse because now instead of having an idea of when something is going to be done you have a make believe world based on what you want to happen instead of what will really happen. Trust me if a developer says something is going to take a week it is more likely to take longer time than it is to take less time.

Don't Cut any Features to Hit a Deadline

If you really want to muck things up stand fast on your features and put it on the shoulders of the developers to deliver what you want no matter how extravagant it is. If you don't cut features than you can safely say that your estimate is a fantasy. Features are the biggest variable in the estimation process so if you want your budget to go haywire refuse to cut anything. I would even suggest holding on to the useless features that nobody will ever use just because you want it.

Demand Results

The best thing to do is to walk in to the estimation meeting with the developers slam your fist on the table and demand results. For better effect you might consider acting like a two year old and roll on the ground kicking your legs and screaming "I want it! I want it!" Programmers with kids will get it and know you are screwing up the estimates on purpose. Maybe they will even help you with statements like "I have no clue how to do that but it sounds pretty easy. I think about an hour.".
Also consider telling the developers that "If they don't do it within your unreasonable time frame they can find a new job". That will ensure that the good developers go ahead and contact their buddies in other software firms and secure a better paying job with a better work environment. You will be left with the bad developers that the rest of the team was carrying. They are great pawns to point the blame when the project goes downhill.

Don't Prioritize

Whatever you do don't set priorities. Setting priorities may mean that the most important features are done first and the least important features will not be delivered. You probably want the opposite result so leave the developers in the dark about what takes priority. Have some fun with it and confuse them by telling them that having a window animate across the screen is more important than the database being created.

Make a Moving Target

As if software requirements don't move by themselves enough, you can help by changing things that don't need changing. Just walk in one day and tell your developer you don't like Silverlight and you want him to do it in ASP.NET instead. Here are some good ideas on what to change to muck things up good:
  • Constantly change your mind on what you think the UI should look like.  
  • Change terminology and add/remove form fields constantly. Your team will have to either update their code to change to your new lingo or they will have to live with you saying "Manager" and the code says "Team Leader". That will catch the OCD programmers and waste a-lot of their time.
  • Wait until a form is done and meets all of your requirements and then move arbitrary fields around. Decide at the last minute that you want a "search feature".
  • Large architectural changes with no added value are best. Just tell them I want to switch to MVC and  I want everything to be threaded no matter what it is. The later in the project you do this the better.


Just add More "Team Members" to Slow Down the Project

If you see more time estimated than you have in the budget just add more developers. This is a great way to screw up an estimate because naive IT managers think you are fixing a problem. In reality only so many developers can go into a project. More developers can take longer to do the same thing a smaller more cohesive team can. Also, if you have a long standing team lets say 6+ months together speeding up a new developer is going to cost you 2-6 months of turnover time that you can act like you didn't know about. 


Confuse Estimates with Goals

When a developer says he thinks something is going to take 2 weeks just act like he is not a team player. You can easily turn an estimate into a company wish list by intimidating the programmer into changing his estimate to your business goal. This should make your boss happy while you look for a new job. When the project gets canceled because you couldn't meet your budget then it's probably time to look for another project to screw up in a different company.
Combining your goals with your estimate is bound to really confuse everyone at the end of the project you can squarely point at the developers and say "They can't estimate software!" In reality you know that you made the estimate and manipulated them into agreeing. 


Do the Estimate Yourself

Programmers are just trying to confuse you with difficult to understand technical "facts". Act like you have a clue about what something will take to do based on how hard it looks to you. It takes discipline to ignore a developer when he tells you point blank that it just appears easy because you don't understand the technical difficulties. For Example:
If you want to change the background color of a button. Act like the developer doesn't know what he is talking about when he says "That will take re-creating the entire control from scratch and take at least 3 weeks." You can respond by saying something to the effect of "Don't try and confuse me with tech speak. Everyone knows you can change the background color of a button within a few minutes".
We all know that subtlety is every developers weakness so instead of just telling him you think it's easier give him blank stares and act pissed off that it will take that long. Eventually he will cave and agree to change the realistic estimate based on his prior experience and expertise into a summary of your business goals. Most of the time he is thinking of ways of getting his time back by adding more estimation time to other tasks. This works to your advantage because now it's impossible for anyone to know which tasks take longer.

Restructure the Team

Many times when a baseball team is getting smeared by another team with little chance of a comeback then both or just the loosing team will have the players switch out of the positions they are good at as a fun way of saying this game is lost but let's have some fun. The shortstop may play left field the catcher might be pitching and the pitcher could be in right field.
So because you know they will never actually hit any of the fantasy dates on paper why not shift team members into roles they are not good at. Shift the back-end developer to the front end and see if they can follow each other's work. Maybe the QA guy can start programming about boxes because it's a pretty routine task.
For an even more amusing effect forbid communication within the team and declare that they should be coding every hour that they are at work. If you see two team members "communicating" act like they are sitting in a break room wasting time like the other employees do.

Assume Programmers are Superhuman

After it has been discovered that your estimates are completely unrealistic than declare that your development team has superhuman strengths. They can:
  • Work through Holidays
  • Work weekends
  • Have no need for social interaction or Entertainment
  • Work an extra 24-72 hours in a month because you calculated every month as 31 days to make the schedule work.
  • Using only will power and a-lot of soda write 10000 lines of code in two hours to "Save the Company". Because obviously the company will go bankrupt without that window animation.
One of the positives that comes from this is that developers that were actually good will either quit or go insane either way they lose all credibility when it comes to finger pointing. You can say "It's too bad Joe went crazy. That's probably why he couldn't do something simple like change the background color of a button".
Married developers will quit because their wives won't put up with your crap anymore. Single developers will quit because they live with their Mom anyways and can just play video games until they can find a better gig.
This will leave you with the rare exception of programmers that either are loyal to you until the ship sinks or have a good sense of humor and think it's funny to watch managers walk around screaming quotes from Mythical Man month and not know it. Try shouting ".NET 4.5 is a silver bullet  or "If it takes 1 programmer a month it should take 5 programmers 1/5 of a month".


Don't Read about Estimation and Project Management

The worst thing you can do is learn how to estimate from people who have been in the industry for 20+ years and have written a book on their experiences. Act like you know what you are doing even though you have never hit a deadline. If you know who Knuth and Fredrick Brooks are then you will have a harder time screwing up estimates.
Also, please repeat the most common mistakes that programmers are taught in Software Engineering 101 and act like it's a brilliant plan. Run in the room say "We are way behind we need to hire 10 new developers right now." If you can get the exact quote out of Mythical Man month on what a bad project manager would say it would be best. Again seasoned developers will get the joke and know to move on to a real software company.

Related


Recommended Reading

The Mythical Man-Month: Essays on Software Engineering, Anniversary Edition (2nd Edition)
Software Estimation: Demystifying the Black Art (Best Practices (Microsoft))

Wednesday, March 27, 2013

5 Tips for Landing a Programming Job

1 Get a Recruiter

Technology recruiters are everywhere and they do not cost you a dime. Its a free service to you. Recruiters charge the employer for the service of finding the right talent to fit their organization. Many employers do not desire or do not have the time and energy it takes to find a candidate for the hiring process.  In fact many companies do not consider candidates outside of a recruiter. If a recruiter wants to charge you money do find you a job then it is a scam, run away.
Recruiters are also great information sources for the market place. They can tell you if your asking price is too high or why you were turned down for a job. They can also tell you what technologies are hot and are more likely to hire.

2 Participate in a User Group

Look for a user group in your area and join. You should find user groups that meet about the technologies you want to get hired for. User Groups are a great place to network with other developers and project managers. Its a good way to get your foot in the door and actually find employers that are looking. You can also put it on your resume that you regularly attend a user group for say Visual Studio or MS SharePoint.

3 Throw a Large Net

Throw a large net means you need to get your resume out as many places as you can. Give it to your friends that are already hired. Look for job postings on company websites. Post your resume on Monster.com etc. I once landed a job that was only listed on Craigslist. The more companies that get your resume the more likely you are to get an interview. But do not apply for jobs that you clearly do not qualify for or that do not make a good fit for you.

4 Research the Employer

Research and be able to discuss the company that your are interviewing for.  When you get the interview spend a good amount of time researching the company that you want to work for. Learning the technology they use is important but make sure that you know something about what they are doing. Do some reading on Wiki and pick up some books about the industry. Study the company website and know what its business goals are.
Are they making an inventory system? Find some literature about inventory management. Employers are guaranteed to ask you non-programming industry specific questions and how well you answer these questions is guaranteed to set you apart from the other candidates.
 

5 Tell them You Want the Job

If you can communicate to the employer that you want the job then it will no doubt increase your chances of getting hired. You may be putting non-verbal signals that you are not interested in the position or you may not seem to be excited about the position. Often when you are nervous your body is sending signals that you do not intend to send. The best way to offset this is to be prepared to tell them how much you are excited about the job. "I am very excited about the position its exactly what I am looking for." or "I have really been wanting to get into custom web design." are good examples. This is especially important in small companies. Start-ups are more likely to seek out candidates based on their drive and interest over pure technical skills.

Tuesday, March 26, 2013

Dijit D3 Custom Dashboard Part 2

Adding Widgets

The technique for adding widget is straightforward enough. Simply add another div element with a drag and drop source as a widget gallery for adding widgets to your dashboard.

<div id="WidgetGallary">
    <div class="WidgetCaption">Widget Gallery</div>
    <div class="WidgetSource" data-dojo-type="dojo.dnd.Source" accept="Widget">
        <div id="Widget1" class="dojoDndItem Widget" dndtype="Widget">Widget 1</div>
        <div id="Widget2" class="dojoDndItem Widget" dndtype="Widget">Widget 2</div>
        <div id="Widget3" class="dojoDndItem Widget" dndtype="Widget">Widget 3</div>
        <div id="Widget4" class="dojoDndItem Widget" dndtype="Widget">Widget 4</div>
    </div>
</div>

syntax highlighted by Code2HTML, v. 0.9.1

 Adding Widgets (JS Fiddle)

The assumption is that the widgets will be added to the widget gallery using server side code. However, client side code and AJAX is also a possibility. You will need to keep track of what widgets are in the gallery and what widgets have been added to a region in the dashboard.
For each widget you want to store RegionName, WidgetName, and WidgetId. The RegionName would be Gallery if it has not been moved to a region yet.

Resizing Regions

Adding regions is even easier than adding a widget gallery. By adding the dojo property splitter=true as shown below you can allow regions to be re-sized with splitters.

 <div dojoType="dijit.layout.ContentPane" data-dojo-props="splitter:true" id="DashboardTop" region="top">
      <div class="WidgetSource" data-dojo-type="dojo.dnd.Source" accept="Widget">
      </div>
 </div>

syntax highlighted by Code2HTML, v. 0.9.1

Resize Widgets (JS Fiddle)

Dashboard using dijit
Dashboard with Widget Gallery
The above screenshot shows the dashboard app with the widget gallery and splitters to re-size the regions. Next time I will show how to switch between dashboard layouts.

Friday, March 22, 2013

Dijit D3 Custom Dashboard Part 1

In this series I am going to show you how to build a custom dashboard applications using dijit for the ui controls, ajax calls for data acquisition and d3 for charting and graphs.
For the layout I am going to use a BorderContainer control in the dijit library. The BorderContainer is very good at layouts that would be difficult to pull of with just html and client side code. It has a splitter control that I will go over in another post.


Dashboard layout using dijit Border Container Widget (Js Fiddle)

Basic Layout
After you have the border container in place you can add your widgets and make them drag-able from region to region. In order to add drag and drop functionality to the dashboard each region must contain a dojo.dnd.Source widget. The Source widget acts as both the source of a drag-able widget and as a destination. The Source widget has to have an accept attribute with the name of the class of widgets it will accept as a drag item.

Dashboard with added drag and drop widgets (Js Fiddle)

Dashboard
Dashboard with drag-able widgets

Right out of the box dojo contains very rich support for drag and drop. When you drag an item it will automatically show you an avatar of the item you are dragging. You can drag items with in the same container with out any additional code.

Next time I will talk about adding and removing widgets from the dashboard and how to resize regions.

Continue to part 2




Friday, March 15, 2013

hello world in C#

Most everyone starts with hello world in programmig. Even seasoned developers write hello world apps in order to test if the simplist solution will run.
in c# we would write:
public static class MyClass
{
         public static void main()
         {
                  System.IO.Console.WriteLine("Hello World");
         }
}