• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Dependency Injection - spaghetti atchitecture

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Dependency Injection - spaghetti atchitecture

    The project that I have the good fortune to have recently inherited is a right old can of worms.

    Now, I hear you say, the benefits of a loosely coupled architecture are boundless and, when properly done, conduce to an easily implemented testing framework.

    All well and good so far but, as a developer who has inherited a solution containing a gazillion factory classes, IoC container classes and interfaces I do have one small gripe.

    It's a complete mess. Whereas in the days of yore we'd complain of spaghetti code we now seem to have spaghetti architecture. Try looking for the class you're after that implements a particular interface (and herein lies my question). Visual Studio has no feature to allow one to find all classes that implement a particular interface in the same way as one can find all references to a particular type.Is there some kind of tool/add-on available for this purpose? I hope so because all this not being able to see the wood for the trees nonsense is likely to drive old Buggeridge doolally over the coming months.

    #2
    I really like the IOC approach, encourages small single purpose classes. However, I've also inherited a project with factory, adapter and bridge classes, it's a mare.

    I really don't understand why people don't keep it simple, I've also found when people have gone through the project with me they don't understand why they are using these patterns. Someone made a decision to do it a certain way now people just follow the same route.

    Resharper is pretty darn good at helping me navigate through the mess, so I can recommend it!

    Phew glad to get that off my chest.

    Comment


      #3
      Is there any UML?

      Comment


        #4
        Originally posted by Malcolm Buggeridge View Post
        ...Visual Studio has no feature to allow one to find all classes that implement a particular interface in the same way as one can find all references to a particular type.
        Yes it does. You use exactly the same method that you use to find all references to a Type to find all references to an Interface:

        Comment


          #5
          Originally posted by insur View Post
          Is there any UML?
          Lets hope not. It's bad enough writing unreadable spaghetti code in the name of making it testable without bringing indecipherable cave paintings written by people who imagined they were doing something technical into the equation.

          Imagine the house you lived in had all its furniture glued to the walls, and then when somebody asked why you did that your only answer was that it made it easier to confirm that the floorspace was still what you thought it was when you built the room. Then when you asked the architect to explain why that was so beneficial, they showed you a diagram that looked like a set of particularly terse Ikea instructions, containing a little stick man standing in the centre of a square with boxes stuck to the edge of the square.

          That's what making architectural decisions purely in the name of testability, then trying to explain your decision using UML is like.

          Comment


            #6
            Originally posted by Malcolm Buggeridge View Post
            The project that I have the good fortune to have recently inherited is a right old can of worms.

            Now, I hear you say, the benefits of a loosely coupled architecture are boundless and, when properly done, conduce to an easily implemented testing framework.

            All well and good so far but, as a developer who has inherited a solution containing a gazillion factory classes, IoC container classes and interfaces I do have one small gripe.

            It's a complete mess. Whereas in the days of yore we'd complain of spaghetti code we now seem to have spaghetti architecture. Try looking for the class you're after that implements a particular interface (and herein lies my question). Visual Studio has no feature to allow one to find all classes that implement a particular interface in the same way as one can find all references to a particular type.Is there some kind of tool/add-on available for this purpose? I hope so because all this not being able to see the wood for the trees nonsense is likely to drive old Buggeridge doolally over the coming months.
            Download the Resharper 30 day free trial and it might help you unravel everything.

            It's a great tool and worth the license fee for the many features it has.

            Comment


              #7
              There are a lot of people using these frameworks who do not have a clue how to design quality OO software.

              I am maintaining 3 very poorly written spring appilcations just now, each one contains a whole bunch of anti patterns. The thing is the people who write them do not have a clue how crap their work is. They have written bucket loads of meaningless tests and they think that makes it a well engineered solution.

              I don't help, I smile and tell them they are fantastic so they keep hiring a paying invoices every month.

              Comment


                #8
                Originally posted by minestrone View Post
                There are a lot of people using these frameworks who do not have a clue how to design quality OO software.

                I am maintaining 3 very poorly written spring appilcations just now, each one contains a whole bunch of anti patterns. The thing is the people who write them do not have a clue how crap their work is. They have written bucket loads of meaningless tests and they think that makes it a well engineered solution.

                I don't help, I smile and tell them they are fantastic so they keep hiring a paying invoices every month.
                Yes, that's pretty much the problem. Too many people think that if Martin Fowler did it once, then it must be the right thing to do in every single situation. They don't realise that they're merely attempting to use somebody else's Golden Hammer.

                Regularly, you find that people go to all the trouble of implementing Dependency Injection, Inversion of Control, etc., etc., then they don't even do any of the unit testing all of ass-backwards Yoda code was meant to support! And, of course, their solution invariably doesn't work reliably or do what users actually needed, because they've been too busy trying to be too clever with the design instead of focusing on those more fundamental concerns.

                You're right that it is easier, and more lucrative, as a contractor just to nod, smile and play along whenever you get some misguided bob at a client that thinks their code is great whilst in fact it's just a mess. However, I prefer to at least try and explain that there's a better way, and to be professional but to walk away if they choose not to listen to good sense.

                It's not that I can't do things the hard way when and if I need to just to make a buck, or because somebody's ego can't take being told the truth about their misguided approach. I just find it's better for my sanity if I don't try to. I regularly find that the financial statements of organisations that make these mistakes tell a tale when you check them out some time later with Company Check. If they don't learn from speaking with outside developers about their approach, they certainly will learn from the effect on their bank balance and bottom line further down the line.

                Comment


                  #9
                  +1 for Resharper.

                  ALT + F7 or CTRL+SHIFT+ALT+B to find all implementations.

                  GE

                  Comment


                    #10
                    Originally posted by Gentile View Post
                    Yes it does. You use exactly the same method that you use to find all references to a Type to find all references to an Interface:

                    Oh, Thankyou wery much Rachel. I shall give that a whirl in the morning. Incidentally, what's the menu command for this action?

                    Edit: And thanks to those of you who recommended resparker. I'll download the trial tomorrow.
                    Last edited by Malcolm Buggeridge; 22 July 2012, 21:27.

                    Comment

                    Working...
                    X