locked
Best Applicable Patterns for below type of COM RRS feed

  • Question

  • User-1401876114 posted

    Hello - I want to redesign few components which I feel has unnecessary calls and make them fit in a systematic way. Please find the below code which is the current way.

    //Base Interfaces has about 10 methods
    
    interface IQuotation
    {
    Create();
    Update();
    Get();
    Display();
    ...
    ...
    ...
    }
    
    // There are about 10 odd Projects in same solutions. Hence all the classess may or may not consume the interfaces
    
    // Project A class Mark: IQuotation { void Create() { //some action var x = a + b; } Update() { //do nothing } } //Other class(es) from different Project - Say Project B
    Class Population: IQuotation { void Create() // Similar Method { //some action var x = a + b; // Similar Task var y = x + 10; } } ... ... Like Wise other 8 Classes from Different Projects

    Question

    1. I have many methods in Interface and many Classes from different projects consume it. Hence what could be the best way to re-write it?
    2. As methods are similar, what best pattern could be applied?
    3. Need to take out all methods and classes from all projects and make it under one roof. How this can be achieved.

    Please advise as I am bit new to Architecture.

    Thanks

    Thursday, August 16, 2018 8:15 AM

All replies

  • User475983607 posted

    I have many methods in Interface and many Classes from different projects consume it. Hence what could be the best way to re-write it?

    I'm a bit confused... What do you expect as an end results?  

    As methods are similar, what best pattern could be applied?

    An Interface is a good choice for organizing methods.

    Need to take out all methods and classes from all projects and make it under one roof. How this can be achieved.

    Under one roof?  You mean place all the code in a single project?  

    IMHO, this is not an appropriate forum question.  You're asking forum members that cannot see the code or understand the current design to comment on a new design approach that has no requirements.  I suggest that you meet with your team and discuss your intentions and why you feel the code needs a redesign.

    Thursday, August 16, 2018 11:23 AM
  • User-1401876114 posted

    Very simple.... I have posted asked best practices for using applicable design patterns. I hope this is the right forum.

    Let me again simplify it. There are more than 10 class libraries(project for every library in VS) hence questions pertaining to it.

    1. There are multiple methods with same name implemented from Interface. Hence all these 10 CL which has one method each consuming it. Now is there any way to accomplish to implement a pattern or strategy for common functionality? (means every method has some similar operation
    2. The classes are tightly coupled(these 10 CLs). How can this be take off to be losely coupled under given code scenario

    Let me know if this is clear?

    Shreenidhi

    Thursday, August 16, 2018 11:47 AM
  • User475983607 posted

    Very simple.... I have posted asked best practices for using applicable design patterns. I hope this is the right forum.

    No, you are asking a community unfamiliar with an application design to comment on an approach to fix an unknown problem.

    There are multiple methods with same name implemented from Interface. Hence all these 10 CL which has one method each consuming it. Now is there any way to accomplish to implement a pattern or strategy for common functionality? (means every method has some similar operation

    Yes, as stated clearly and openly above, interfaces are used to organize methods - methods with similar operations.  Using Interfaces is a common in a repository pattern.  Interface are also common in Domain driven Design patterns that use services to implement business operations.

    The classes are tightly coupled(these 10 CLs). How can this be take off to be losely coupled under given code scenario

    There is no indication of tight coupling, as a matter of fact the code shown it is quite the opposite.

    Let me know if this is clear?

    You still have not explained the problem or expected results.

    Thursday, August 16, 2018 12:51 PM
  • User-1401876114 posted

    I have tried to explain how much I can by giving code snippet, as I cannot literally explain the whole thing here. Let's see if I can get some response

    Shreenidhi

    Thursday, August 16, 2018 2:29 PM