MVC controller class too big, refactoring suggestions please

Currently I have an application using the MVC pattern. The controller class contains implements methods from 6 different interfaces. There will be 1 controller class per user role and there is a lot of common code between the users. I can't pull up common code to the controllers' super class because there is very little code that is common to all 4 controllers, however most of the code is common to 3 or 2 controllers.
Can anyone think of a good way to avoid duplicating code without creating a lot of extraneous classes and complicating the structure? After thinking about several solutions, I'm starting to lean towards just copy pasting the code into three classes and not caring that I'm duplicating code.
Yours forever in sickness and in health,
Mr. Kayaman the Magnificent

Without seeing your design in greater detail I can only make some fairly generic recommendations.
1. More smaller modular pieces is easier to work with than fewer large monolithic pieces.
2. Consider what a controller class is supposed to do. At its foundational level, it's a traffic cop. It directs traffic. As such, migrate functionality to model components where it belongs.
3. Just at a glance, it sounds like it might be a candidate for an AbstractFactory pattern.
4. In general terms I am opposed to copy/pasting code in any form. That's not to say it's never done, just that I'm resistant to that as a course of action.
Just my thoughts on the subject.
Currently I have an application using the MVC pattern.
The controller class contains implements methods from
6 different interfaces. There will be 1 controller
class per user role and there is a lot of common code
between the users. I can't pull up common code to the
controllers' super class because there is very little
code that is common to all 4 controllers, however most
of the code is common to 3 or 2 controllers.
Can anyone think of a good way to avoid duplicating
code without creating a lot of extraneous classes and
complicating the structure? After thinking about
several solutions, I'm starting to lean towards just
copy pasting the code into three classes and not
caring that I'm duplicating code.
Yours forever in sickness and in health,
Mr. Kayaman the Magnificent

Similar Messages

  • Text/icons/window/ALL too big!  Help please

    I'm brand new to the world of mac and have little experience troubleshooting. For whatever reason, only God knows, all that i view on this screen is too big. i tried changing the resolution, restarting, EVERYTHING in system utilities, command + scroll (for zoom) and nothing seems to work.
    Any help would be great!
    thanks

    Thanks Poikkeus but it doesn't seem to be a resolution issue. I've tried all options in res and nothing seemed to work. The dock size hasn't changed, but all else is enlarged. The toolbar text, the windows when I open them. In fact, they're so big that I can't see all the information on a window when it's open.
    Any other ideas?

  • I am having trouble with a video.  I have tried to copy it to a flash drive because it is too big to fit on a DVD, it says it is too large for the volumes format.  Please advise.

    I have done many DVD's for seniors for graduation so I am familier with Imovie.  I have just finished a projec that is a combination of video, music and stills.  I shared it through idvd.  Now I can't burn it to a dvd because it is too large.  It is too big even for a two sided disk.  I have researched it and i find that blue ray would be big enough.  Does apple offer  blue ray burner?  if so, what is the cost?  I tried another route and took my external hard drive to copy it to a PC.  there computer wouldn't recongize my drive.  I am assuming it is because it is formated for apple.  I tired copying it to a flash drive and and it says that it can't be copied because it is too large for the volume's format.  Suggestions?   PLEASE!!!!!

    Could the video be too big because of using too high a resolution?   480p is sufficient for a DVD.  the thread at:
    https://discussions.apple.com/thread/5868958?tstart=30
    may be of help.
    Apple does not support Blue ray - you have to use a thrid party application like Toast.
    To transfer the video to a PC you need a FAT-formatted hard drive (or of course a sufficiently big memory stick).
    You could also go via a network, via the cloud (eg Dropbox) or with 'Wetransfer" or similar.
    Geoff.

  • My macbook pro hard drive went bad and i bought a new one and installed it. Now i have the old corrupted hard drive in my hand and i am looking to recover my files from it, any suggestions please? too bad i never backed them up.

    My macbook pro hard drive went bad and i bought a new one and installed it. Now i have the old corrupted hard drive in my hand and i am looking to recover my files from it, any suggestions please? too bad i never backed them up.

    After you have installed the OSX on the new HDD in your MBP, install the old HDD in an enclosure and connect it to your MBP via USB.  Then try to drag and drop  your data to the new HDD. 
    If this proves unsuccessful, you may look for data recovery software on the Internet.  There will be free trails to see if it will work or not.  If the trial suggests that it will work, then you will have to purchase the software.
    The last resort is a professional data recovery service that will offer NO guarantees and charge a lot of money.
    As you now can appreciate, backups eliminate such predicaments.
    Ciao.

  • Why is itunes too big for my screen? i'm on the highest resolution. i'm on windows 7 on a sony vaio ! please help !!

    why is itunes too big for my screen? i'm on the highest resolution. i'm on windows 7 on a sony vaio ! please help !!

    Resize it.

  • Purchased episodes of The Killing Season 2 and tried on both ipad and computer - ipad can't download (too big maybe) and computer (Numb) is missing and others are not in sync.  Downloaded most recent itunes.  Help please.

    Purchased the first four episodes of The Killing Season 2 and am so frustrated.  Tried downloading on both my computer and iPad.  Think they might be too big for iPad - says it's downloaded but can't open even though GB says there is enough.  Am missing episode (Numb) on my computer and the ones that I have downloade to computer are not in sync with sound.  Have downloaded newest version if iTunes.  Please help.

    Here's how to do it.
    1. App Store, iTunes Store should have the same AppleID on Computer and iPhones. (Free to share apps, music and books... )
    2. Person A uses the same purchasing account for everything (ie. email, contacts and ...).
    3. Person B have the same purchase account see no. 1 (for App Store and iTunes Store) but create a second AppleID for iCal, e-mail, contacts  and etc.

  • I have a few wedding projects(1-2 hours)I am trying to export at full hd quality,than burn in idvd.After rendering for 8hrs I receive error code that states "file is too big". Please help? compressing tips without losing quality?

    I have a few wedding projects(1-2 hours)I am trying to export at full hd quality,than burn in idvd. After rendering for 8hrs I receive error code that states "file is too big". Please help? compressing tips without losing quality? or any other exporting alternatives?

    Hey Z,
    Thank you for the tip on exporting by media browser (large) from imovie. But of course, if it's not one thing it's another. Now that I figured how to export a large file from imovie, I have an idvd issue. I followed the instructions for burning from idvd and changing the encoding to professional quality and the burn speed to x4, but I am receiving an error that states the following,
    Your project exceeds the maximum content duration. To burn your DVD, change the encoder setting in the Project Info window.
    Project:
    - total project duration: 79:04 minutes
    - total project capacity: 4.327 GB (max. available: 4.172 GB)
    Menus:
    - number of menus in project: 1 menus
    - total menu duration: 0:39 minutes
    - total menu capacity: 37.370 MB
    Movies:
    - total movies duration: 78:25 minutes
    - total movies capacity: 4.291 GB
    I have searched in the idvd forum for similar issues and I am stumped at this point. I have tried deleting the encoding assets and re launching idvd with the changed preferences, and still the same error. I know you mentioned something about free hard drive space available, and I have very little left. 4GB to be exact due to massive hours of non-edited footage. I am not sure if this is why, but I do not recall ever needing free space to burn memory onto a separate dvd. I would be more than happy if I am wrong, and it would be a quick fix. Otherwise, the technical nightmare continues. It's all a learning process and your expertise is greatly appreciated! Thanks in advance.

  • Scanning: The image size is too big. Please reduce the image height, width, resolution, scaling or output type.

    Good Day.
    I have recently discovered an issue with scanning.  I have tried scanning straight from the printer, through image capture, and through preview.  All yeilding the same results since they are essentailly kicking off the same scanning applet.  I can scan a jpeg formatted file as long as I applet is in the "Hide Details" mode.  If I click on the "Show Details" button, which I need to do to scan to PDF, I immediately receive an error stating: The image size is too big. Please reduce the image height, width, resolution, scaling or output type.
    I'm currently using an HP C5180 printer.   The most recently installed software was Adobe Digital Editions (I installed this to read an on-line e-book).  Not sure if there is any correlation.    Thanks for any help.
    Mac details are:
      Model Name:          MacBook Pro
      Model Identifier:          MacBookPro8,1
      Processor Name:          Intel Core i5
      Processor Speed:          2.3 GHz
      Number of Processors:          1
      Total Number of Cores:          2
      L2 Cache (per Core):          256 KB
      L3 Cache:          3 MB
      Memory:          8 GB
      Boot ROM Version:          MBP81.0047.B27
    Printer access log:
      Source:          /var/log/cups/access_log
      Size:          174 bytes
      Last Modified:          11/21/12 10:09 PM
      Recent Contents:          localhost - - [21/Nov/2012:22:09:16 -0500] "POST / HTTP/1.1" 200 61628 CUPS-Get-PPDs -
    localhost - - [21/Nov/2012:22:09:20 -0500] "POST / HTTP/1.1" 200 61628 CUPS-Get-PPDs -
    Image Capture Support:
      Image Capture Support:
      Path:          /Library/Image Capture/Support/Hewlett-Packard/Devices/HPAiOScan.bundle/Contents/Info.plist
      Version:          2.3.0
      Path:          /Library/Image Capture/Support/Hewlett-Packard/Devices/HPAiOScan.bundle/Contents/Resources/Dev iceInfo.plist
      Version:          2.3.0
    Photosmart C5100 series:
      Status:          Idle
      Print Server:          Local
      Driver Version:          4.0.0
      Default:          Yes
      Shared:          No
      URI:          dnssd://Photosmart%20C5100%20series%20%5B960B9E%5D._pdl-datastream._tcp.lo cal./?bidi
      PPD:          HP Photosmart C5100 series
      PPD File Version:          4.0.0
      PostScript Version:          (3011.104) 0
      CUPS Version:          1.6svn (cups-327)
      Scanning support:          Yes
      Scanning app (bundleID path):          -
      Scanning app version:          -
      Scanner UUID:          CC8DD435-CC8D-D435-CC8D-D435CC8DD435
      Printer Commands:          ReportLevels
      CUPS filters:
    Inkjet:
      Path:          /Library/Printers/hp/cups/Inkjet.driver/Contents/MacOS/Inkjet
      Permissions:          rwxr-xr-x
      Version:          4.0.0
    commandtohp:
      Path:          /Library/Printers/hp/cups/filters/commandtohp.filter/Contents/MacOS/comman dtohp
      Permissions:          rwxr-xr-x
      Version:          2.1.1
      Fax support:          No
      Printer utility:          /Library/Printers/hp/Utilities/HP Utility.app
      Printer utility version:          5.9.1
      PDEs:
    PDE.plugin:
      Sandbox compliant:          Yes

    Hello Sig
    The scanner works with a Windows computer, which proves the device is functional at a cursory level. The drivers are now distributed by Apple and this is an Apple computer. There is no scanning software provided by HP. HP's answer is that Mountain Lion takes care of all of this.  I anticipate that some setting or driver was somehow tweaked since the scanner had been working with Mountain Lion until a few days ago.  The device in question is an Apple product. So, I'm pretty confident that I'm in the right place.
    Regards

  • My screen suddenly zooms too big w/o me touching anything.  Please help. I recently "upgraded" to Mountain Lion on my iMac

    My screen suddenly zooms too big without me touching anything (i.e. mouse or keyboard).  I can't reduce it.  Part of the menu reappears when I click at the very top, but I can't even get the red-yellow-green buttons to show.  I recently "upgraded" to mountain lion.  Did not have this problem in the past.  My settings appear to be correct.  Any suggestions?

    Hi, have you tried setting a different rez in thje Disply Pref Pane of System Prefs?
    Do those things show if you Safe Boot from the HD, (holding Shift key down at bootup)?

  • Burn to DVD folder - too big to burn to DVD - Options please?

    I burned a large project to a DVD folder as PAL. I was able to burn that folder (VIDEO_TS) to a DVD using Nero without a problem.
    I then needed an NTSC version. I burned the same project to a folder as NTSC. I don't remember seeing any warning messages.
    When I tried burning the NTSC folder to a DVD with Nero, Nero complained it was too big to fit on the DVD. I imagine the over-sized burn is because of the higher frame rate of NTSC (30 vs 25).
    Question is: What are my options? I prefer not to use dual layer DVD's, and I prefer to burn to folder out of PE4 then use Nero or other to burn the actual DVD. I also don't want to cut out any of my source clips.
    I should say that I'm not overly concerned about final quality, so if I can simply use a lower bitrate or whatever, where is the best place to set that?
    (Edit) - Note that I had the check box checked that says "Fit Contents to Available Space", and it suggested 4.38Gb required. Did this not work because it is perhaps impossible for PE4 to forcast the exact requirement??
    Thanks,
    Dave

    Dave JM,
    If you took your project on the Timeline, sent it to Share, Disk and were in the DVD Burn area with the Burn to = Folder (4.7)....
    1. You did change the preset from DV PAL to DV NTSC?
    2. After you did that, you did have checked "Fit Contents To Available Space" and then said that it said 4.3 GB space required. Equally important, what was the Bitrate after it said 4.3 GB space required? I would like to know just how much lower it was than the High value 8.
    3. You say that you did not get any warning, such as one related to Data Rate??
    Also, when you made the Presets switch from DV PAL to DV NTSC, did you see any change in the Space Required and/or Bitrate that was shown in the Burn Area?
    If you did not, might it not be reasonable to look into the Nero Burn Video Files route more closely? I am just speculating that Nero Burn Video Files route might have different space required criteria?????
    It is not clear to me why you would get the job done using PAL and not NTSC? I might suggest that you look at the PAL/NTSC bitrate comparison in Premiere Elements and, if indicated, lower the NTSC bitrate to reduce the space required to one that works for Nero. The Quality is going to suffer. By lower, I mean the smallest possible changes to reach the goal.
    I know that you do not want to, but have you tried the Burn to Disc route for this NTSC project, just to see if it would work at all?

  • The font for my yahoo log in is very very small anbd my email fonts are far too big and the words overlap, please help to correct this problem

    The font for sign into my yahoo mail is so small that I am unable to make out my ID and password and when I do get into my mailbox, the fonts are far too big and the words overlap. Tried going into tools /options to make changes but not successful, please help.thanks

    Reset the page zoom on pages that cause problems, make sure that the window is not maximized:
    *<b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    *http://kb.mozillazine.org/Zoom_text_of_web_pages
    If you have increased the minimum font size then try the default setting "none" as a high value can cause such issues.
    *Tools > Options > Content : Fonts & Colors > Advanced > Minimum Font Size (none)
    Make sure that you allow websites to choose their fonts.
    *Tools > Options > Content : Fonts & Colors > Advanced > [X] "Allow pages to choose their own fonts, instead of my selections above"
    You can use an extension to set a default font size and page zoom on web pages.
    *Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/
    *NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/

  • I started to download a free app but it's too big to load without connecting to wifi. I want to delete it. Can anyone tell me how to do it please?

    I tried to download a free app. It came up with an error message saying it was too big to download and that I need to connect to WiFi. The icon is still displayed and I can't delete it (I've decided I don't want it. Can anyone tell me how to delete it - there's no x displayed on the icon. Thanks

    Hi stripers
    You will either a) need to connect to WiFi and complete the download or b) dock your iPad and remove it from the apps list once synced (your iTunes will more then likely want to complete the download first also, which you may be able to cancel in the downloads section).
    Regards
    Damon

  • MVC: Tell a controller class which controller called it

    I have to controller pages (page1.do and page2.do) that both shall use the same controller class (CL_CTR).
    Can I tell in DO_REQUEST of the controller class whether page1.do or page2.do called the controller class?

    Hi Daniel,
    To call page1(2).do's from do_request you first put the following in DO_INIT.
    data:  page1details type ref to cl_bsp_controller2.
    page1details ?= create_controller( controller_name = 'page1details.do'
                                        controller_id = 'subcntlr1_id' ).
    similarly you should do the same for page2.
    Then in DO_REQUEST.
    data: subcontroller1 type ref to cl_bsp_controller2.
    subcontroller1 ?= get_controller( controller_id = 'subcntlr1_id' ).
      call_controller( subcontroller1 ).
    I hope this helps.
    If it doesn't work let me know.
    Regards
    Amit
    Message was edited by: amit kumar

  • Calling an MVC controller from a BSP

    Hello,
    I'm trying to call an MVC controller from a BSP (Page with flow logic) using bsp:call / bsp:goto and am also passing a parameter. There are two problems:
    - parameter is not available to the do_init method of the controller class but is available to the do_request method
    - do_init is being called at every event (button click, dropdown etc.)
    I've checked that my BSP application, controller and bsp page are all set to stateful (with lifetime = session where applicable).
    Please suggest what I can do in this case?
    Thanks and regards.
    Rajendra Tewani

    for the precise solution the exceprts :
    in the DO_REQUEST method of the controller class just use
    <variablename> = request->get_form_field( '<url param name>' ).
    suppose the url is init.do?node=ABC to read the value within the controller
    data: nodevar type string .
    nodevar = request->get_form_field( 'node' ).
    with due thanks to raja for this

  • Cannot locate custom controller class after applying OIE.K  patch.

    Hi,
    I am trying to search all the region level personalizations(on Update Allocations Page in iExpenses while creating Expense Reports) to find out where our custom controller class is being called(it was personalized at site level). But no luck until now.
    Nevertheless, we were able to locate our custom controller class in an instance where the OIE.K oracle patch was not applied. Seems like after applying this patch, the seeded region names are changed too. Our custom code also works but cannot figure out where our CO is being called.
    Any suggestions please?
    Thanks,
    Swati.

    Guys,
    Using "About the Page" link on UpdateExpenseAllocationsPG, I found SplitCriteriaTblCO controller class instead of UpdateKffCO class, that was extended to HumUpdateKffCO custom class.
    Our custom code is still intact even though we do not find our custom CO. Probably we have to look elsewhere to find it, no idea!.
    I just need to know how to remove our iExpense extension. In order to remove the iExpense extensions in the instance where the OIE.K was not applied, we just removed the personalization at site level, where the controller HumUpdateKffCO was called and that took care of it.
    --Swati.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Optiplex 9020, Intel 4600 + AMD video card = bluescreens and other issues for dual monitors

    Our organization purchased a number of 9020s with the onboard Intel and the AMD 8490 Over time, many of these systems would experience video issues.  Originally they were configured with one monitor was plugged into the intel VGA and the 2nd monitor

  • Create Multiple Pie Charts with Drill Down capability(foreach in mainreport

    Hello All, i need to create a report with 4 pie charts, which should have drilldown capability. i tried to do that, and i can do only for two charts. i need for the rest 2 also. Please help. Thanks

  • How to load XML file to DB

    Hi All, My requirement is I have a XML file, its data should be stored in Database. Below is the sample XML file. <?xml version="1.0"?> <PaymentInfoMessageResponse> <PaymentInfoResponse> <TransactionType>940</TransactionType> <SequenceNum>04</Sequenc

  • CF8 ODBC performance issues w/ SQL 2K5

    Problem: A basic "select *" query returning 5 rows is taking a little over 5000ms. Platform: Vista Business, CF8 Developer, MS SQL 2K5 Developer SP2, ODBC Socket using trusted connection I ran a query against cfartgallery without any performance prob

  • Seemingly simple, yet annoying reg. expression issue

    Hey guys, Im considerably familiar with the use of regular expressions in Java (and other languages), yet seem to be having a very simple problem. I wish to match a full stop character occuring after a space in a string, once that space does not occu