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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Design and Architecture
  4. n-Tier Design Question

n-Tier Design Question

Scheduled Pinned Locked Moved Design and Architecture
designquestioncsharpmobilewpf
4 Posts 3 Posters 1 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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I'm working on a busisness app for a client. Right now it's a WPF app. I have the UI layer, the BL, and the DAL. 99% of the BL just passes the call to & from the UI/DAL. Now, I'm going to be introducing a Tablet piece. In the WPF app's ViewModels I have a Validate method which checks to see if the required fields are filled in, and also some business logic. One example is "You cannnot save a Job if the Approiver has not been set" So, in the tablet app, I'm going to want to do the same logic.... when the user clicks Save, validate required fields and apply business rules. So It seems to me that the BL is a good place for this. However, its also seems that passing all the data across the web to a Web API, only to have it rejected in the BL, isn't right. Is this the right approach?

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    Richard DeemingR T 2 Replies Last reply
    0
    • K Kevin Marois

      I'm working on a busisness app for a client. Right now it's a WPF app. I have the UI layer, the BL, and the DAL. 99% of the BL just passes the call to & from the UI/DAL. Now, I'm going to be introducing a Tablet piece. In the WPF app's ViewModels I have a Validate method which checks to see if the required fields are filled in, and also some business logic. One example is "You cannnot save a Job if the Approiver has not been set" So, in the tablet app, I'm going to want to do the same logic.... when the user clicks Save, validate required fields and apply business rules. So It seems to me that the BL is a good place for this. However, its also seems that passing all the data across the web to a Web API, only to have it rejected in the BL, isn't right. Is this the right approach?

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      I'd be inclined to have a shared class library of DTOs used to communicate with the API, and put the validation in there. Then have the UI view-models delegate as much of the validation to the DTO as possible.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      K 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        I'd be inclined to have a shared class library of DTOs used to communicate with the API, and put the validation in there. Then have the UI view-models delegate as much of the validation to the DTO as possible.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        Richard Deeming wrote:

        I'd be inclined to have a shared class library of DTOs used to communicate with the API, and put the validation in there.

        That would be fine if the only issue were missing property data. The DTO'scould validate themselves. But in the case of business logic, there are times when you would need to go to the data. Plus, putting the validation in the logic means that the DTO's can only be used in that app. If you then created another app that uses the same data, then the DTO's are now housing logic specific to the first app. The second app may not require the same validation. IMHO, DTO's should be dumb objects that do nothing but carry data.

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        1 Reply Last reply
        0
        • K Kevin Marois

          I'm working on a busisness app for a client. Right now it's a WPF app. I have the UI layer, the BL, and the DAL. 99% of the BL just passes the call to & from the UI/DAL. Now, I'm going to be introducing a Tablet piece. In the WPF app's ViewModels I have a Validate method which checks to see if the required fields are filled in, and also some business logic. One example is "You cannnot save a Job if the Approiver has not been set" So, in the tablet app, I'm going to want to do the same logic.... when the user clicks Save, validate required fields and apply business rules. So It seems to me that the BL is a good place for this. However, its also seems that passing all the data across the web to a Web API, only to have it rejected in the BL, isn't right. Is this the right approach?

          If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

          T Offline
          T Offline
          TimWallace
          wrote on last edited by
          #4

          It is generally a bad practice not to validate one's data that has been sent via the internet to an API before committing to a repository/database. If the volume of data being transmitted results in a sluggish UI, perhaps the core design is incorrect and should be reevaluated.

          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