Monday, May 3, 2010

Overlay vs override

Microsoft is trying to achieve consistency among all the classes in AX to have the following condition met:
Each class has construct method which takes no parameters. This constructor should be the primary entry point for class construction, e.g. any other constructor should use construct() inside.
For the same reason, to avoid direct instantiation of the objects via new() method they are marked as protected. It is done in such way because it looks like overriding is much more maintainable than overlaying. It is better to create a sub-class in the outer layer that extends super-class in inner layer and overrides the required method + have construct() method overlaid to instantiate sub-class instead. Code upgrade in this case seems to be much cheaper comparing to the case when methods are overlaid directly on the super-class.

So my question basically is, if this statement is correct or not? Are you writing code in the described way? If no, why? What are the cases when overlaying is better that overriding?

12 comments:

  1. Can you give a example here to make the scenario more clear ?

    The general way we followed earlier was
    to create new methods and have a single construct
    method in the base class. Then use the construct method
    for all types of construction.
    Eg: as in InventMovement class

    But recently after looking at the BP warning of
    making the new method protected we have moved to the new
    model where we create new methods for every subclas
    and make them protected and also have an constructor for it

    After this we create a factory kind of method in the base class
    and use that to create different instance.

    But still i think widely the first method is
    adopted by other developers.

    ReplyDelete
  2. It's an remarkable article for all the web people; they will take advantage from it I am sure.

    Feel free to surf to my website: windows xp registry cleaner
    my web site > registry cleaner software

    ReplyDelete
  3. This is very fascinating, You are an overly skilled blogger.
    I have joined your feed and stay up for looking for extra of your wonderful post.
    Also, I have shared your website in my social networks

    Feel free to visit my page :: Sidney Crosby Black Jersey

    ReplyDelete
  4. Attractive section of content. I just stumbled upon your weblog and in accession capital to
    assert that I get in fact enjoyed account your
    blog posts. Anyway I will be subscribing to your augment and even I achievement you
    access consistently rapidly.

    Here is my website NFL Cheap Jerseys

    ReplyDelete
  5. Attractive component of content. I just stumbled upon your
    website and in accession capital to say that I get actually enjoyed account your weblog posts.

    Any way I will be subscribing on your augment or even I achievement you access persistently fast.



    Review my website: Wholesale Jerseys

    ReplyDelete
  6. Hello, I would like to subscribe for this website to take newest
    updates, thus where can i do it please help out.

    Feel free to surf to my web-site - NFL Jerseys Cheap

    ReplyDelete
  7. Hurrah! After all I got a website from where I be able to in fact obtain helpful facts regarding
    my study and knowledge.

    Also visit my blog; Sac a main Guess

    ReplyDelete
  8. I love reading through a post that will make people think.
    Also, thank you for permitting me to comment!


    Also visit my website - Abercrombie Bruxelles

    ReplyDelete
  9. That is a great tip especially to those new to the blogosphere.
    Short but very precise info… Thank you for sharing this one.

    A must read post!

    Here is my page - Chaussure De Foot

    ReplyDelete
  10. Hello there, I found your web site via Google while searching for a comparable subject, your
    site came up, it appears great. I have bookmarked it in
    my google bookmarks.
    Hello there, simply was alert to your blog thru Google, and found
    that it's truly informative. I am going to watch out for brussels. I'll be grateful if you
    happen to continue this in future. Numerous
    other folks can be benefited from your writing. Cheers!


    Look at my page :: Nike Air Max

    ReplyDelete
  11. Ridiculous story there. What happened after?
    Good luck!

    my blog post: Louis Vuitton Handbags

    ReplyDelete
  12. I like reading through an article that can make people think.
    Also, thank you for allowing for me to comment!

    My web blog Cheap Jerseys3

    ReplyDelete