Search Results

Search found 5 results on 1 pages for 'roverred'.

Page 1/1 | 1 

  • Requriing static class setter to be called before Constructor, bad design?

    - by roverred
    I have a class, say Foo, and every instance of Foo will need and contain the same List object, myList. Since every class instance will share the same List Object, I thought it would be good to make myList static and use a static function to set myList before the constructor is called. I was wondering if this was bad, because this requires the setter to be called before the constructor. If the person doesn't, the program will crash. Alternative way would be passing myList every time. Thanks.

    Read the article

  • Help with design structure choice: Using classes or library of functions

    - by roverred
    So I have GUI Class that will call another class called ImageProcessor that contains a bunch functions that will perform image processing algorithms like edgeDetection, gaussianblur, contourfinding, contour map generations, etc. The GUI passes an image to ImageProcessor, which performs one of those algorithm on it and it returns the image back to the GUI to display. So essentially ImageProcessor is a library of independent image processing functions right now. It is called in the GUI like so Image image = ImageProcessor.EdgeDetection(oldImage); Some of the algorithms procedures require many functions, and some can be done in a single function or even one line. All these functions for the algorithms jam packed into ImageProcessor can be pretty messy, and ImageProcessor doesn't sound it should be a library. So I was thinking about making every algorithm be a class with a shared interface say IAlgorithm. Then I pass the IAlgorithm interface from the GUI to the ImageProcessor. public interface IAlgorithm{ public Image Process(); } public class ImageProcessor{ public Image Process(IAlgorithm TheAlgorithm){ return IAlgorithm.Process(); } } Calling in the GUI like so Image image = ImageProcessor.Process(new EdgeDetection(oldImage)); I think it makes sense in an object point of view, but the problem is I'll end up with some classes that are just one function. What do you think is a better design, or are they both crap and you have a much better idea? Thanks!

    Read the article

  • MVC Design Pattern to Combine Multiple Models for use

    - by roverred
    In my design, I have multiple models and each model has a controller. I need to use all the models to process some operation. Most examples I see are pretty simple with 1 view, 1 controller, and 1 model. How would you get all these models together? Only ways I can think of are 1) Have a top-level controller which has a reference to every controller. Those controllers will have a getter/setter function for their model. Does this violate MVC because every controller should have a model? 2) Have an Intermediate class to combine every model into a one model. Then you create a controller for that new super model. Do you know of any better ideas? Thanks.

    Read the article

  • Requring static class setter to be called before constructor, bad design?

    - by roverred
    I have a class, say Foo, and every instance of Foo will need and contain the same List object, myList. Since every class instance will share the same List Object, I thought it would be good to make myList static and use a static function to set myList before the constructor is called. I was wondering if this was bad, because this requires the setter to be called before the constructor? If the person doesn't, the program will crash. Alternative way would be passing myList every time.

    Read the article

  • EmguCV: Can't find ColorType abstract class

    - by roverred
    EmguCV ColorType wiki I'm trying to create a ColorType abstract class variable but it says the type or namespace does not exist. However I have access to the classes that extend it. I also tried adding all Emgu.CV libraries and have all the references and .dll files in the bin folder. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Drawing; using Emgu.CV; using Emgu.CV.Util; using Emgu.CV.GPU; using Emgu.CV.ML; using Emgu.CV.OCR; using Emgu.CV.OpenCL; using Emgu.CV.Stitching; using Emgu.CV.VideoStab; using Emgu.CV.Structure; using Emgu.CV.UI; using Emgu.CV.CvEnum; namespace mySpace { class foo { private ColorType the color; //invalid can't find ColorType private ColorType myColor = new Gray(); //invalid } } Any ideas? Thanks for any help.

    Read the article

1