Home avatar

Thoughts and code

Have Honest Opinion

It is very hard to provide an honest opinion when you are involved in a situation. I found it always difficult for myself and admired people of being able to do it, lifting themselves from emotional attachments to the matter.

I am a big fan (if not huge) of the whole Google Apps platform. I use heavily Gmail, rely a lot on Google Calendar, abandoned Excel for simple-to-average stuff and went with Google spreadsheets. I used Google Maps, because it was better than Microsoft’s competitive version of the product. Till I had a chance to re-evaluate it again. This time around Microsoft has produces a better result. Microsoft Live Maps gives me more than Google Maps does (weird even to think it, not mentioning writing it :).

Command-Query Separation Principle

A few days ago read in Larman’s book about Command-Query Separation Principle. Funny to mentionĀ  that I heard about the concept many times ago, but this is the only source that stated it as a principle. And it makes total sense once you evaluate all the pros and cons of the idea.

What’s the principle? Simple. There are two kinds of messages to objects:

  • Commands - ones that are affecting the state of the object
  • Queries - ones that are querying an object for its’ state without affecting its’ state at all

A Command message would be “void Calculate()” or “void Add(double value)”. Command message never returns a value, and that’s for clear separation of the messages and easier maintenance of the object state (i.e. no surprises). A Query message would be what Command isn’t “int GetValue()” or “IsVisible()”.

3 Years

Today is 3 years since I started working with the company I work today. It’s being a long journey from figuring out what I want, till realizing what I am and need to be. The team has accepted all of my wildest ideas about the code and was very tolerant to the fact that I cannot wait to get something done. We’ve made a long way.

Besides improving as a software developer, I also realized a few bitter realities - it doesn’t matter how good I am, still need to strive to be better. Besides the excellence in code, there must be a proficiency in human relationships. The code is not only about a single developer level, but about team level, because if you are the only one who can have fun with it, it is no longer fun.

Code Smell vs. Code Stench

Interesting difference I picked up from a book this morning - code smell vs. code stench.

Code smell might indicate there’s a problem in code that requires refactoring, but a closer evaluation might prove the smell is false alarm.

Code stench is an obviously bad/poor code that has to be refactored.

From now on I will be more accurate on describing the code issues :)

Google Shortcut Keys - Awesome

For all keyboard junkies out there - if you are also hooked on Google products (GMail, Reader, Calendar, etc), don’t miss the option of using GMail with keyboard shortcuts. The are awesome. I loved the navigation shortcut (combination of pressing first G and then another key, neat).

To enable keyboard shortcuts, you will have to go to the settings under you GMail account and check off the option to enable it.

Two Loosely Coupled Code - Part 2

In the I raised the question of “Too loosely coupled design”. There’s a lot to discuss about it, and I am not going more time on it, except showing one more sample that IMHO shows the benefits and outcomes of the principle being applies, or consequences of not doing so.

Table 1

Too Loosely Coupled Code

Strive for loosely coupled designs between objects that interact.

By minimizing the knowledge one class has of another, you decrease dependency between those classes. Independent classes provide more flexibility in design.

Does this mean your application becomes more difficult to understand? Yes to a certain degree. You have to understand a few things before trying to work with loosely coupled code, things like the idea behind this principle. Why coupling is bad in first place. Determine how coupled your code that you normally created. Why you need loosely coupled code (or “what’s in it for me”).

A Month of Silence

[Pure personal content]

My vacation with family in Israel almost over - packing luggage, sitting for the last time at cafes with people I will miss, enjoying the extra hot weather while it’s more fun than burden. This vacation was a great refresh for the entire family: kids, wife, myself. Having a break from daily thoughts, code, work - feels that it has gave me more will to kick in and go forward that it felt a month ago. Speaking about going forward…

OCP Principle

Jeremy Miller (aka The Shade Tree Developer) has a very good article about OCP principle printed by MSDN magazine. This is a valuable article for any developer that strives to work according to law of “measure twice, cut once”, and not just cook spaghetti. http://msdn.microsoft.com/en-us/magazine/cc546578.aspx

This is not the only principle to consider, but one of many that are not widely explained in textbooks during your school years. OCP, LSP, DIP, ISP, and much more. I am more than happy ALT.NET folks are bringing these subjects over the new brand shiny new technologies under the hood of .NET

Going To See My Family

This is not a technical post. Nor it’s related to software development or the theory behind it. It is a pure human post about principles that are much more basic and important in life then anything else - family.

My wife and kids have left for their spring-summer vacation about two months leaving me behind to catch up later. Two days and I am on my way to see them, reunite and spend a one hell of the month in the place I love - Israel.