Thread: Question about Separating Presentation Layer from Business Logic

  1. #1
    Set Apart -- jrahhali's Avatar
    Join Date
    Nov 2002
    Posts
    256

    Question about Separating Presentation Layer from Business Logic

    In my programming class, my teacher said that often in production code, there is a layer of abstraction that sits between the presentation layer and the business logic layer. Is this true? If so, why would you want to do this? To me it seems redundant. For example, to access methods from your business logic layer, you would have to go through a middle layer when you just could have accessed them directly. In either scenario, the business logic layer doesn't need to know anything about my GUI.

    So it's either GUI -> middle -> business logic OR
    GUI -> business logic

    To give a real example, my assignment is to develop a game similar in concept to D&D. I have my business logic classes which i instantiate in my GUI, and use as necessary. They return information I need to update the GUI. My teacher said it would be better to have my GUI classes, and a 'Game' class which sits between my GUI and business logic classes.

    Thanks in advance.
    Clear the mines from our Shazbot!
    Get the enemy Shazbot!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Model

    For your game for example, you could write separate "Windows" and "Linux" GUI components, and leave the bulk of the game alone.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Set Apart -- jrahhali's Avatar
    Join Date
    Nov 2002
    Posts
    256
    Thanks Salem, that helped.
    Clear the mines from our Shazbot!
    Get the enemy Shazbot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Boundary layer.
    By sunish5 in forum C Programming
    Replies: 3
    Last Post: 10-28-2010, 09:41 PM
  2. neural nets input layer question
    By jianna in forum General AI Programming
    Replies: 3
    Last Post: 04-29-2009, 11:11 AM
  3. Design layer question
    By mdoland in forum C# Programming
    Replies: 0
    Last Post: 10-19-2007, 04:22 AM
  4. logic question
    By Roy01 in forum C++ Programming
    Replies: 5
    Last Post: 12-09-2006, 09:02 AM
  5. logic question...
    By rox in forum C++ Programming
    Replies: 1
    Last Post: 04-01-2004, 10:03 AM