Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. What's the responsibility of controller?

What's the responsibility of controller?

Scheduled Pinned Locked Moved C#
helpasp-netwinformsdesignbusiness
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    calendarw
    wrote on last edited by
    #1

    Hi, I have applying MVC pattern in windows forms application, but I got a problem that I am not clearly understand the usage of controller, for the application, I created a controller and fill in lots of functions to control different area of object, now, it became the "god controller"(same as god class with ~150 methods), but it doesn't contain business logic, it just perform the object creation, object flow between DAO and notify events for UI display in about five set of domain in an enterprise. Could anyone provide some guideline / hints to help for clearly understand the responsibility of controller? Thanks.

    C 1 Reply Last reply
    0
    • C calendarw

      Hi, I have applying MVC pattern in windows forms application, but I got a problem that I am not clearly understand the usage of controller, for the application, I created a controller and fill in lots of functions to control different area of object, now, it became the "god controller"(same as god class with ~150 methods), but it doesn't contain business logic, it just perform the object creation, object flow between DAO and notify events for UI display in about five set of domain in an enterprise. Could anyone provide some guideline / hints to help for clearly understand the responsibility of controller? Thanks.

      C Offline
      C Offline
      crrajaguru
      wrote on last edited by
      #2

      Model-Having Database codes.insert,retrieve data from database Controller- Get Values from view give it to Model & Get Data from Model Give it to View View - Display value and request controller...

      R RajaGuru

      C 1 Reply Last reply
      0
      • C crrajaguru

        Model-Having Database codes.insert,retrieve data from database Controller- Get Values from view give it to Model & Get Data from Model Give it to View View - Display value and request controller...

        R RajaGuru

        C Offline
        C Offline
        calendarw
        wrote on last edited by
        #3

        Some of that is already applied but the controller is too large, I think it contains a lot of "Get Data from Model and Give it to View" code in the controller. e.g. for payment, the view should load all PaymentMethod, all Branch and all division for user selection and bound the Payment object with Payment details, so the controller for this case contain GetAllPaymentMethod(), GetAllBranch(), GetAllDivision() for user selection Some of other part of the application contain more then three GetXXX() so it become too large, so I want to clarify about it. 1. Should controller handle object creation method? I have already separated a Factory Class for object creation, but should view directly call the factory or call the controller to create object from factory? 2. Should controller handle GetAllXXX() method for user selection? or let view call it directly? 3. Should controller handle flow between object and DAO? e.g. Update(Payment obj) { PaymentDao.Update(obj);} 4. Should controller provide interface for domain model method? e.g. ShipOrder(Order obj) { order.Ship(); orderDao.Update(order);} Thanks

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups