What's the right approach to aggregate information from distinct components in layered software?











up vote
-1
down vote

favorite












There's much information on the internet about layered software design, but I could not find the answer for a common problem: should I aggregate information from distinct components (or entities) acessing sibling components or components from the layer below?



Suppose I have the following scenario:



Business Layer: ConsumerBO, OrdersBO, MessagesBO ...
Data Layer: ConsumerDAO, OrdersDAO, MessagesDAO ...



The relation between ConsumerBO x ConsumerDAO, OrdersBO x OrdersDAO and so on is clear. But if I ever need to write a method on ConsumersBO that aggregates information from ConsumersDAO, OrdersDAO and MessagesDAO, should I do it by making ConsumersBO access methods from its siblings (eg.: OrderBO and MessagesBO) OR from components on the layer below (eg.: OrdersDAO, MessagesDAO)? Why?



[edit] rewriting this question due to down votes ..










share|improve this question
























  • As a side note I usually using the sibling components approach, for reasons like avoiding replicating logic that is already implemented on the sibling component (and that will be lost if we go directly on the layer below). But on the n-tier pattern articles I don't find any "formal" indication that it's the right approach.
    – Cotta
    Nov 11 at 0:16















up vote
-1
down vote

favorite












There's much information on the internet about layered software design, but I could not find the answer for a common problem: should I aggregate information from distinct components (or entities) acessing sibling components or components from the layer below?



Suppose I have the following scenario:



Business Layer: ConsumerBO, OrdersBO, MessagesBO ...
Data Layer: ConsumerDAO, OrdersDAO, MessagesDAO ...



The relation between ConsumerBO x ConsumerDAO, OrdersBO x OrdersDAO and so on is clear. But if I ever need to write a method on ConsumersBO that aggregates information from ConsumersDAO, OrdersDAO and MessagesDAO, should I do it by making ConsumersBO access methods from its siblings (eg.: OrderBO and MessagesBO) OR from components on the layer below (eg.: OrdersDAO, MessagesDAO)? Why?



[edit] rewriting this question due to down votes ..










share|improve this question
























  • As a side note I usually using the sibling components approach, for reasons like avoiding replicating logic that is already implemented on the sibling component (and that will be lost if we go directly on the layer below). But on the n-tier pattern articles I don't find any "formal" indication that it's the right approach.
    – Cotta
    Nov 11 at 0:16













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











There's much information on the internet about layered software design, but I could not find the answer for a common problem: should I aggregate information from distinct components (or entities) acessing sibling components or components from the layer below?



Suppose I have the following scenario:



Business Layer: ConsumerBO, OrdersBO, MessagesBO ...
Data Layer: ConsumerDAO, OrdersDAO, MessagesDAO ...



The relation between ConsumerBO x ConsumerDAO, OrdersBO x OrdersDAO and so on is clear. But if I ever need to write a method on ConsumersBO that aggregates information from ConsumersDAO, OrdersDAO and MessagesDAO, should I do it by making ConsumersBO access methods from its siblings (eg.: OrderBO and MessagesBO) OR from components on the layer below (eg.: OrdersDAO, MessagesDAO)? Why?



[edit] rewriting this question due to down votes ..










share|improve this question















There's much information on the internet about layered software design, but I could not find the answer for a common problem: should I aggregate information from distinct components (or entities) acessing sibling components or components from the layer below?



Suppose I have the following scenario:



Business Layer: ConsumerBO, OrdersBO, MessagesBO ...
Data Layer: ConsumerDAO, OrdersDAO, MessagesDAO ...



The relation between ConsumerBO x ConsumerDAO, OrdersBO x OrdersDAO and so on is clear. But if I ever need to write a method on ConsumersBO that aggregates information from ConsumersDAO, OrdersDAO and MessagesDAO, should I do it by making ConsumersBO access methods from its siblings (eg.: OrderBO and MessagesBO) OR from components on the layer below (eg.: OrdersDAO, MessagesDAO)? Why?



[edit] rewriting this question due to down votes ..







design-patterns software-design






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 0:30

























asked Nov 11 at 0:13









Cotta

637




637












  • As a side note I usually using the sibling components approach, for reasons like avoiding replicating logic that is already implemented on the sibling component (and that will be lost if we go directly on the layer below). But on the n-tier pattern articles I don't find any "formal" indication that it's the right approach.
    – Cotta
    Nov 11 at 0:16


















  • As a side note I usually using the sibling components approach, for reasons like avoiding replicating logic that is already implemented on the sibling component (and that will be lost if we go directly on the layer below). But on the n-tier pattern articles I don't find any "formal" indication that it's the right approach.
    – Cotta
    Nov 11 at 0:16
















As a side note I usually using the sibling components approach, for reasons like avoiding replicating logic that is already implemented on the sibling component (and that will be lost if we go directly on the layer below). But on the n-tier pattern articles I don't find any "formal" indication that it's the right approach.
– Cotta
Nov 11 at 0:16




As a side note I usually using the sibling components approach, for reasons like avoiding replicating logic that is already implemented on the sibling component (and that will be lost if we go directly on the layer below). But on the n-tier pattern articles I don't find any "formal" indication that it's the right approach.
– Cotta
Nov 11 at 0:16












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










If possible, try to make your business classes depend on their siblings. This aims to reduce the coupling between the layers which is always a good thing.



Notice that Business Layer should never depend directly on Data Layer because the former is more abstract than the later. Often we let business classes depend on interfaces which are implemented by classes in Data Layer. For example, the CustomerBO will use the ICustomerDAO interface which belongs to Business Layer, instead of the concrete CustomerDAO class which belongs to Data Layer.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244682%2fwhats-the-right-approach-to-aggregate-information-from-distinct-components-in-l%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    If possible, try to make your business classes depend on their siblings. This aims to reduce the coupling between the layers which is always a good thing.



    Notice that Business Layer should never depend directly on Data Layer because the former is more abstract than the later. Often we let business classes depend on interfaces which are implemented by classes in Data Layer. For example, the CustomerBO will use the ICustomerDAO interface which belongs to Business Layer, instead of the concrete CustomerDAO class which belongs to Data Layer.






    share|improve this answer

























      up vote
      1
      down vote



      accepted










      If possible, try to make your business classes depend on their siblings. This aims to reduce the coupling between the layers which is always a good thing.



      Notice that Business Layer should never depend directly on Data Layer because the former is more abstract than the later. Often we let business classes depend on interfaces which are implemented by classes in Data Layer. For example, the CustomerBO will use the ICustomerDAO interface which belongs to Business Layer, instead of the concrete CustomerDAO class which belongs to Data Layer.






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        If possible, try to make your business classes depend on their siblings. This aims to reduce the coupling between the layers which is always a good thing.



        Notice that Business Layer should never depend directly on Data Layer because the former is more abstract than the later. Often we let business classes depend on interfaces which are implemented by classes in Data Layer. For example, the CustomerBO will use the ICustomerDAO interface which belongs to Business Layer, instead of the concrete CustomerDAO class which belongs to Data Layer.






        share|improve this answer












        If possible, try to make your business classes depend on their siblings. This aims to reduce the coupling between the layers which is always a good thing.



        Notice that Business Layer should never depend directly on Data Layer because the former is more abstract than the later. Often we let business classes depend on interfaces which are implemented by classes in Data Layer. For example, the CustomerBO will use the ICustomerDAO interface which belongs to Business Layer, instead of the concrete CustomerDAO class which belongs to Data Layer.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 4:47









        Nghia Bui

        1,443812




        1,443812






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244682%2fwhats-the-right-approach-to-aggregate-information-from-distinct-components-in-l%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma