Tuesday 19 November 2013

Bootstrap UI

As a developer, I can code for hours, it is my passion, my profession, what I enjoy doing, and what I do for living. But let's face it, when it comes to design, I have my own doubts. Every developer has his/her fears when it comes to design, you will hear almost the same response or excuse from almost any developer, "I'm not a designer !!". Well for me, I love looking at websites, I can provide some valuable insights, but I lack the ability to actually design and build websites. I don't have the "designer" eye :)

Well for the everyday developer, this is not an issue any more. Welcome to the world of bootstrap. You can start developing websites with really fabulous responsive designs, literally with minimal amount of effort. What can you ask for more?

Bootstrap is an open-source Javascript framework developed by the team at Twitter. It is a combination of HTML, CSS, and Javascript code designed to help build user interface components. Bootstrap was also programmed to support both HTML5 and CSS3. 

What is really nice about bootstrap is the fact that it is becoming a standard. A lot of websites are being built using it nowadays. And to make things even better, there are a bunch of theme generators now, exclusively for bootstrap. 

So to make a long story short, you can build a website and have one or more themes, with nearly zero CSS efforts. It is really amazing.

So, if you are still reading up to this point, and feeling excited, head to their website and start right away. Also, check these nice websites which offer great themes.




Happy coding + designing :)


Monday 18 November 2013

Visual Studio 2013

I cannot believe it has been nearly six months since my last post. Time flies really fast. For you out there, Visual Studio 2013 has been launched. It comes packed with so many interesting features. If you are interested and want to explore, book yourself a couple of hours and watch the following short movies that were published on channel 9 as part of the launching campaign.

What's New in Visual Studio 2013 Integrated Developer Environment (IDE)

Introducing Visual Studio 2013 for Windows Store Developers building HTML App

Creating Quality Applications Using Microsoft Application Lifecycle Tools

Introducing Visual Studio Online

What's New for Web Developers in Visual Studio 2013

Enjoy :)

Thursday 25 July 2013

Thank you can do you wonders

It has been a while since my last post, I've been busy so much to write. During my daily routine of reading, I came across this wonderful clip about how a young man with high expectations dealt with his frustration in a smart and polite way and how this moved him and changed the course of his life. Please watch it as it has a really important note at the end.

Enjoy :)

Wednesday 19 June 2013

How to Learn a New Technology?

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 :)].

Five Must Have Tools for MVC

During my daily reading routine, I came across a great blog post about the top five tools for modern MVC applications. Mainly the post discusses CSS and how the usage of several tools can bring you great results.

A must read in my humble opinion. Here is the link to it Five Essential Front-End Tools That Should be Used with Modern MVC Projects.

Enjoy.

Tuesday 18 June 2013

Syncfusion Free E-Books

As a developer, the reading process never ends. You have to read and read and read. I am not sure when we are going to stop reading. I guess, reading has become part of our daily routine to a certain extent. Something as important as eating food, or drinking water.

Well, sometimes you don't have the time to dig into some 500+ pages books to learn a new technology, or extend your knowledge in a topic you already knew about. If you are in this position nowadays, have a look at this website, it is called Syncfusion. It contains a number of free E-books covering several important topics in addition to several white papers.

I encourage you all out there to visit this site and have a look.

Happy Coding Everyone.

Monday 13 May 2013

Rules Engine

It has been a while since my last post. I was caught up with several things for the past three weeks or so, I couldn't add any new posts at all. Well, things are back to normal and hopefully it will stay this way. 

Enough talking about me and let's head straight to the money talk. Well, during the past three weeks I have been preparing myself for a new project, a financial application. I did some deep study on what to use and how, etc ... One of the major points was the validation of my business entities. I wanted to simplify this procedure and locate the validation rules in one layer. By the way, I am a big fan of code centralization, having one thing handling all the validation stuff. I wasn't convinced with having my validation block segregated into two layers, a javascript one for the UI and the other one in VB.NET for the server side.

I decided to go with one layer, and the UI will invoke this layer to validate the objects (JSON objects). For me, I can accept the cost of AJAX posts for the sake of having one solid layer.

I started by implementing something myself, but then I thought there must be something ready out there. Some sort of a ready made library that can be used to achieve my goal. I started looking for one and I came across this wonderful and magical library called "Rules Engine". It is an open-source library hosted on CodePlex. I played with it a bit to get myself familiar, and to be honest from the first line of code I fell in love with it. It is a really nice, simple, straight forward, and comprehensive engine. I deeply recommend this for anyone looking for a good validation engine.

Happy coding ...

Friday 19 April 2013

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

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 Indexa 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

Monday 8 April 2013

Store Data with sessionStorage

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.

Sunday 7 April 2013

Extension Methods in .NET


The extensions methods concept is a way to extend the functionality of any class or data type, by adding new methods to that class or data type and calling these methods directly through the instance of the class or the data type.

There are 2 important notes regarding to the extension methods:
  • You cannot define an extension property, field, or event.
  • Extension methods cannot be used to override existing methods.
Structure of Extension Methods in .NET :
  • An extension method must be marked with the extension attribute <Extension()> from the System.Runtime.CompilerServices namespace.
  • An extension method can be either a sub or a function.
  • An extension method must include at least one argument with which it must be identical to the type of the class that it will be extending. (I.e. if extending a String method, then the first parameter must be of type String).
  • An extension method must be declared within a Module. For ASP.NET , you can add a class and then change its definition to Public Module , instead of Public Class.
Open Source Libraries for .NET Extensions

There is a wide variety of hundredth of ready-made useful .net extensions provided by the community of .NET through CodePlex.
You can start using them today, just add a reference to the library from http://dnpextensions.codeplex.com/
Or even you can get this library from NuGet http://nuget.org/packages/PGK.Extensions/ and immediately start using it without any "import" statements.

Extension Method Sample

Below is a sample extension method that can be used to get the maximum length of a given EDMX EntityObject's field, as defined by the provider source ( i.e. SQL Server) , so if there is a field named 'FirstName' and defined in the database as Varchar(50) , then this extension method will return the number 50.

Imports System.Runtime.CompilerServices
Imports System.Data.Objects.DataClasses
Imports System.Data.Metadata.Edm
Module EntityFrameworkExtensionMethods
    <Extension()>
    Public Function GetMaxLength(EntityObject As EntityObject, PropertyName As String, DB As DB_DAOAs Integer
        Dim queryResult = From meta In DB.MetadataWorkspace.GetItems(DataSpace.CSpace).Where(Function(m) m.BuiltInTypeKind = BuiltInTypeKind.EntityType)
                          From p In TryCast(meta, EntityType).Properties.Where(Function(p) p.DeclaringType.Name = EntityObject.[GetType]().Name AndAlso p.Name = PropertyName AndAlsop.TypeUsage.EdmType.Name = "String")
                          Select p.TypeUsage.Facets("MaxLength").Value
        If queryResult.Count() > 0 Then
            Return Convert.ToInt32(queryResult.First())
        End If
        Return 0
    End Function
End Module
Then you can call this method normally , as it is a part of the instance EntityObject:
Dim _EmployeeRecord As New EmployeeRecord
Dim _FirstNameMaxLength As Integer = EmployeeRecord.GetMaxLength("FirstName", _DBContext)
Note that even though the Extension method has 3 parameters defined, we still call the method using 2 arguments. This is due the fact that, as mentioned above, the first parameter defined in the extension method is the type that has to be identical to the class or datatype, that is being extended.

Saturday 6 April 2013

Must-Have Tools for Developers

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!

Friday 5 April 2013

Dynamic PDF Generation using Scryber

Generating PDF files is not a feature any more, in my opinion, you need to have this capability implemented be default in any application you develop. There are a lot of PDF generators around, but this one is by far the best in my humble opinion. It is called Scryber and it is an open source library.

Please refer to this article published on CodeProject to read in-depth about this important topic.

Enjoy.

Visual Studio 2012 - Update

It has been a while since my last post. Today, during my daily reading routine I came across a post introducing the latest update for VS 2012.

For you out there, who are using VS 2012 and eager to get the latest update, please refer to this post.

Enjoy.

SOLID Design Principles

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!

Wednesday 27 March 2013

Two Roles Code

While performing my daily reading routine, I came across this interesting article which discusses a concept of having 2 roles for code. I read it all and found it really interesting. I am going to give it a shot and try to implement the points discussed.

If you are interested, please have a look here.

Enjoy.

Sunday 24 March 2013

Visual Studio 2012 Update Guide

Robert McLean has put together this awesome update guide for VS2012 and related tools/extension upgrade guide. If you're using VS2012, bookmark his page. I am sure you and your colleagues are going to need it one of these days.

Enjoy.

Wednesday 20 March 2013

Code Quality

A very nice article about Code Quality. It covers some basic aspects within our code which we tend to ignore. I urge everyone out there to have a look.

Enjoy.

Time Management For Developers

Good time management skills are considered to be a key factor in the equation of success. It is not easy to be organized and manage our time effectively and efficiently. I read this article and I found it useful.

Enjoy.

Image Tool Extension for Visual Studio

Greg Duncan highlights the Image Tools Extension for Visual Studio available from the Visual Studio Gallery which provides a number of simple actions for working with images within the IDE. Please refer to this article for more details.

Command Query Responsibility Segregation - CQRS

Kanasz Robert shares a nice introduction to the concepts behind Command Query Responsibility Segregation, illustrating with examples in this CodeProject Article.

Tuesday 19 March 2013

HTTP Codes

Ever wonder what the different HTTP status codes are? Well, please have a look at this site which serves as a really useful guide.

The Open Close Principle - OCP

It never hurts to get back to basics and refresh our knowledge about the basic fundamentals every developer should know. One of the basic principles in Object Oriented Programming is the Open Closed Principle

If you google it, you'll find a huge number of search results talking and discussing in deep details the definition of this principle. I came across this nice article I am sharing today.

Hope you'll find it useful.

Happy Reading.

Monday 18 March 2013

Visual Studio 2012 - What's New?

I am not sure whether you have started using Visual Studio 2012 or not. As a matter of fact, I have. It is quite awesome. Many features have been added to it to make it even better. Our friends at channel 9 have prepared this video and many others to introduce Visual Studio 2012 and its new features.

Enjoy.

Client Side Coding - Be Careful

This post is inspired by reading a really interesting article posted on Code Project. We (I mean developers) in general, get excited really quickly about any fresh new idea, I'll tell you why in a moment.

When I take a look at the web applications I built during the course of my career, I see myself building web applications that relied heavily on server trips (postbacks), as this is what the technology provided at that time. I don't recall writing any client side code to interact with the server. My client code was all about input validations. 

With the introduction of AJAX and ASP.NET 2.0, I was really impressed by the idea of partial postbacks, and started planting update panels all over applications. The idea of not having postbacks was really great, and being able to have no page flickering was huge. But I was hit by the performance of my applications. The viewstate of my web applications was so huge it affected the overall performance of the applications. My applications performed like turtles when it comes to speed.

I had to find a robust solution, that's when I was introduced to JQuery and started using JQuery posts. To be honest, JQuery posts are really great when it comes to performance, but they required the developer to have a good knowledge in JavaScript and JQuery, and of-course more code should be written. 

If you are a developer who used or currently using posts in building your web applications, or you are someone who are planning to, believe me, it won't hurt you if you stop for five minutes and read this great article.

Enjoy.

NoSql Databases

With the emerge of NoSql databases, I think it is time every developer gets a hands-on coding experience against one of these databases. There are a lot in the market right now. I am not sure if these databases are going to replace the well-known RDBMS. But there is a considerable number of well-known organizations implementing and deploying software applications which use these types of databases as their main data repositories.

In short words, a NoSQL database provides a simple, lightweight mechanism for storage and retrieval of data that provides higher availability than traditional relational databases.

As a start, you can check out the following youtube clip which provides an overview of NoSql database.

Enjoy.




Thursday 14 March 2013

A Beginner's Guide to HTML and CSS

As a developer I tend to love coding. I can go writing code for hours, but when it comes to design I have my own doubts. I know that I am not alone in this area and I bet that there are a lot of you out there who feel the same way.

Well, let's face it, every web developer should have solid skills when it comes to design (HTML + CSS). At the end of the day, you don't want to call the designer every now and then just for minor design changes such as font types, font colors, etc...

I came across this comprehensive guide. For you developers out there, please have a look and I am sure you'll be impressed.

Here is the link.

Wednesday 13 March 2013

.NET Framework Made Simple

Going back to basics is really good. Sometimes we tend to start our work taking things for granted and not digging into details. Time passes, knowledge starts to fade, and after a while we find ourselves lacking the concrete base, the solid ground that provides the real push.

No matter your experience level is, it is really good to get back to basics and read about the .NET Framework. During my daily reading routine I came across this really nice article posted on Code Project which gives really a straightforward and detailed description of the .NET Framework.

This is the link to the article .NET Framework Infrastructure.

Enjoy it. 

Visual Studio Keyboard Shortcuts

It is often more easier to use keyboard keys to perform a specific task rather than using the mouse and trying to locate the exact menu item or function. I am a big fan of shortcut keys and I rely on them a lot during my daily development work.

There are a number of sites with detailed lists of useful keyboard shortcuts. Well today I am giving you the lists I found really useful. 

Happy coding.

Visual Studio 2010 Shortcuts

Visual Studio 2012 Shortcuts


Large collection of Free Microsoft eBooks for you (+80 books)

As a developer, daily reading is a part of my daily routine. I check several development websites in addition to other blogs. Also reading books is one thing that I continuously do to keep my information and knowledge up to date.

So it seems that reading is an endless task for any developer. The other day while I was performing my daily routine I came across a blog post which lists 80+ free Microsoft E-books. It is really a very good list and you can find it at this location.


ASP.NET Performance

With the fast pace of our daily work as developers and to be in specific, as web developers, we often tend to neglect the performance of our ASP.NET applications.

In my opinion, the application's performance is not a feature. Every developer should take into consideration the performance of the page he/she is developing.

I came across this interesting free E-book by the great people at RedGate. I read it all, and to be honest I found it really useful. The great thing about this book is being straightforward. It is a summary about the most common fifty issues which may affect the performance of any ASP.NET application.

I encourage every ASP.NET developer no matter his/her level of experience is, to take a look at this book.

The book 50 Ways to Avoid, find and Fix ASP.NET Performance Issues can be downloaded from this location.