Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Folders and Namespaces vs Multiple Assemblies

Folders and Namespaces vs Multiple Assemblies

Scheduled Pinned Locked Moved The Lounge
51 Posts 29 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR realJSOP

    This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #39

    Here's a very good reason... If you put classes all inside a project, how do you replace just one class? Put "replaceable" code into their own projects and you get a separate DLL that you can swap out on the fly.

    If it's not broken, fix it until it is

    S 1 Reply Last reply
    0
    • realJSOPR realJSOP

      This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

      G Offline
      G Offline
      Gary Wheeler
      wrote on last edited by
      #40

      My product uses separate assemblies for a couple purposes. First are tools and utilities used commonly between the three applications in the product. The second is a little more interesting, in that I use separate assemblies and reflection for a plug-in framework. I have the option of customizing the product by replacing a plug-in assembly if I wish. To some extent this helps me tailor the product at run-time rather than at compile time. I could do all of this without using separate assemblies. Having purpose-specific assemblies gives you a level of organization above that of source file. While I've seen plenty of code that could benefit from more organization, I've seen very little where the organization was overdone.

      Software Zen: delete this;

      1 Reply Last reply
      0
      • P Pete OHanlon

        Stephen Gonzalez wrote:

        We don't want to put our library for public usage

        That's why I said self-host. You don't have to make it public - if you host it yourself, you can keep it internal. So, perhaps you're being harsh about them calling them idiot. After all, it's not their fault you don't know about how your organisation can host NuGet internally.

        This space for rent

        S Offline
        S Offline
        Stephen Gonzalez
        wrote on last edited by
        #41

        It wasn't clear like "MFE" guy.

        1 Reply Last reply
        0
        • realJSOPR realJSOP

          This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

          S Offline
          S Offline
          Super Lloyd
          wrote on last edited by
          #42

          it's a matter of taste.. I noticed many webby people (at least in my previous company, maybe it's a culture thing, hence different in each company) they were the kind who would would create zillion of library with just 2 or 3 classes each. They called it "separation of concerns" you see? I am just glad none of them designed the .NET BCL!!! :omg: ;P As a side note, my preference, I usually put everything with the same dependencies in the same assembly. I.e. ALL general purpose utilities in one DLL All utility related to a UI framework (WPF, WebMVC, Xamarin) in another DLL All reusable business data & model in one assembly finally all views, viewmodel related to an app in the app itself

          All in one Menu-Ribbon Bar DirectX for WinRT/C# since 2013! Taking over the world since 1371!

          1 Reply Last reply
          0
          • K Kevin Marois

            Here's a very good reason... If you put classes all inside a project, how do you replace just one class? Put "replaceable" code into their own projects and you get a separate DLL that you can swap out on the fly.

            If it's not broken, fix it until it is

            S Offline
            S Offline
            Super Lloyd
            wrote on last edited by
            #43

            What prevent you to replace the big DLL as well with a new version of it where just one class changed? Your "use case" need.... some elaboration...

            All in one Menu-Ribbon Bar DirectX for WinRT/C# since 2013! Taking over the world since 1371!

            1 Reply Last reply
            0
            • realJSOPR realJSOP

              This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              J Offline
              J Offline
              James Curran
              wrote on last edited by
              #44

              Because "utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions" should be the vast majority of your code. Your data layer should be in a separate assembly because you'll be using it in the public facing website and on your intranet admin tool. Your business logic should be in a separate assembly, because you'll be using it on the website, the desktop app, the command-line tool, and the mobile app.

              Truth, James

              1 Reply Last reply
              0
              • realJSOPR realJSOP

                This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                P Offline
                P Offline
                patbob
                wrote on last edited by
                #45

                Reusability. You can reuse the assemblies in another program without having to import all that code. Better yet, you can easily reuse only part of the code, picking and choosing which assemblies you need. Had to do exactly the above recently. We were able to leave out the parts of the code that required Windows UI libraries that don't exist on Linux yet through judicious choice of assemblies.

                We can program with only 1's, but if all you've got are zeros, you've got nothing.

                realJSOPR 1 Reply Last reply
                0
                • P patbob

                  Reusability. You can reuse the assemblies in another program without having to import all that code. Better yet, you can easily reuse only part of the code, picking and choosing which assemblies you need. Had to do exactly the above recently. We were able to leave out the parts of the code that required Windows UI libraries that don't exist on Linux yet through judicious choice of assemblies.

                  We can program with only 1's, but if all you've got are zeros, you've got nothing.

                  realJSOPR Offline
                  realJSOPR Offline
                  realJSOP
                  wrote on last edited by
                  #46

                  Cross-platform considerations are few and far between. I haven't had to write "cross-platform" code since 1989 using C++, and even then, we abandoned the effort after one application, even though (I thought) it turned out well.

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                  1 Reply Last reply
                  0
                  • realJSOPR realJSOP

                    This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                    -----
                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                    -----
                    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                    D Offline
                    D Offline
                    decaffeinatedMonkey
                    wrote on last edited by
                    #47

                    I used to be of the camp to have many projects in a solution, thinking of allowing for maximum re-usability of ALL the components, including the following: - Entity Types - Repository Types - Business Logic Types - Data Transfer Object Types - Web Application(s) - Desktop Application(s) Nowadays I structure my solution based on my designed deployment model. I try to work towards minimizing the number of projects, and currently my model is like the following: - Desktop Application Project - Desktop Application Installer Project - Web Application Project - Web Application Installer Project - Business Logic Public Contracts Project - Business Logic Platform Project(s) For the business logic public contracts library, this project would contain as much business logic as I can stuff in a platform agnostic manner (in a portable class library, for example). Typically DTOs are placed here, alongside public types that contain re-usable business logic. The platform-specific projects utilize the public contracts project. These kinds of projects will actually contain the database types, and will translate the DTOs to the underlying platform-specific data types.

                    1 Reply Last reply
                    0
                    • realJSOPR realJSOP

                      This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                      B Offline
                      B Offline
                      bjarneds
                      wrote on last edited by
                      #48

                      Namespaces relates to the logical organisation of the code. Assemblies relates to deployment, and can be governed by things like a plugin architecture, need for patch updates, versioning, reuse between different applications etc. That's two different things, just like in UML where you can have both a logical view and a deployment view.

                      1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                        -----
                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                        -----
                        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #49

                        At some point, the set of folders or namespaces cries out (to me) for its own DLL ... as when I'm dealing with unique hardware devices or third-party APIs. One also cannot have circular references with DLLs ... helps with keeping your "subject libraries" pure(r). (Finally, limits my ability to blow my foot off with a hasty "project-wide" code change).

                        1 Reply Last reply
                        0
                        • realJSOPR realJSOP

                          This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                          -----
                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                          -----
                          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                          K Offline
                          K Offline
                          Ken Hiatt
                          wrote on last edited by
                          #50

                          I come at this issue from an SCM viewpoint and while I think there are valid arguments to both separation and collapse, I tend to see many development efforts where the separation was based on how easy Visual Studio makes it. If the developers have discipline, this isn't necessarily a bad thing, but if not, you can quickly get spaghetti code. I personally believe that all other things being equal, fewer artifacts is better. There are circumstances where they should split, but I default to not creating an extra assembly. I'd recommend reading the 'White Book' Partitioning code base through .NET assemblies and Visual Studio projects found here: NDepend White Books[^] K.

                          1 Reply Last reply
                          0
                          • realJSOPR realJSOP

                            This discussion came up at work today, with pretty much everyone falling on the side of using multiple assemblies, but with no viable reason for doing it that way, and most of the time saying, "because I've always done it that way". Beyond utility methods or object extensions living in assemblies that could be added as a reference and that could be used throughout other solutions, what's the point of creating multiple assemblies when a thoughtful arrangement of folders in a single-project solution would be perfectly adequate? It even appears as if Microsoft intended for it to be this way. I suppose an argument could be made in a team environment to more clearly separate concerns and ease source control issues, but even that's kinda flimsy at the heart of it.

                            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                            -----
                            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                            -----
                            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                            K Offline
                            K Offline
                            Kiriander
                            wrote on last edited by
                            #51

                            The only point of multiple assemblies is if you want to use a part or parts of the projects in another environments. That is using shared libraries the way they've been used for decades now. Another reason would be if you want to run that stuff in a scalable cluster. One assembly does X, mutliple copies of the other assembly do Y and they communicate via some sort of IPC or network. Outside of creating libraries because I actually need a library and outside of clusters, I always go with folders & namespaces. Because there's no reason to break up a single-responsibility project into multiple binaries. It only makes deployment more complex (albeit not much more) without any benefits.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups