If Crashing Gracefully Is Nice, Recovering From It Is Awesome

Filed Under (Development, DotNetArabi, Misc, software management) by Emad Alashi on 02-03-2010

Tagged Under : , ,

Last Saturday we had a SharePointSaturday event here in Jordan, in which I had the pleasure of interviewing Joel Oleson and Michael Noel for DotNetArabi.

At the end of Joel’s valuable interview, which can happen only in a life time, I stopped the recording by hitting the “Stop” button, simple. Surprisingly, instead of stopping the recording, Audacity just froze! I could hear myself screaming inside “NOOO!!!”, I guess even Joel heard that! the whole machine stuck that I had to force it to a Hard Shut down.

But knowing Audacity as a great piece of software, which really is, I hoped that I could still retrieve the recording. I rebooted and started Audacity again, and here comes the so refreshing alert at the start:

CrashRecovery

Some projects were not saved properly the last time Audacity was run. Fortunately, the following projects can automatically be recovered

THAT is a successful software! of course I lost portions of the recording still, but I can’t complain; I have most of the interview. So, When you design your software, DO make sure you don’t crash gracefully only, but yet to recover correctly from the crash.

Communication Skills Session at MSP – Jordev

Filed Under (Development, Misc, software management) by Emad Alashi on 21-11-2009

Tagged Under : , ,

I just finished a session about Communication Skills one-to-one for the MSP program with Microsoft and Jordev. As I promised the audience, here are the slides shared on the very good site SlideShare:

“Growing Software” book review

Filed Under (Development, software management) by Emad Alashi on 05-10-2009

Tagged Under :

growingsoftware

I have been reading this book Growing Software by Louis Testa, and I consider it the book of the year for me.

The book is a about how to create a robust successful software; starting from assembling your engineering team, to having a flourishing company with successful software product/services and happy customers.
If you are a new Development Manager, or already a Dev. manager who is in a small company growing fast, this book is for you.

There are many reasons why I find this book so valuable, here is a list of them:

  1. Scope: I haven’t come across any book that covers this scope of what should be done to create successful software; usually books would talk about the SDLC, Development Methodology and Process, engineering techniques…etc, and if you are lucky maybe about some of the best practices around that.
    This book, on the other hand, covers a lot more; it starts from the real beginning of understanding the environment around you, creating an effective engineering team and growing it, defining your product, defining releases, project estimation, project execution, choosing a process, enhancing the process, communicating with other departments, handling customers… and it even covers the future by setting directions, product roadmap and strategy. You can check the main table of contents here
  2. Practical: the book is obviously coming from a practical background, it tackles details that won’t be found unless the author really KNOWS what he is talking about, and that he actually lived that experience.
    This is especially obvious when the author talks about the wrong way of doing things. for example, I have always thought adding an unplanned extra feature to a release is a good thing, in fact that was a NO in Growing Software with enough good reasons.
    The real life examples of real instances took place (shown in grey boxes) added a great value; you will always stay skeptical about a theory until you hear someone who had lived it.
    Another part of the practical side is the auxiliary spreadsheets the book provides to tackle certain decision-making situations. No Starch Press provide them for download from their site here.
  3. Realistic: The book doesn’t promise you with a sliver bullet, instead it puts the various options on the table and show you why/when you would choose one over the other depending on the situation, injecting this with the experience Mr. Louis Testa has.
    It doesn’t tell you use Agile methodologies, RUP, or Waterfall…it helps you how to choose a process, how to customize it to fit your organization, and how to improve it.
  4. For Humans: actually this is one of the best things I liked about the book; I have always believed that we can’t separate business, process, establishments, or evolution without considering the emotions, the culture, and the mentality of the humans involved.
    Reading throughout the book, you can see that this was kept between the eyes all along when it talks about engineers, fellow executives, or customers. Tackling emotions, behavior, expectations and negotiation. Politics was significantly considered in the book when taking decisions or dealing with the different parties
  5. Simple: It’s simple; the language is easy to understand, and the structure and sequence of the book is logical. I had no interpretation burden while reading it.

Though, the addressed character in the book is a development manager or a CTO strictly; I’d have really loved if it had shed more light on the Business side of the story, I know it would have widened the scope even more but I believe this is becoming a large need in the Software Industry in general, maybe in another book.
Another thing is that sometimes the book digs little bit too deep in the self-management advices, to extent that intelligent people might want to skip it whole together.

I’d definitely recommend this book for everyone who is interested in Growing his Software house, or being part of it.

Nice Development Tools

Filed Under (Development, software management) by Emad Alashi on 19-09-2009

Tagged Under :

tool-kit Sometimes development tools can be very tempting to a degree that you just want to open the IDE and start hitting those keys. Though it’s not always within the IDE; here is a list of development tools, without specific order, that are just so sweet and pretty crucial to teams opt for best development environment!

  1. MSBuild or NAnt
    Build automation tools by which a developers can use XML scripts to automate all the hassle tasks of creating a build: retrieving code from the source control (SC), labeling the source code, building it, zipping it, emailing info, and many other tasks. Both tools are free.
  2. CruiseControl or TeamCity
    Continuous Integration servers that utilize the build automation tools to add extra slick functionalities like monitoring the SC, issuing specific commands on specific actions done on the SC. CruiseControl is free while TeamCity is not.
    I once heard a really interesting utilization of such servers; the dev team had red and green bulbs placed in a noticeable area where everybody could see them. On each code check-in action the servers would initiate a build on the server, so if the code builds successfully the green bulb would light up, if the build fails the red bulb lights up instead. nice ha! :D
  3. Tarantino
    I still haven’t got the chance to work on this tool, but it says it does the thing I really wish more companies start to embrace; which is having a separate database instance for each developer instead of shared databases.
    This tool would let the database changes to be incorporated into the SC as easy as code check-in’s (including Schema changes). So in any instance of time, the developer will be able to get latest version of code and sequence of scripts and work on clean ready environment where code and database schema is 100% compatible.
  4. RedGate Sql Compare
    It enables you to compare two database instances and to elicit a change script from this comparison. One of the many features, by which it supersedes its free counter part SQLCompare, is that it can be initiated from Command Prompt. costs at least $390.
  5. TortoiseSVN
    SVN(SubVersion) is an open source SC. TortiseSVN is an SVN client that integrates with the Windows shell. Lovely, robust and free.
  6. AnkhSVN
    it’s an SVN client too, but integrates with Visual Studio so you don’t have to leave the IDE to manage versions, indispensable. It’s free.
  7. TFS sidekicks
    if you have ever dealt with TFS administration, you’d know how cumbersome it is. TFS SideKicks is the solutions, period!
  8. NUnit or xUnit
    For the ones who haven’t heard of Unit Testing tools (I hope you are few!), you will be able to write code to test your code; and with nice GUI which tells which part of your code fails. Both are free.
  9. IE8 Developers tools, Firebug for Firefox
    These are awesome client side environment tools; Debug Javascript, Profile Javascript, and manipulate CSS on the fly. web devs can’t live without it really. both are free.
  10. Fiddler
    inspects http requests made from your browser, with details to the smallest bit came into your machine through http. It’s free
  11. WinMerge
    The best diff tool out there, I wish I could replace it with every IDE Source Control plugins, it compares folders too. It’s free.
  12. BugTracker.Net
    If you have a small team of devs who work on low cost and tight budget project where you can’t use Jira? this is THE bug tracker software I choose. I love their new feature integrating with SVN. And it’s free.
  13. DPack
    Code navigation tool; light, handy, free.
  14. CodeRush or Resharper
    code assistant and enhancement tools, makes you create, change, refactor code in couple of key strokes. They are both not free except CodeRush has an Xpress version

I am sure there are others slipped out of my mind, but I believe those are fun enough to play around with. enjoy :)

DotNetArabi Episode 5 دوت نت عربي الحلقة الخامسة

Filed Under (Development, DotNetArabi) by Emad Alashi on 29-08-2009

Tagged Under :

   

Episode 5 of DotNetArabi podcast is published on www.dotnetarabi.com

Mohamad Meligy talked in this episode about ORM (Object Relational Mapping), he explained in details how they work, why we need them, their advantages and disadvantages, and listed some of the known ORM engines.

لقد تم نشر الحلقة الخامسة من دوت نت عربي على www.dotnetarabi.com. تحدث فيها محمد مليجي بإسهاب عن
الـ ORM (Object Relational Mapping). مفصلا ماهيتها، و كيف تعمل، و حسناتها و سيئاتها، و ذكر كذلك بعضا من المكتبات البرمجية  منها و حسناتها.

DotNetArabi Episode 4 دوت نت عربي الحلقة الرابعة

Filed Under (Development, Misc) by Emad Alashi on 19-08-2009

Tagged Under :

  

I just published episode 4 of the DotNetArabi podcast on www.dotnetarabi.com.

This episode was with guest Mohammad Zayed, he works as Strategic Technology Specialist in Microsoft Jordan. he worked on different Microsoft technologies ranging from Windows Forms applications, Web Forms and Mobile.
Mohammad talks in this episode about Sharepoint, the in’s and out’s, the benefits and the challenges.

لقد تم نشر الحلقة الرابعة من دوت نت عربي على www.dotnetarabi.com ، التي كان الضيف فيها محمد زايد. يعمل محمد زايد حاليا كمتخصص تقنيات استراتيجي لكبار العملاء في مايكروسوفت الأردن. و تكلم في هذه الحلقة عن الـ Sharepoint: ماهيته، و ما يلزم لتثبيته، و تراخيصه، و نقاط قوته، و نقاط التحدي فيه، و الكثير من المعلومات القيمة. 

JIT compiler and "Method Not Found" error

Filed Under (Development, Misc) by Emad Alashi on 11-08-2009

Tagged Under :

CropperCapture[20]

Actually it can be “Could Not Load Type” too, but the reason is the same: you are referencing the wrong DLL version.

well, this is totally understandable; of course you are going to get this exception when you use an outdated DLL that lacks the new extra parameter to THAT certain method. But the interesting part is it will not happen when you first run your application, and neither when execution reaches the changed method; it will happen when code-execution reaches a place that REFERENCES that changed method.

lets look at the following example.

I have created two projects: Windows Forms project called “HostDLL”, and a Class Library project called “BadDLL”.
The HostDLL references the BadDLL; upon clicking a button in the form, the HostDLL will create an instance of class “BadClass” and call the method “DoStuff” which takes two integer parameters.
everything goes fine:

   20 private void button1_Click(object sender, EventArgs e)

   21         {

   22             BadClass bc = new BadClass();

   23             int x = 3, y = 10;

   24 

   25             bool never = false;

   26             if (never)

   27             {

   28                 bc.DoStuff(x, y);

   29             }

   30             MessageBox.Show(“Done successfully”);

   31         }

Notice the IF clause in line 26, and notice that calling the method “bc.DoStuff” will never take place because the “never” variable is always false.

Now, intentionally, we will make a breaking change in the BadDLL; adding a new integer parameter z to the DoStuff method (we will make this change AFTER we have compiled the HostDLL so we don’t get compile-time correction).

Run the applicaion HostDLL to show the form, you will notice that there is no error, even when the BadDLL has been changed. Now hit the button… you will get a run-time error that says “Method Not Found”. The interesting part of the story is that even though DoStuff will never get called, yet we will still get this run-time error.
The reason is that the JIT compiler does what it’s called after: “Just-In-Time Compiler“; using help from the “CLR via C#” book authored by Jeffery Richter, specifically in “Executing Your Assembly’s Code” section, the explanation is that:

To execute a method, its Intermediate Language must first be converted to native CPU instructions. This is the job of the CLR’s JIT (just-in-time) compiler…Just before the method executes, the CLR detects all of the types that are referenced by the method’s
code (in our case it’s the BadClass). This causes the CLR to allocate an internal data structure that is used to manage access to the referenced types.

The author continues in a graph in which he explains the process:

1. In the assembly that implements the type, look up the method being called in the metadata
2. From the metadata, get the IL for this method
3. Allocate a block of memory
4. Compile the IL into native CPU instructions

So it is at that point the code is compiled, and at that point the JIT discovers that there is a type (which is BadClass in our case) is referenced having an invalid method with one extra parameter.

So always be careful when you reference other DLL’s, if you don’t make sure you have the right version, you will be subject to a potential lovely RTE message :)

“طور نفسك برمجيا”…موجة من عمر قعدان

Filed Under (Development, Misc) by Emad Alashi on 31-07-2009

Tagged Under :

قبل أيام، كتب أخي عمر قعدان في مدونته مقالا بعنوان “شيفرة مصدرية للقراءة” و في آخره استعمل أسلوب “الموجة” في المدونات و هو أسلوب مبتكر في عالم التدوين يقوم صاحبه بكتابة مقال، ثم يطلب في آخر المقال من مدونين معينين كتابة المقال نفسه لكن من تجربتهم الشخصية، و بدورهم يفعلون الأمر ذاته مع آخرين إن أرادوا.
يطلق على هذا الأسلوب في الإنجليزية كلمة “Tagging” و برأيي أن أقرب مرادف لهذا المعنى في اللغة العربية ضمن هذا السياق هو كلمة “موجة”. و ها أنا أستجيب للموجة التي أطلقها أخي عمر.

grow

أفصح عمر في مقالتين له عن كيفية تطوير المبرمج لنفسه، و طلب في موجته الإجابة عن ثلاثة أسئلة:

  • كيف تصقل مهارتك كمبرمج؟
  • ما رأيك بفكرة قراءة الشيفرة المصدرية للتعلم؟
  • و هل هناك برامج مفتوحة المصدر تعلمت منها؟

بالنسبة لي، صقل المهارة يكون: بالتأسيس من خلال القراءة و العلم النظري، و من ثم بالاستكمال في التطبيق العملي. فبدون أي من هذين الجناحين لا أتصور نجاح أي مبرمج أو تقني. فالقراءة و الجانب النظري يثري الجانب العلمي، و التطبيق يأكده؛ إما أن يشكك في صحته و ينفيه، أو يزيد من يقينه.

و إذا ولجنا بتفصيل أكبر في الموضوع، أرى أن في الجناح الأول – و هو الجانب النظري- قد تقيدنا فيه النقاط التالية:

  • بالنسبة للمواضيع الأساسية و القواعد الأولى لأي علم، يكون المصدر الأمثل للمعلومة هو الكتاب المفصل أو المقال الطويل أو المتسلسلات Tutorials (أروعها بالنسبة لي 4guysfromrolla)؛ فلأهميتها لا بد من قراءة متمعنة و عميقة ترسم في الذهن الأبعاد كلها، و تستكمل جميع جوانب الموضوع بتفصيل واسع و دقيق. أمثلة على هذه المواضيع: في عمل البرمجة بالدوت نت “أنواع المتغيرات في الـدوت نت”، في علم البرمجة في مجال الإنترنت “دورة حياة صفحة الـASP.NET” و هلم جر.
  • أما إذا كنت تبحث في علم لست مهتما به كثيرا، أو بعلم يهمك لكن بموضوع يلامسه من بعيد -نسبيا-، فتكون من خلال قراءة المقالات العامة، و التدوينات، و الفيديوهات (أولي بها أهمية أكبر لنجاعتها بتوصيل المعلمومة، و أضيف على عمر فيديوهات ASP.NET)، أو حضور المحاضرات التي تكون بمثابة “مدخل” لهذا العلم.
  • سؤال و متابعة المحترفين؛ مثل متابعة المدونات كمدونة: “سكوت ميتشيل Scott Mitchel” و “سكوت جوثري Scott Guthrie“، أو استخدام تويتر twitter.
  • قراءة “الشيفرة المصدرية” أو الـ Source Code لبرامج أنشأها مبرمجون محترفون في المجتمع، و هي من أهم طرق تحصيل العلم البرمجي؛ فهي مثال حقيقي مجرب بأيدي محترفين ذوي سنوات طويلة من الخبرة، تستطيع من قراءة المصدر أن تفهم كيف يفكر، و متى يستخدم أسلوبا معينا، و كيف يحل معضلة واقعية مشهورة. أمثلة: ASP.NET MVC Nerddinner، RSS.net، و Ninject.
  • تعليم الآخرين و إعطاء المحاضرات أو كتابة المدونات إن أمكن، فلا يزيد ترسيخ المعلومة -بعد التطبيق- أكثر من تعليم الآخرين (و هنا أقول لا تبخل بالمعلومة أبدا أبدا، فالخير العائد إليك أكبر بكثير من ما قد يخطر على بالك من الخسارة إن وجدت)

أما بالنسبة للتطبيق فهو استكمال البناء، فلقد تعلمت من بنيان Bunian أكثير من أي شيء آخر (على الرغم من أنه غير مستكمل لغاية الآن)؛ فإن تابع الشخص كل مدونين التكنولوجيا، و قرأ كتب العظماء، و شاهد جميع الفيديوهات و المتسلسلات، و لم يفتح Visual Studio و طبق ما عرف، فاعلم أنه ليس سوى فقاعة كبيرة -و للأسف-، و سيخونه علمه في أبسط التحديات البرمجية على الطريق.

و أخيرا، من أكثر ما يزيد مهارة الشخص، هو الهمة في التحصيل، و هذه الهمة تزيد أضعافا عند مشاركة الآخرين، سواء في مجتمعات البرمجة الحقيقية (كـ Jordev هنا في الأردن)، أو كالمجتمعات على الإنترنت (كـ www.vb4arab.com). فبمجرد أن تتكلم مع من يشاركك هذا الشغف، لن تتمالك نفسك حتى تعود للمنزل و تفتح الجهاز و تستمع بسماع صوت طرق لوحة المفاتيح :) .

و أمرر هذه الموجة إلى كل من: أحمد أبو عرجة، و طارق سيالة. دون أن يكون هذا على وجه الإلزام.

 

A Case We Shouldn’t Use Stored Procedure’s In

Filed Under (Development, NHibernate) by Emad Alashi on 09-06-2009

Tagged Under : , , ,

We are working on this big project at work in which several teams are assigned to different modules. The modules are, naturally, overlapping in certain areas where they they need to interact with each other through API’s.

One of these modules is central and crucial to the rest of the modules, the dependency is very high that the team has to provide many API’s. Certain API’s was needed by different modules; our team needed a list of entity X, and another team also wanted a list of entity X, BUT…we had different criteria!

For example, Entity X had an Enum property called “Type”. The API provided a parameter to filter on this Type, but the options were limited to couple of choices; either you get entities of THIS type, or you get all entities.  If you needed type A and B only, you will have to get all the entities in the database, or make two hits to the database and join the two lists.

A solution was to give all the various options to the user as optional parameters some of which was Array of values. This resulted in an ugly API signature that had many optional parameters, and when ever a new criteria is needed, the signature would change and break all the already existing calls for the API, and I will not even imagine how the SP would look like!. An ugly alternative as well is to create new SP for each different criteria. Both choices are maintenance killers.

In such cases, the dynamic queries are just wonderful; depending on the properties the end user needs to filter on, a query will be created dynamically with proper operator passed. Usually ORM engines, or similar engines, will provide you with an “internal language”, e.g. SubSonic:
——————
Episode  ep = new Select().From<DA.Episode>().Where(“Title”).Like(“SOA”).ExecuteSingle<DA.Episode>();
—————-

Another example is the “query by example” in NHibernate (code snippet is taken from NHibernate help):
——————-
IList episodes = session.CreateCriteria(typeof(Episode))
    .Add( Expression.Like(”Title”, “SOA%”) )
    .List();
—————–

And, of course, LINQ:
—————–

var episodes = from x in db.Episodes where x.Title.Contains("SOA") select c; ---------------

Or you can build your own ;) .

I hope this gives an insight.

DPack for Visual Studio, Better Navigation

Filed Under (Development) by Emad Alashi on 02-06-2009

Tagged Under :

There have been couple of code assistance and refactoring products for the Visual Studio IDE, two of the top listed is CodeRush and Resharper; they provide amazing and rich functionality regarding code refactoring and navigation.
But if the built-in refactorings in the Visual Studio itself suffices you (I am comfortable with it), then the only thing you need is DPack for Visual Studio; it’s a simple navigation utility by which you can navigate to the wanted File, Class, Method, or Property as easy as couple of strokes.

“Alt + U” to navigate to a file, the list is filtered as you type and the matching isn’t necessarily made for the beginning of the word:

NavigateToFile

“Alt + M” navigates to Methods:

NavigateToMethod

“Alt + Shift + P” navigates to Properties:

NavigateToProperites 

very simple and handy, one of the tools can’t live without it. DPack everybody.