A query on software design/architectureDoes functional programming replace GoF design patterns?Software Design vs. Software ArchitectureExamples of GoF Design Patterns in Java's core librariesMaking this class comply with the Dependency Inversion principleUser interface depending on business logic layer breaks dependency inversion principle?What is the difference between DI principle and “Program to interface, not to implementation”?Finding the High-Level and Low-Level modules in dependencies for applying Dependency Inversion PrincipeDependency Inversion Principle (SOLID) vs Encapsulation (Pillars of OOP)Dependency Inversion Principle's second statement elaborationConfusion between Inversion of Control and Hollywood Principle

How could it be that the capo isn't changing the pitch?

When is it legal to castle moving the rook first?

'Hard work never hurt anyone' Why not 'hurts'?

Travel to USA with a stuffed puppet

co-son-in-law or co-brother

Deleting millions of records on SQL Server 14.0

Does secure hashing imply secure symmetric encryption?

How do I name the individual parts of the lumbricals muscle of the foot in latin?

Select single features in selection

What's the difference between a share and a stock?

What is the significance of 104%?

Has Rey's new lightsaber been seen before in canon or legends?

How to generate all 3×3 matrices with a,a,a,a,b,b,b,c,c?

To which airspace does the border of two adjacent airspaces belong to?

Can there be plants on the dark side of a tidally locked world?

Why don't they build airplanes from 3D printer plastic?

Is torque as fundamental a concept as force?

How does Harry wear the invisibility cloak?

Case Studies and Real Problems for Teaching Optimization and Modelling

Planet that’s 90% water or more?

What drugs were used in England during the High Middle Ages?

A rather curious equality: is this true?

Punishment in pacifist society

Japanese equivalent for "get to do something"?



A query on software design/architecture


Does functional programming replace GoF design patterns?Software Design vs. Software ArchitectureExamples of GoF Design Patterns in Java's core librariesMaking this class comply with the Dependency Inversion principleUser interface depending on business logic layer breaks dependency inversion principle?What is the difference between DI principle and “Program to interface, not to implementation”?Finding the High-Level and Low-Level modules in dependencies for applying Dependency Inversion PrincipeDependency Inversion Principle (SOLID) vs Encapsulation (Pillars of OOP)Dependency Inversion Principle's second statement elaborationConfusion between Inversion of Control and Hollywood Principle






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















In book 'Patterns of Enterprise Application Architecture', following is stated:




When thinking of a system in terms of layers, you imagine the principal subsystems
in the software arranged in some form of layer cake, where each layer
rests on a lower layer. In this scheme the higher layer uses various services
defined by the lower layer, but the lower layer is unaware of the higher layer.




On other hand, in book 'Agile Principles, Patterns, and Practices', following is stated on Dependency-Inversion Principle:




High-level modules should not depend on low-level modules. Both should depend
on abstractions.




This sort of confuses me. Am I mixing two different things here?










share|improve this question
































    0















    In book 'Patterns of Enterprise Application Architecture', following is stated:




    When thinking of a system in terms of layers, you imagine the principal subsystems
    in the software arranged in some form of layer cake, where each layer
    rests on a lower layer. In this scheme the higher layer uses various services
    defined by the lower layer, but the lower layer is unaware of the higher layer.




    On other hand, in book 'Agile Principles, Patterns, and Practices', following is stated on Dependency-Inversion Principle:




    High-level modules should not depend on low-level modules. Both should depend
    on abstractions.




    This sort of confuses me. Am I mixing two different things here?










    share|improve this question




























      0












      0








      0








      In book 'Patterns of Enterprise Application Architecture', following is stated:




      When thinking of a system in terms of layers, you imagine the principal subsystems
      in the software arranged in some form of layer cake, where each layer
      rests on a lower layer. In this scheme the higher layer uses various services
      defined by the lower layer, but the lower layer is unaware of the higher layer.




      On other hand, in book 'Agile Principles, Patterns, and Practices', following is stated on Dependency-Inversion Principle:




      High-level modules should not depend on low-level modules. Both should depend
      on abstractions.




      This sort of confuses me. Am I mixing two different things here?










      share|improve this question
















      In book 'Patterns of Enterprise Application Architecture', following is stated:




      When thinking of a system in terms of layers, you imagine the principal subsystems
      in the software arranged in some form of layer cake, where each layer
      rests on a lower layer. In this scheme the higher layer uses various services
      defined by the lower layer, but the lower layer is unaware of the higher layer.




      On other hand, in book 'Agile Principles, Patterns, and Practices', following is stated on Dependency-Inversion Principle:




      High-level modules should not depend on low-level modules. Both should depend
      on abstractions.




      This sort of confuses me. Am I mixing two different things here?







      oop design-patterns architecture






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 6:35









      Svetlin Zarev

      7,1703 gold badges30 silver badges60 bronze badges




      7,1703 gold badges30 silver badges60 bronze badges










      asked Mar 28 at 2:49









      MandroidMandroid

      1,0761 gold badge14 silver badges31 bronze badges




      1,0761 gold badge14 silver badges31 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          2
















          I suppose that it could speak to some the same principles, but at different levels of granularity. I would still view Dependency Inversion as something that stands on its own, however.



          In the first instance, consider this example - in a simple layered architecture, you might have a presentation layer built in JavaScript, a business logic layer built in Java, and a data layer in SQL Server. These layers could be developed by different teams of people. The presentation layer knows how to make API calls to the business logic layer, but not the other way around. The business logic layer knows how to read/write to and from the database layer, but not the other way around. The distinction here happens at a high-level - you might even call it conceptual.



          In the second instance, you want to prevent scenarios where supposedly generic code depends on specific implementations - and at this point, I see it as a relatively low-level concern that falls within the scope of a particular application (i.e. in code, not conceptually as in the previous example). If you have code that writes to a database, but you want to support different implementations - e.g. MySQL and SQL Server, where each of those might have some specific intricacies, don't make the calling code explicitly depend on either of those - abstract away the complexity through an interface. This is what the Dependency Inversion Principle addresses (see below).



           public class UserService 

          public UserRepository repository;

          public void setUserRepository(UserRepository repository)
          this.repository = repository; //Is this a MySqlRepository or a SqlServerRepository? We don't care - the dependency is managed outside and we can change it without changing this class.


          public void persistUser()
          this.repository.persist(user); //We just care about the abstraction - the interface.







          share|improve this answer
































            0

















            Am I mixing two different things here?




            Yes.



            The first case is about dependencies at run-time while the second case is about dependencies at compile-time.



            For example, at run-time, business layer can call the functions/methods implemented in database layer. But at compile-time, business layer code does not mention any code in database layer. This is usually achieved with Polymorphism.






            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',
              autoActivateHeartbeat: false,
              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%2f55389467%2fa-query-on-software-design-architecture%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2
















              I suppose that it could speak to some the same principles, but at different levels of granularity. I would still view Dependency Inversion as something that stands on its own, however.



              In the first instance, consider this example - in a simple layered architecture, you might have a presentation layer built in JavaScript, a business logic layer built in Java, and a data layer in SQL Server. These layers could be developed by different teams of people. The presentation layer knows how to make API calls to the business logic layer, but not the other way around. The business logic layer knows how to read/write to and from the database layer, but not the other way around. The distinction here happens at a high-level - you might even call it conceptual.



              In the second instance, you want to prevent scenarios where supposedly generic code depends on specific implementations - and at this point, I see it as a relatively low-level concern that falls within the scope of a particular application (i.e. in code, not conceptually as in the previous example). If you have code that writes to a database, but you want to support different implementations - e.g. MySQL and SQL Server, where each of those might have some specific intricacies, don't make the calling code explicitly depend on either of those - abstract away the complexity through an interface. This is what the Dependency Inversion Principle addresses (see below).



               public class UserService 

              public UserRepository repository;

              public void setUserRepository(UserRepository repository)
              this.repository = repository; //Is this a MySqlRepository or a SqlServerRepository? We don't care - the dependency is managed outside and we can change it without changing this class.


              public void persistUser()
              this.repository.persist(user); //We just care about the abstraction - the interface.







              share|improve this answer





























                2
















                I suppose that it could speak to some the same principles, but at different levels of granularity. I would still view Dependency Inversion as something that stands on its own, however.



                In the first instance, consider this example - in a simple layered architecture, you might have a presentation layer built in JavaScript, a business logic layer built in Java, and a data layer in SQL Server. These layers could be developed by different teams of people. The presentation layer knows how to make API calls to the business logic layer, but not the other way around. The business logic layer knows how to read/write to and from the database layer, but not the other way around. The distinction here happens at a high-level - you might even call it conceptual.



                In the second instance, you want to prevent scenarios where supposedly generic code depends on specific implementations - and at this point, I see it as a relatively low-level concern that falls within the scope of a particular application (i.e. in code, not conceptually as in the previous example). If you have code that writes to a database, but you want to support different implementations - e.g. MySQL and SQL Server, where each of those might have some specific intricacies, don't make the calling code explicitly depend on either of those - abstract away the complexity through an interface. This is what the Dependency Inversion Principle addresses (see below).



                 public class UserService 

                public UserRepository repository;

                public void setUserRepository(UserRepository repository)
                this.repository = repository; //Is this a MySqlRepository or a SqlServerRepository? We don't care - the dependency is managed outside and we can change it without changing this class.


                public void persistUser()
                this.repository.persist(user); //We just care about the abstraction - the interface.







                share|improve this answer



























                  2














                  2










                  2









                  I suppose that it could speak to some the same principles, but at different levels of granularity. I would still view Dependency Inversion as something that stands on its own, however.



                  In the first instance, consider this example - in a simple layered architecture, you might have a presentation layer built in JavaScript, a business logic layer built in Java, and a data layer in SQL Server. These layers could be developed by different teams of people. The presentation layer knows how to make API calls to the business logic layer, but not the other way around. The business logic layer knows how to read/write to and from the database layer, but not the other way around. The distinction here happens at a high-level - you might even call it conceptual.



                  In the second instance, you want to prevent scenarios where supposedly generic code depends on specific implementations - and at this point, I see it as a relatively low-level concern that falls within the scope of a particular application (i.e. in code, not conceptually as in the previous example). If you have code that writes to a database, but you want to support different implementations - e.g. MySQL and SQL Server, where each of those might have some specific intricacies, don't make the calling code explicitly depend on either of those - abstract away the complexity through an interface. This is what the Dependency Inversion Principle addresses (see below).



                   public class UserService 

                  public UserRepository repository;

                  public void setUserRepository(UserRepository repository)
                  this.repository = repository; //Is this a MySqlRepository or a SqlServerRepository? We don't care - the dependency is managed outside and we can change it without changing this class.


                  public void persistUser()
                  this.repository.persist(user); //We just care about the abstraction - the interface.







                  share|improve this answer













                  I suppose that it could speak to some the same principles, but at different levels of granularity. I would still view Dependency Inversion as something that stands on its own, however.



                  In the first instance, consider this example - in a simple layered architecture, you might have a presentation layer built in JavaScript, a business logic layer built in Java, and a data layer in SQL Server. These layers could be developed by different teams of people. The presentation layer knows how to make API calls to the business logic layer, but not the other way around. The business logic layer knows how to read/write to and from the database layer, but not the other way around. The distinction here happens at a high-level - you might even call it conceptual.



                  In the second instance, you want to prevent scenarios where supposedly generic code depends on specific implementations - and at this point, I see it as a relatively low-level concern that falls within the scope of a particular application (i.e. in code, not conceptually as in the previous example). If you have code that writes to a database, but you want to support different implementations - e.g. MySQL and SQL Server, where each of those might have some specific intricacies, don't make the calling code explicitly depend on either of those - abstract away the complexity through an interface. This is what the Dependency Inversion Principle addresses (see below).



                   public class UserService 

                  public UserRepository repository;

                  public void setUserRepository(UserRepository repository)
                  this.repository = repository; //Is this a MySqlRepository or a SqlServerRepository? We don't care - the dependency is managed outside and we can change it without changing this class.


                  public void persistUser()
                  this.repository.persist(user); //We just care about the abstraction - the interface.








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 28 at 6:29









                  Riaan NelRiaan Nel

                  1,4403 silver badges13 bronze badges




                  1,4403 silver badges13 bronze badges


























                      0

















                      Am I mixing two different things here?




                      Yes.



                      The first case is about dependencies at run-time while the second case is about dependencies at compile-time.



                      For example, at run-time, business layer can call the functions/methods implemented in database layer. But at compile-time, business layer code does not mention any code in database layer. This is usually achieved with Polymorphism.






                      share|improve this answer





























                        0

















                        Am I mixing two different things here?




                        Yes.



                        The first case is about dependencies at run-time while the second case is about dependencies at compile-time.



                        For example, at run-time, business layer can call the functions/methods implemented in database layer. But at compile-time, business layer code does not mention any code in database layer. This is usually achieved with Polymorphism.






                        share|improve this answer



























                          0














                          0










                          0










                          Am I mixing two different things here?




                          Yes.



                          The first case is about dependencies at run-time while the second case is about dependencies at compile-time.



                          For example, at run-time, business layer can call the functions/methods implemented in database layer. But at compile-time, business layer code does not mention any code in database layer. This is usually achieved with Polymorphism.






                          share|improve this answer














                          Am I mixing two different things here?




                          Yes.



                          The first case is about dependencies at run-time while the second case is about dependencies at compile-time.



                          For example, at run-time, business layer can call the functions/methods implemented in database layer. But at compile-time, business layer code does not mention any code in database layer. This is usually achieved with Polymorphism.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 28 at 8:32









                          Nghia BuiNghia Bui

                          2,5769 silver badges18 bronze badges




                          2,5769 silver badges18 bronze badges






























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389467%2fa-query-on-software-design-architecture%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

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                              155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해