Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I know that it would be better style to split the class up, but I am using it in combination with commercial code that I can't change...</p> </blockquote> <p>I may be missing more background to your specific situation but regardless of what third-party code you are using, you should be able to do whatever you want with your code that you wrote and it sounds like you wrote a lot.</p> <p>You recognized your class is too big so next step is to break it apart into separate, more cohesive classes. Attempting to create other files/functions that simply modify the internal state of your one class that's already big, will make the code even bigger and you will spaghetti it up even more than it is now.</p> <p>If the third-party library needs to operate with a single class that you writing, take a look at Facade design pattern. You can easily have what "looks like" a complex class to the outside, but internally it simply delegates the work any number of more specialized classes.</p> <p>If you want one class to have access to a third-party library, you can do that too. Take a look at something such as Adapter design pattern.</p> <p>Another advice I can offer is pick up <a href="http://rads.stackoverflow.com/amzn/click/0201485672" rel="nofollow">this book on refactoring</a>. It'll show you how you can take any code that looks way too complex and methodically apply steps to make it much more readable and maintainable. For example take a look at your data members, do any of them look like they belong to one group (i.e. they are often accessed/modified together)? If yes, consider moving them into their own class which provides minimal interface for getting/setting only what your main class needs.</p> <p>This post doesn't answer your specific question, but take a step back, maybe there's a much better solution than breaking OO rules and good design principles just because of some constraints which may not really be there.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload