Monthly Archives: August 2009

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

   

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). مفصلا ماهيتها، و كيف تعمل، و حسناتها و سيئاتها، و ذكر كذلك بعضا من المكتبات البرمجية  منها و حسناتها.

Basics Of Successful Communication

CommunicationIt’s a waste of time trying to explain how important communication is in life, whether it is at work or personal life. So I will start immediately in group of points I find it to be basics when it comes to successful communication in general, and verbal communication in specific.

Here is the list of actions you need to take in order to explain your thoughts as clear as and descriptive as possible. I tried to put them in their proper order considering the communication process, though they can overlap:

  1. At the beginning of the conversation, make sure that the goal of the conversation is clear
    e.g. “the goal of this discussion is to discuss the problem x, and to find a proper solution for it”
  2. Put the listener in the context instantly
    e.g. “Remember the remark our client made on the page where we list his system users?”
  3. Unify the terms used in the discussion; giving special words to commonly used meanings and expressions
    e.g. ; “users who are still work for the company but for some reason they are not available we will call them Deactivated Users, users who don’t work for the company anymore will be called Deleted Users
  4. Start from common ground of information
    e.g. “As you already know, this list is too long and a scrollbar shows, and you know too that the architecture team provided us with a tool for paging, now the problem is…”
  5. Sequence of thoughts is highly important; you should start from the most intrinsic and basic thought and build on it to conclude to the next, each thought should be a building block for the next
    “we are advised to use tool x for this problem, tool x uses technology y, technology y requires us to buy that license, and we cannot afford it right now, so what we can do is…”
  6. Aside from the terms in point 3, use language words that are understandable by the listener; don’t use a unique dialect for example.
  7. Don’t deviate from the subject or add information that is useless to the subject; the more you talk about irrelevant subjects, the closer to failure the communication would be. This point too should be explained with bad example:
    e.g. “Yes, this can be fixed but it only requires a small action from Ahmad, who happens to be working with the architecture team right now, on a new feature in the framework that might add a new challenge to our application because we will have to change the….”! ;
  8. Don’t try to over explain the idea more than it needs; use short expressive words.
    e.g. “I get server error exception” rather than “I get error showing tags and line of code in the vb file where the error happened because it is an error from the server as you know”!
  9. Talk in digestible speed, a speed that suits the listener not you; reminding to point 5, thoughts are delivered in sequence, make sure the listener digested the current before you move to the next
  10. Ask questions that help the listener to understand, when you already know the answer, but you want to reach certain point with the question where the listener will have to think clearly about it
    “When request a page, what happens on the server?”
  11. Confirm that the listener is following right by asking regularly
    “are you following?”
  12. if the listener failed to understand at some point do the following:
    1. ask what part exactly he didn’t understand in order to take the proper action
    2. DON’T REPEATE THE SAME SENTENCE! rephrase the sentence in a more understandable way (needs a lot of training, I agree)
    3. Step one level back in your sequence of thoughts, probably the listener didn’t understand because of failure in explaining the previous though

By this I end the basics of successful communication, it’s not easy to follow these steps I am sure, it needs a lot of practice, especially when it comes to choosing words and preparing the sequence of thoughts. But if you practice enough and ; you master it, your life will be much easier

I hope you benefit and have a nice discussions around :)

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

  

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

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