Thursday, 5 June 2014

How to Learn a New Technology?

[As seen here].

Quite often in our industry, we find ourselves in the need to learn a new technology. Sometimes we are “obliged” to learn it as we need to deploy it in a project. And sometimes we learn new technologies to enrich our knowledge, enhance our capabilities, and keep ourselves “up-to-date”.

Recently, I found myself in a similar situation. I was assigned a new project that is going to be implemented using some new technologies that I am not quite familiar with. This brought to my mind the question of “how do we learn a new technology?” So, I looked around, and went for a brief chit-chat with some of the far more experienced people in the house with one and only question: “how to learn a new technology”. Herein, I brief the answers I received.

Our Chief Technology Officer, Samer Awajan, suggests that there is a difference between “knowledge” and “gaining knowledge”. And that there is utterly some kind of “unity” between different technologies and programming languages. So if you stick to the concept and try to absorb the main idea behind the technology you are trying to learn; i.e. get to the essence that unites this technology with the ones you already know, you will find out that the process becomes, more or less, a matter of applying what you already know but using new techniques.

The chief also highlighted how the individual experience counts as well. Even when you are going through articles and books your way of reading is different. After some time and experience, you will find yourself skimming through the whole article to grasp the main idea, then going back and forth scanning for the exact piece of information you are looking for.

Our Software Development Director, Wesam Qaqish, states that each person has their own way of learning new stuff. Some people are bookworms; they prefer to read a whole book before even starting to implement anything. But to him, he prefers to read a bit about the topic to familiarize himself with the terminology and key concepts then starts implementing right away.

Wesam agrees that the background counts as well. It depends on “how new” this technology is to you. Learning .NET, for example, when you are a Classic ASP developer is easier than learning to develop with PHP when you are a .NET developer. Concluding with the fact that the more problems you face while trying to implement any technology, the more experienced you become and the easier it becomes for you to learn and master it.

Michael Ghantous, a senior tech lead in the company, stresses the idea of “sticking to the concept”. Take Database as an example; be it MongoDB, Hibernate, MySQL, … A Database is a Database: tables, views, stored procedures, .. The implementation doesn’t really matter as long as you stick to the main concept behind the technology and try to absorb it and again, link it to what you already know.

Whether to watch a tutorial or read an article depends on each individual he says. Some prefer watching, others prefer reading. Though to him, when he wants to learn a new technology, he starts with a video that illustrates the technology and introduces what it has to offer. He starts by taking the flavor to decide if he will go on with it or not and if so, he goes on reading more about it. Learning the breadth of the technology then delving into the depth. It is very important to start gaining hands-on experience along the way, and start playing with it to become more comfortable and accustomed to it.

When exploring, he highlighted a crucial point; that he prepares a list of what he is trying to achieve using this technology. A list of the cases he will encounter and try to solve. This helps him be more focused and straight to the point. He says "at first it doesn’t matter how to implement a specific task using this technology, what matters to me is if it is already there and can be implemented using it or not".

Michael concluded with an intriguing concept and that is not everyone knows how to search and find what they are looking for. Memorizing syntax and implementation details or some specific piece of information is not what sets you apart. It is rather your ability to find the right piece of information from the right source when you need it.

Taiseer Joudeh, a tech lead in the company, agrees that the way of learning new technologies differs from one individual to another. To him, he starts by watching the “Hello World” tutorial, a very basic one, then starts applying as he is watching. He says “I have to take the hands-on experience and apply what I am watching the soonest. I play a bit more with the example and explore more options as I am going. I try to connect it to a real-life example to help me stay more focused and able to connect things more easily”.

Taiseer then moves straight to the official website. He checks the demos, support section, and documentation to see if it is well-written and covers a good aspect of what he needs.

He also raised a very important point; that he looks around to see if this technology is popular and well-acclaimed; if it has good community and forums. These are all signs that indicate whether this new technology is going to live thus worth investing time learning or not.

Those were some of the ideas that the experienced IT professionals had to offer. I would like to conclude with one simple idea; and that is the importance of overcoming inertia. When you discover and try to learn a new technology it is very important that you overcome inertia - or the fear to discover a new thing, if I may call it, and start taking action, whatever that is, right away.

[A big Thank You goes out to Samer Awajan, Wesam Qaqish, Michael Ghantous, and Taiseer Joudeh for their precious time and ideas that inspired the writing of this post :)].

Read more…

Visual Studio Features: Code Analysis, Code Metrics, and Code Clones

[As seen here].

In this post I am going to introduce 3 Visual Studio features that are very interesting and helpful; but, alas, may not be that popular. I came to discover them recently and I instantly fell in love with them! I am sure you will love them too after you get to know and try them out. 

They are, namely: Code Analysis, Code Metrics, and Code Clones.

Code Analysis
The Code Analysis feature of Visual Studio examines the code by performing static code analysis to detect common pitfalls, defects, and violations of good programming practices. Thus helping developers identify potential design, globalization, performance, interoperability, and other issues in their code.   

The tool works to raise warnings that differ from compile errors and warnings; because the tool mainly searches for code patterns that are “logically” valid, though may still cause problems on the long run for you or for people who may check/use your code later.

Code Analysis can be run manually on a snippet of code, or even setup to automatically run as part of a Team Build or check-in policy for TFS [Team Foundation Server].  

Learn more about Code Analysis, What's New in Visual Studio 2012, and how to run Code Analysis on your system here.    

Code Metrics
Another feature that I truly like in Visual Studio 2012 is Code Metrics. Code Metrics is a tool introduced within Visual Studio that measures the evolvability and maintainability of a software system by calculating five important metrics. This helps the development team identify potential risks, understand the current state of their project, and track progress during software development.

The five metrics are:

- Maintainability Index: a value between 0 and 100 that represents the relative ease of maintaining the code. Higher values indicate better maintainability.
- Cyclomatic Complexity: this metric is a measure of the structural complexity of the code; it calculates the number of different code paths in the flow of the program. The actual value of this metric differs from one Visual Studio version to another. But a rule of thumb is that no individual method or property should have a Cyclomatic Complexity that is greater than ten.
- Depth of Inheritance: it indicates the number of class definitions that extend to the root of the class hierarchy. The deeper the hierarchy the more difficult it might be to maintain and understand the code. However, a high depth of inheritance can also indicate a greater level of code reuse. So it is difficult to judge what a good depth is.
- Class Coupling: this one measures the coupling to unique classes through parameters, local variables, return types, method calls, and other types in the source code. High values of coupling limit the value of a type to be reused; so a lower value [lower than ten] is what you should aim for.
- Lines of Code: a value indicating the approximate number of lines in the code. A very high number indicates that the method/type is trying to do too much and should be split up. It may also indicate that the type/method is hard to maintain. 

More about this important topic and how to generate Code Metrics in Visual Studio 2012 can be found here and here

Code Clones
A personal favorite! It is a new feature introduced in Visual Studio 2012 that detects ALL code fragments that are copied throughout the solution. The tool detects the separate fragments of code that are very similar. Usually, code clones make it hard to change your application because you have to look for each fragment to update. Now it is easier as Visual Studio helps you find these clones so that you can refactor or modify them. Or just get to know the amount of “potential” copy/paste used in the system you are working on! :)

More about this, here

Read more…

Store Data with sessionStorage

[As seen here].

Recently, I began working on a web application that relies heavily on client-side scripting. At some point, I needed to store some key value and use it again within the same context. Sounds easy, no? But hey, I need a client-side solution; so no sessions. And cookies won’t do since they can be disabled by the user; and they get sent to the server on every HTTP request, among other downsides.

After researching our options, we found about a neat solution that does fit the situation: sessionStorage.

What is sessionStorage?
sessionStorage is one of 3 client-side data storage options introduced with HTML5. The 3 main options are sessionStorage, localStorage, and client-side databases.

It is basically an object that exists as a property of the “windows” object. You can use it to store up to 5M [most browsers] or 10M [IE] of key-value pairs to be used locally.

The sessionStorage object persists in the window [tab] in which it is being used. If you close the tab [the top-level browsing context] it will not persist. Though, it will still persist if you refresh the browser tab, or navigate to another site then use “Back” to return to the same window it is defined within.

In short, the data in the sessionStorage object is deleted when the tab [window] is closed, or upon deleting it explicitly. This makes sure the data is not stored indefinitely.

API Methods and Example Usage
The sessionStorage object ships with the following five methods:

- getItem(key): retrieves the value for the given key or null if the key doesn’t exist.
- setItem(key, value): sets the value for the given key.
- removeItem(key): removes the key completely.
- key(position): returns the key for the value in the given numeric position.
- clear(): removes all key-value pairs.

And one property, length, used to indicate how many key-value pairs are currently stored in the sessionStorage object.

The most straightforward example to showcase sessionStorage usage would be:

//Setting a key “Name” to the value “Alice” and saving it in the sessionStorage object.
sessionStorage.setItem("Name", "Alice"); 
//Retrieving the value of “Name”.
alert(sessionStorage.getItem("Name")); 

sessionStorage vs. Cookies
The main advantages of sessionStorage over Cookies are:
Cookies don’t allow big objects. sessionStorage on the other hand allows for 5M [most browsers] or 10M [IE] of data.
Cookies get sent to the server with each HTTP request which increases the traffic; not the case with sessionStorage.

Browser Support
According to Wikipedia, sessionStorage is supported in IE8+, Firefox 3.5+, Safari 4.0+, and Chrome 4.0+

Further Reading
You can refer to this very good article on NCZOnline for more information about this important and interesting topic.

Read more…

Must-Have Tools for Developers

[As seen here].

As developers, our laptops and PC’s tend to be somehow “different”. We love to load them with tools and apps that we use to make our job easier. One for writing and editing code, another for analyzing performance, some personal apps, and the list goes on..

Of course, those tools differ from one developer to the other. But for a start, here’s an intriguing collection of tools and apps that every developer should have a look at: Part I | Part II.

There are tools for Windows, Online Meetings, Development, Source Control, Database, Time Management, and some more.

Most of the tools here are open-source; which means that you can download and start using them for free. So go surf through the list, give your machine that nerdy look, and post your own additions and favorites in here!

Read more…

SOLID Design Principles

[As seen here].

SOLID is an “acronym of acronyms”. It is a set of five Object-Oriented Design principles identified and introduced by the famous Uncle Bob in the early 2000s.

Applying these principles together when creating a software system will make it easier to maintain and extend over time [well, they say!].

The five principles are: Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion.

I found this very good article on Code Project that summarizes each principle and clarifies its concept with a simple real-world comparison.

And lately, I came across a mini-series entitled “My Relationship with SOLID” on CodeofRob.

Each entry in the series elaborates on one of the five SOLID principles; and how we, developers, may or may not agree, use, and adhere to each and every one of them in our daily work.

I find this topic pretty interesting and useful. I urge you to check out the CodeProject article first to refresh your knowledge and get the sense of SOLID, then go through the series below to check the other side of it, just like I did!

My relationship with SOLID - Starting with S
My relationship with SOLID - The big O 
My relationship with SOLID - The misunderstood L
My relationship with SOLID - Seeing I to I
My relationship with SOLID - The overloaded D

Read more…