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. Web Development
  3. ASP.NET
  4. Declarative vs Programmatic: opinions

Declarative vs Programmatic: opinions

Scheduled Pinned Locked Moved ASP.NET
visual-studiosysadminquestiondiscussion
4 Posts 4 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.
  • B Offline
    B Offline
    Brad Tumer
    wrote on last edited by
    #1

    I have an ongoing debate with a co-worker about the merit of using server controls or code-behind for data, and I thought I'd post here for other people's opinions. I use SqlDataSources bound to controls, whereas he puts labels on the page and does everything in the code. (Oh, and I use stored procedures and not text commands, which I feel suffices for a DAL in small apps, so let's skip that argument.) I like it because it seems cleaner, faster, more concise, and gives access to the control events so work can be done at the appropriate time. Which do you prefer and why?

    N R 2 Replies Last reply
    0
    • B Brad Tumer

      I have an ongoing debate with a co-worker about the merit of using server controls or code-behind for data, and I thought I'd post here for other people's opinions. I use SqlDataSources bound to controls, whereas he puts labels on the page and does everything in the code. (Oh, and I use stored procedures and not text commands, which I feel suffices for a DAL in small apps, so let's skip that argument.) I like it because it seems cleaner, faster, more concise, and gives access to the control events so work can be done at the appropriate time. Which do you prefer and why?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Using controls such as SqlDataSource is faster in some respects, however, it does not suffice as a true DAL, not even with stored procs. (Its an argument you will loose 9 out of 10 time). This method binds the presentation to data much too strongly for me. You should be able to build the application so each layer is independent. I would say you are both right to a certain extent. The co-worker who is building everything by hand is going too far. DataBinding and templates can be used quite effectively. Separating the presentation and data, such as in a MVC or MVVM pattern gives much more flexibility and code reuse.


      I know the language. I've read a book. - _Madmatt

      P 1 Reply Last reply
      0
      • N Not Active

        Using controls such as SqlDataSource is faster in some respects, however, it does not suffice as a true DAL, not even with stored procs. (Its an argument you will loose 9 out of 10 time). This method binds the presentation to data much too strongly for me. You should be able to build the application so each layer is independent. I would say you are both right to a certain extent. The co-worker who is building everything by hand is going too far. DataBinding and templates can be used quite effectively. Separating the presentation and data, such as in a MVC or MVVM pattern gives much more flexibility and code reuse.


        I know the language. I've read a book. - _Madmatt

        P Offline
        P Offline
        Prasanta_Prince
        wrote on last edited by
        #3

        Good answer @mark.

        1 Reply Last reply
        0
        • B Brad Tumer

          I have an ongoing debate with a co-worker about the merit of using server controls or code-behind for data, and I thought I'd post here for other people's opinions. I use SqlDataSources bound to controls, whereas he puts labels on the page and does everything in the code. (Oh, and I use stored procedures and not text commands, which I feel suffices for a DAL in small apps, so let's skip that argument.) I like it because it seems cleaner, faster, more concise, and gives access to the control events so work can be done at the appropriate time. Which do you prefer and why?

          R Offline
          R Offline
          Renat Khabibulin
          wrote on last edited by
          #4

          Are this labels put on the form only once at the beggining of the page "lifecycle"? If yes - then declarative way would be better for traffic. Because each change of the page, which occurs in OnLoad() method is added to ViewState and travels to client with html page. If labels will be defined in .aspx then they will be created on Init() step and there will no additional ViewState data

          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