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. The Lounge
  3. Binding is the new Spaghetti

Binding is the new Spaghetti

Scheduled Pinned Locked Moved The Lounge
csharpwpfwinformswcf
26 Posts 22 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.
  • M Offline
    M Offline
    michaelbarb
    wrote on last edited by
    #1

    Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

    So many years of programming I have forgotten more languages than I know.

    M W Mike HankeyM D H 19 Replies Last reply
    0
    • M michaelbarb

      Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

      So many years of programming I have forgotten more languages than I know.

      M Offline
      M Offline
      megaadam
      wrote on last edited by
      #2

      Lasagna code!

      "If we don't change direction, we'll end up where we're going"

      1 Reply Last reply
      0
      • M michaelbarb

        Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

        So many years of programming I have forgotten more languages than I know.

        W Offline
        W Offline
        W Balboos GHB
        wrote on last edited by
        #3

        I'm a "non-binder". Possibly a control-freak part of my nature but, when it comes down to it, everything thing is in-your-face. The closest I get to obscurity is using SQL Stored Procedures rather than hard-coding the TSQL.

        Ravings en masse^

        "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

        "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

        D 1 Reply Last reply
        0
        • M michaelbarb

          Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

          So many years of programming I have forgotten more languages than I know.

          Mike HankeyM Offline
          Mike HankeyM Offline
          Mike Hankey
          wrote on last edited by
          #4

          That's what makes WPF so powerful...binding. I'm currently working on a WPF project, and yes it takes time to wrap your head around it but once you do it's awesome.

          The less you need, the more you have. JaxCoder.com

          1 Reply Last reply
          0
          • M michaelbarb

            Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

            So many years of programming I have forgotten more languages than I know.

            D Offline
            D Offline
            den2k88
            wrote on last edited by
            #5

            I already have my hands full with Qt slots/signals. Whoever #defines away a new language upon C++ is evil.

            GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

            1 Reply Last reply
            0
            • M michaelbarb

              Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

              So many years of programming I have forgotten more languages than I know.

              H Offline
              H Offline
              honey the codewitch
              wrote on last edited by
              #6

              The nice thing about binding as a concept (not sure how it works with WPF specifically) is that it's declarative, or at least potentially declarative. That is, what it's connected to becomes part of its *schema* not its *logic* as such.. So instead of saying the progress bar has a value, you'd say the progress bar is bound to this background worker. it actually makes things make *more sense* in terms of designing flow, but it probably takes some getting used to. All of this with the disclaimer that I haven't really used WPF or its binding before. I just know the concept. ETA: I'm sure you could make spaghetti with it in complex enough project, but spaghetti is its own problem, IMO - you can end up with spaghetti designs in just about any coding medium.

              Real programmers use butterflies

              1 Reply Last reply
              0
              • M michaelbarb

                Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                So many years of programming I have forgotten more languages than I know.

                J Offline
                J Offline
                Jacquers
                wrote on last edited by
                #7

                It's pretty powerful once you get used to it. And it's used pretty much everywhere now - Angular, Vue, etc. I prefer to have the code (logic) and view (semi)decoupled by using bindings. It's allowed me to re-use viewmodels with different views, where I would have had to duplicate logic.

                K 1 Reply Last reply
                0
                • M michaelbarb

                  Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                  So many years of programming I have forgotten more languages than I know.

                  S Offline
                  S Offline
                  SeanChupas
                  wrote on last edited by
                  #8

                  The same thing happens in JavaScript when people use control.on("event").... instead of just putting the onclick into the html. It makes it a pain tracking down where the events are.

                  1 Reply Last reply
                  0
                  • M michaelbarb

                    Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                    So many years of programming I have forgotten more languages than I know.

                    M Offline
                    M Offline
                    Maximilien
                    wrote on last edited by
                    #9

                    I'm starting learning C#/XAML in an existing project with lot of bindings. It's weird, but it works, update the list and the UI updates automagically.

                    I'd rather be phishing!

                    1 Reply Last reply
                    0
                    • M michaelbarb

                      Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                      So many years of programming I have forgotten more languages than I know.

                      M Offline
                      M Offline
                      Mycroft Holmes
                      wrote on last edited by
                      #10

                      michaelbarb wrote:

                      But everything is binding

                      Exactly as designed, if you are going to get the most out of WPF you are going to have to get your head around binding. Tracking down an issue can be difficult but once you understand it then it does become simpler.

                      Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

                      M 1 Reply Last reply
                      0
                      • M Mycroft Holmes

                        michaelbarb wrote:

                        But everything is binding

                        Exactly as designed, if you are going to get the most out of WPF you are going to have to get your head around binding. Tracking down an issue can be difficult but once you understand it then it does become simpler.

                        Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

                        M Offline
                        M Offline
                        michaelbarb
                        wrote on last edited by
                        #11

                        I believe everything in moderation. When binding first came out there were studies done that showed the performance cost of binding. Impact it less today but I am sure it is still there. For binding I use the "2 Up Binding Rule". If a parameter is used more then 2 places then I do binding in all of them. If you change a parameter that is used only once on the UI and the object is easily accessible then I just write to the control. Not only is it efficient but when you read the code you know immediately where it goes. For the "Up" part of the rule, if a child needs to access a UI object on the parent, binding is the best way to go. Some believe it is the only way since all the alternatives so messy. I always try and use the best tool for the job. I do not try and use a tool everywhere possible.

                        So many years of programming I have forgotten more languages than I know.

                        1 Reply Last reply
                        0
                        • M michaelbarb

                          Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                          So many years of programming I have forgotten more languages than I know.

                          D Offline
                          D Offline
                          Delphi 7 Solutions
                          wrote on last edited by
                          #12

                          You should learn from this guy, binding is not evil and is not spaghetti. Binding is your friend once you get used to how it works

                          1 Reply Last reply
                          0
                          • M michaelbarb

                            Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                            So many years of programming I have forgotten more languages than I know.

                            P Offline
                            P Offline
                            Padanian
                            wrote on last edited by
                            #13

                            In a multithreaded application, binding will save you from many headaches. Must be used sensibly though.

                            1 Reply Last reply
                            0
                            • M michaelbarb

                              Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                              So many years of programming I have forgotten more languages than I know.

                              M Offline
                              M Offline
                              Martin ISDN
                              wrote on last edited by
                              #14

                              i don't know what WPF is (never mind) and what binding from that perspective means, but i have a familiar feeling for what you are talking about. does the code for every task jump around a lot from function to function and even worse, from source file to source file?

                              1 Reply Last reply
                              0
                              • M michaelbarb

                                Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                                So many years of programming I have forgotten more languages than I know.

                                M Offline
                                M Offline
                                MadGerbil
                                wrote on last edited by
                                #15

                                It isn't just binding, it is true with everything. For some reason you're not allowed to just call a function and get a result. The function has to be through an interface which is backed up by a library or three and then there are templates for the view, for the model, for the database - and entity framework because doing a SQL call is evil for some reason and then the validation library, a number formatting widget and a dozen other random files, most of which are in Nuget package that are obsolete or no longer supported.... 7 years to go... my dream job is bagging groceries.

                                S 1 Reply Last reply
                                0
                                • W W Balboos GHB

                                  I'm a "non-binder". Possibly a control-freak part of my nature but, when it comes down to it, everything thing is in-your-face. The closest I get to obscurity is using SQL Stored Procedures rather than hard-coding the TSQL.

                                  Ravings en masse^

                                  "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                                  "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                                  D Offline
                                  D Offline
                                  darktrick544
                                  wrote on last edited by
                                  #16

                                  Me too, I do everything in code so I know exactly what's going on. And what's not. We have a couple apps here done by other (lazy) programmers and everything is done with binding. I have no idea how some of it works or why you'd elect to do that.

                                  1 Reply Last reply
                                  0
                                  • M michaelbarb

                                    Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                                    So many years of programming I have forgotten more languages than I know.

                                    M Offline
                                    M Offline
                                    Matt McGuire
                                    wrote on last edited by
                                    #17

                                    binding is the worst. all the hoops to jump through to display data. all the data transforms and special cases have to be put into a special view model that can be bound making a lot of glut. I worked with WPF for about 2 years, I wanted to pull my hair out, got a different job and never touched the stuff again.

                                    1 Reply Last reply
                                    0
                                    • M michaelbarb

                                      Long ago before there were flow control and subroutine structures all we had only GoTo's. As a result it was really hard to follow the flow of the program. We had spaghetti code. I am currently working with a middle age programmer that has only worked with C# and WPF. Very little Windows forms. He has 15 years of WPF and is a better at it than I. But everything is binding. He hardly ever updates a control directly. Everything is binding. Working with his code you never know were things are going. It is like the new spaghetti.

                                      So many years of programming I have forgotten more languages than I know.

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #18

                                      Binding is one of those things whose only purpose is to produce an "ooh" at product roll-out demos. Microsoft demo wonk: I'll show you how easy it is to get data from the database to the form. Click/drag/tap Crowd of mindless drones: Oooohhhh.

                                      M 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Binding is one of those things whose only purpose is to produce an "ooh" at product roll-out demos. Microsoft demo wonk: I'll show you how easy it is to get data from the database to the form. Click/drag/tap Crowd of mindless drones: Oooohhhh.

                                        M Offline
                                        M Offline
                                        michaelbarb
                                        wrote on last edited by
                                        #19

                                        Of course they did a lot of grunt work before hand to get the application ready. The not so Ooooohhhhh part. Now I have this interstate bridge I can sell you for a discount.

                                        So many years of programming I have forgotten more languages than I know.

                                        1 Reply Last reply
                                        0
                                        • J Jacquers

                                          It's pretty powerful once you get used to it. And it's used pretty much everywhere now - Angular, Vue, etc. I prefer to have the code (logic) and view (semi)decoupled by using bindings. It's allowed me to re-use viewmodels with different views, where I would have had to duplicate logic.

                                          K Offline
                                          K Offline
                                          KateAshman
                                          wrote on last edited by
                                          #20

                                          Agreed. For any front-end scenario where multiple clients are involved and at least one server that can propagate information to all clients, you either A) pick a binding framework or B) lose time reinventing the wheel in a non-standardized way that will become obsolete before it's ever finished. I just hope WASM/Blazor can speed up the creation of a C#-based binding framework for the web. I tired of debugging JavaScript. :((

                                          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