• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re:designing beyond MV and (one) C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:designing beyond MV and (one) C


  • Subject: Re:designing beyond MV and (one) C
  • From: Shripada Hebbar <email@hidden>
  • Date: Mon, 14 Jan 2008 16:38:52 +0530

On 12.01.2008, at 23:39, Daniel Child wrote:
I'm building a utility to take various types of data and parse them
according to my settings. I'm looking to have an introductory window
that asks what type of file the user wants to parse. Then based on
the response, I open the appropriate window to gather data about the
file to be handled. Separate interfaces will be used for the
different types of parsing operations.

In the MVC paradigm, do you typically use a different controller for
each major interface? Should I have three controllers, one to handle
each type of parser? Three window controllers, to handle each major
settings interface?

Look into the 'strategy' design pattern. All that you can do is have a single controller with appropriate
strategy for each of the file type use different strategies dynamically for parsing them.


http://en.wikipedia.org/wiki/Strategy_pattern

I would propose a solution something like this:

A ParserController class. This will dynamically associate with a subclass of an abstract 'ParsingStrategy'
class. Lets imagine that we are parsing an RTF, a DOC and a PDF file. What I would have is classes: RTFParsingStrategy,
DOCParsingStrategy and PDFParsingStrategy - all are subclasses of ParsingStrategy. And each of these parsing strategies
will associate with appropriate window controllers of their own to facilitate the necessary UI. I recommond having one window controller
per window. ParserController can also act as the window controller for your 'Entry UI'. The same can have intelligence to decide which
strategy at runtime. This design makes it extremely flexible to add new strategies as you introduce new file types.



Regards Shripada

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Deleting all objects from Core Data store
  • Next by Date: Re: NSImage initWithPasteboard:
  • Previous by thread: Re: designing beyond MV and (one) C
  • Next by thread: designing beyond MV and (one) C
  • Index(es):
    • Date
    • Thread