Management


I read a lot of blogs (or at least i used to). After neglecting my enthusiastic collection of blog links (157) of THE top most readable material on the web for over an year, i decided it was time to change.

I made 3 folders

  • Check daily – contains max 10 blogs i will check and read new articles from
  • Tech Stuff – Has blogs, tech news and lots of similar stuff
  • Photography stuff

The point is, the only way i could catch up on my reading was if i was not trying to catch up with a lot of things. In short, i was coping with information overload by just ignoring all that information.

So my solution was to arrange stuff so that i could catch up with the ones that mattered. The rest, well i might flip through them on evenings or weekends IF i get around doing that and i would still be better than before, and not ignore it totally.

Where else do we face overload and how do you cope ?

  • email accounts
  • Electronic stuff that you work with/want to buy
  • Health notes from forwards and emails
  • List of things to do / read etc
  • Things to keep track off, and manage at work
  • Education (exams skipped during school coz you would not score anyway?)
  • Weight loss – (So much to do, might as well not try)
  • Social Networking updates ?
  • Cooking ?
  • Stocks and Financial info ?

I wonder if there is any other way to cope with overload, other than just filtering  … outsourcing  ??

Spot the bug

Code A

STDMETHODIMP CMIB2Iface::CollectData(LONG DeviceId, BSTR IpAddress) {
	list<CString>::iterator listIter;
	for(listIter = ccmList.begin(); listIter != ccmList.end(); listIter++) {
		CString ccmIP = *listIter;
		long tempCCMID = getDeviceID(ccmIP);

		// Handle it only if device ID is valid
		if (tempCCMID != -1) {
				CString component;
				long eventType = 0;
				if (endPointType == 0) {
					eventType = 47;
					component = "Gateway Link - ";
				} else if (endPointType == 1) {
					eventType = 48;
					component = "Unity Link - ";
				}

				component += endPointName;
				// Construct an event.
				LunaEvent ev;
				CString attributes = "linkDestination = " + endPointIP;
				ev.attributes = attributes.AllocSysString();
				ev.eventTypeId = eventType;
				ev.deviceId = theCCMID;
				ev.component = component.AllocSysString();
				ev.timestamp = (COleDateTime::GetCurrentTime()).operator DATE();

				try {
					if (endPointStatus == 0) {
						if (tempCCMID == theCCMID) {
							// Raise/Update an event whenever status is 0
							if (prevEndPointStatus == 0) {
								// Case 00
								unsigned long result;
								MY_LOG_DBG(functionName << ": Updating Event on Component : " << component);
								if (faultManager->updateEvent(ev, &result) == S_OK) {
									MY_LOG_DBG(functionName << ": Updating Event Secceeded");
								}
							} else {
								// Case 10
								unsigned long result;
								MY_LOG_DBG(functionName << ": Raising Event on Component : " << component);
								if (faultManager->raiseEvent(ev, &result) == S_OK) {
									MY_LOG_DBG(functionName << ": Raising Event Secceeded");
								}
							}
						}
					} else {
						// Case 11 and 01
						// Always clear the event, and for all CCMs in the cluster.
						unsigned long result;
						MY_LOG_DBG(functionName << ": Clearing Event on Component : " << component);
						if (faultManager->clearEvent(ev, &result) == S_OK) {
							MY_LOG_DBG(functionName << ": Clearing Event Succeeded");
						}
					}
				} catch(...) {

				}

				SysFreeString(ev.component);
				SysFreeString(ev.attributes);
		} // End of if (deviceID != 0)
	} // End of for loop
	return 0;
}

Code B


STDMETHODIMP CMIB2Iface::CollectData(LONG DeviceId, BSTR IpAddress)
	{
	this -> m_sLog.SetIpAddress(IpAddress);

	/*   ---------------------------------------------------------------------   */

	m_oInspector.AddCollatedRowInspectorFn_Post(FilterIfTypeInfoCollect,
						(void *) this);

	/*   ---------------------------------------------------------------------   */

	m_oInventory.ClearAllCollectors();

	if (BOMBED(DoTableGenericInit(m_oInventory, sIfaceTblColln, m_sLog)))
		{
		_log(L_ERROR, "Mib2 collect table init failed \n");
		return S_OK;
		}

	/*   ---------------------------------------------------------------------   */

	if (PASSED(m_oInventory.CollectInventory (DeviceId, IpAddress)))
		{
		GetIfFaultsExistForDevice(DeviceId, LINK_DOWN_NUM , m_iFaultExist, m_sLog);
		m_oInventory. InspectData(DeviceId, eForInventory);
		m_oInventory. SaveData   (DeviceId, eForInventory);
		}

	return S_OK;
	}

Code Review Department

Code Review Department

If tasked at reviewing the 2 pieces of code listed above, chances are that, you might as a reviewer, want to get rid of the task of reviewing A, than spend any more time on an obviously bad effort at coding. Having badly styled code around, allows bugs to remain, and fixes to be nothing more than half hearted patches which neither the patcher nor the original coder can recognize after the act is done.

One bad turn soon begets another and the rate at which the bad code degenerates into sphagetti mess can only be matched by the speed at which engineers long for a total rewrite of this mess. (Failing which they secretly start yearning for a change of job or worse, stick to the same one in a lost/zombie sort of way or decide what they really want to be is a manager)

Humans are not compilers

Human Compiler

Human Compiler

Unlike compilers, humans being are quite easily put off by bad code and no act of redemption can save a bad piece of code from degenerating further and further until it can only be discarded. This is frequently the reason why engineers advocate re-architecture, which is hugely more expensive than adapting existing code. The lost business oppurtunity that this represents can be huge and the very effort of doing so could run into millions of dollars per year for a major software company like CISCO.

Any act of review on such a bad piece of code can only seen as a sham – who after all in their right mind would want to spend so much time reviewing someone else’s code when it would so obviously take such a long time to do it.

So the first step in getting working reveiws is to not let the process to be viewed as sham – and the only way that this can be achieved is by respecting the reviewer’s time and patience.

How do you respect a reviewers time ?

By giving readable code (see above)

How do you make code readable ?

  1. By avoiding coding smells
  2. bi folwing sm cdng convntns(by following the same coding conventions aka coding style)

Twenty different people and their cousins would have an equal number of vastly differing coding styles. If all of these are to be heaped on same page or on the same reviewer, again its equivalent to implicitly admitting that you have no control and that the whole process is a sham. Therefore getting the same style of code to be used EVERYWHERE is what has to be ENFORCED for successful code reviews to happen.

My experience

In the only place i have personally seen code reviews to actually work, a body of code could be rejected simply because a character exceeded the max allowed no of column width of 80 or because in a single location in code, variable was not aligned. The rationale behind this was the assumption that that the coder did not know about this rule and therefore there would be many other places where this mistake would be made.

The act of rejecting the whole body of code due to single misfitting character sends the right signals and soon it becomes a matter of pride to get code accepted without major comments.

The other advantages in having readable code is that

  1. Simple Bugs are easier to spot
  2. Design issues are easier to spot
  3. Review happens faster (that builds more support for review)
  4. Bug fixes are easier
  5. Module upgrades or re-architecture would be easier
  6. SPotting reuse chances are easier – and hence aids faster development
  7. tois which so often happens are much more easier

How can the organizations aid in creating readable code

  1. Use tools that can perform static analysis based on accepted coding styles and flags issues, before reviewer even reads one line of code
  2. Make code readability indexes, part of statistics of the project so that they can be easily tracked
  3. Use tools that can reformat existing code base to the accepted style, no matter what that is, so that its easy to get off the block when the process starts

1 out of 2 is still only 50%

Fixing the code review-ability is only half the fight. Where would a reviewer be, without a programmer who wants the code to be reviewed ? In a team of colleagues, its only more than easy for everyone to scratch everyone else’s back and implicitly give easy reviews. Its also natural for colleagues to contest one others reviews. Therefore, there has to be an external entity and stimulus to engage in code reviews.

Of-course enforcing the code standards using tools part of the build process and enforced through management numbers would be a good start, though that alone might not make it stick.

My experience is that usually stimulus takes the form of bragging factor or nerd pride amongst peers. When an obviously respected person  / geek is to review your code, you would want it to be more shiny and that extra perfect.

Companies like Cisco can easily make this happen by having more tech leads to review the code, and having a system of recommendations where recommended parts of code can even get promoted to technical evangelists like Stroustrup or Gosling once a year for review, which can be such an honor. Tracking  programmers, coding bullshit index would also be a good measure for wanting a review.

The human factor

Coding and reviewing code, is ultimately a very human activity and any mechanical solutions to the problems in this domain are bound to fail. Ultimately a more humane and social solution would be required to transform this bit of ‘work’ into something more than statistic, and something of an advantage.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

– Martin Fowler

If you ever needed a reason to enforce clean code – here it is, right out of MIT and researched to the hilt. The video is extremely interesting from a behavioral standpoint and extremely educative. As highly recommended as the famous Steve Jobs video.

I can vouch for what is being said because i have seen this happening many times in development. The implied up shoot  ?

Clean code bases beget new code which is cleaner or clean enough. Dirty code bases attract more code which is at least just as dirty or usually even more so.

If you have been following the sub-prime crisis and the following recession, you would have no doubt heard horror stories about how uncontrolled debt has managed to wipe out many an individual / corporate house.

Uncontrolled spending, reckless taking out of loans, made over a century has blown up. The key element however is not that debts where taken, but just how risky those debts where, and how CEOs and corporate boards never really discovered the reality of those debts until all that blew up from down under.

Good independent auditing and more controls on aggressive practices would have perhaps prevented this from happening or the very least reduced the impact by a huge factor. Last minute cleanup after the shit has hit the fan is never the time to do this, as it would hurt more to do it near the end than when there is time and expertise around to perform the required audit and cleanup.

Technical Debt (highly recommended that you read this)

I definitely KNOW that this is something IT projects can learn from. There are many projects, where the leadership and implementers never care to track or document the technical debts they have around. While it’s O.K to cut corners to come out with a feature in a short time, it’s imperative to know exactly what corners have been cut so that you can rebuild them or mend them before something else gets build on top of those shaky corners.

Risk Management + Audit +  Tracking = Good Management

And like in Finance a good amount of auditing and tests for worse case scenarios would bring home the point to everyone involved, as to how shaky everything really is. The risk factors once in the open and put on tracking would ensure that the technical debts do not get run over by callous implementations or over zealous marketing folks or program managers anxious to get the product out. This i believe should be the most important task for any IT manager, of tracking the technical debts and to exactly know which valves will burst when.

Happy Fixing !!

I recently came across a cool replacement for Acrobat Reader, Foxit. Why do i want to use Foxit?

  1. Less memory consumption
  2. Feels more responsive
  3. Tabbed reading

It goes to proves that building a better mouse trap still works, even against such a de-facto standard like using the Adobe reader for reading PDF files.

Collaboration might be a weasel word, but i suddenly found how powerful a tool it  can be, by using Google Docs.

Of course Google Docs has been around for some time, but i found out about them anew when i searched an alternative for the paid services of 37Signal‘s BaseCamp software. I was not looking for BaseCamp either, but i stumbled into them through the blog posts they had made about building software and they do have many good blog posts for sure.

The blog was good, which made me interested in checking out what they build, which taught me all about how there are mature solutions that allow multiple distributed people to work on the same thing. It kind of proves how blogs can get you new customers.

If you are into new products, concepts or even existing tools to do the same, it proves how essential blogs and podcasts can be in getting your name across to the early adaptors !!!

Happy Blogging !!

I ‘m the proud owner of a recently gifted iPod touch and i must say that the device has vastly changed the way i learn and get entertained.

I dont wait for TV – I simply download the videos and podcasts i want too see or upload them from the multitudes of recordings that friends pass along. I view them in my convenience, while i’m waiting for my wife to come home / wait for her to finish her chores or if i’m on a bus or waiting for something in general. BBC, National Geo and all tech videos, here i come.

I’m less lazy about education – Since all it now takes is to listen to a couple of podcasts on the way to the grocery store or having a walk in the afternoon, I ‘m now more receptive to the idea of being taught in that free time.  I can also imagine all those countless situations where I’m lazy enough to boot up the laptop or desktop but just receptive enough to switch to another channel if that’s all it takes. My iPod lets me do this as switching content is extremely easy.

All my content is in one place – I have my favorite songs, videos and sometimes pictures in one place. Finally i now have a way of working through all that i had procrastinated for so long and who knows someday it might really come handy having all that in one place.

Even my techno agnostic wife loves it – So what does that matter ? Well if you are married and you love your family and also love technology, it would be all the more enjoyable if your family loved technology too coz then you can have double the fun.

Technology is suddenly more usable – All those applications that can run on the touch interface has suddenly made technology infinitely more usable. The expense calculator that was always available on my computer never got touched coz it was so much of a chore to do so and i could never get my wife interested in learning it. But i suspect iPod might be so much more easier and fun at the same time.

Right now i’m working from home and need some food. I’m more willing to walk to nearest restaurant now thats its no longer boring and in fact is a chance to use my favourite gadget 🙂

Next Page »