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. Is this a known pattern?

Is this a known pattern?

Scheduled Pinned Locked Moved The Lounge
csharpregexquestion
54 Posts 33 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.
  • N Nicholas Butler

    I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

    List users = DAL.User.FetchAll( where: user => user.Age > 21 );

    It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

    List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

    Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

    www.NickButler.net

    T Offline
    T Offline
    TorstenH
    wrote on last edited by
    #2

    shouldn't it be

    List users = FetchAllUsersWhereAgeGreaterThan( int minimumAge )

    that is called OOP.

    regards Torsten When I'm not working

    OriginalGriffO 1 Reply Last reply
    0
    • T TorstenH

      shouldn't it be

      List users = FetchAllUsersWhereAgeGreaterThan( int minimumAge )

      that is called OOP.

      regards Torsten When I'm not working

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #3

      Shouldn't that be

      List users = FetchAllUsersWhereAgeGreaterThan( int minimumAge );

      I assumed it was originally the method declaration, rather than the use, myself.

      Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      N 1 Reply Last reply
      0
      • N Nicholas Butler

        I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

        List users = DAL.User.FetchAll( where: user => user.Age > 21 );

        It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

        List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

        Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

        www.NickButler.net

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        Call it the Nick Fetch Pattern. Make it part of the Nick Sterling Framework. Trade mark it, develop some course work, cash in on consulting. Developer 1: What framework are you using? Developer 2: I'm using the Sterling Framework. Developer 1: Was that the one developed by Nick? Developer 2: Heck ya. Developer 1: I wish I could afford it. Developer 2: With the student discount it's only $899.00 Developer 1: Swwweeeeeeet! Don't worry about content. That's why there is marketing.

        N 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          Shouldn't that be

          List users = FetchAllUsersWhereAgeGreaterThan( int minimumAge );

          I assumed it was originally the method declaration, rather than the use, myself.

          Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

          N Offline
          N Offline
          Nicholas Butler
          wrote on last edited by
          #5

          Yes, it was - thanks :)

          www.NickButler.net

          1 Reply Last reply
          0
          • L Lost User

            Call it the Nick Fetch Pattern. Make it part of the Nick Sterling Framework. Trade mark it, develop some course work, cash in on consulting. Developer 1: What framework are you using? Developer 2: I'm using the Sterling Framework. Developer 1: Was that the one developed by Nick? Developer 2: Heck ya. Developer 1: I wish I could afford it. Developer 2: With the student discount it's only $899.00 Developer 1: Swwweeeeeeet! Don't worry about content. That's why there is marketing.

            N Offline
            N Offline
            Nicholas Butler
            wrote on last edited by
            #6

            Excellent idea - ta :) Do you think "Nick Needs Sterling" is giving too much away? Nick

            www.NickButler.net

            1 Reply Last reply
            0
            • N Nicholas Butler

              I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

              List users = DAL.User.FetchAll( where: user => user.Age > 21 );

              It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

              List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

              Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

              www.NickButler.net

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #7

              Nicholas Butler wrote:

              List<User> users = DAL.User.FetchAll( where: user => user.Age > 21 );

              Sadly, I like it! :thumbsup:

              IronScheme
              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

              N 1 Reply Last reply
              0
              • L leppie

                Nicholas Butler wrote:

                List<User> users = DAL.User.FetchAll( where: user => user.Age > 21 );

                Sadly, I like it! :thumbsup:

                IronScheme
                ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

                N Offline
                N Offline
                Nicholas Butler
                wrote on last edited by
                #8

                leppie wrote:

                Sadly, I like it! :thumbsup:

                Thanks leppie. The more I use it, the more I like it too :) Just can't find a good name for it... Nick

                www.NickButler.net

                1 Reply Last reply
                0
                • N Nicholas Butler

                  I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                  List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                  It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                  List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                  Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                  www.NickButler.net

                  P Offline
                  P Offline
                  peterchen
                  wrote on last edited by
                  #9

                  It's known as PNAMUT - Pretentious Name for Muddling Through. Sorry :-O The purpose of the data layer method (as you call it) is to protect the application against changes; e.g. a new privacy regulation mandates you may not track age, only states such as "above minimum drinking age". (before anyone barks back please consider that I nowhere endorsed or condemned either method)

                  FILETIME to time_t
                  | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                  N 1 Reply Last reply
                  0
                  • N Nicholas Butler

                    I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                    List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                    It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                    List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                    Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                    www.NickButler.net

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #10

                    The closest version of this that I could see without contemplating my navel would be an Identity Map. It's not a 100% fit, but it does fit some of your intent.

                    *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                    N 1 Reply Last reply
                    0
                    • N Nicholas Butler

                      I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                      List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                      It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                      List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                      Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                      www.NickButler.net

                      H Offline
                      H Offline
                      Henry Minute
                      wrote on last edited by
                      #11

                      Suggestion: Predicated Queries/Query

                      Henry Minute Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is. Cogito ergo thumb - Sucking my thumb helps me to think.

                      N I 2 Replies Last reply
                      0
                      • N Nicholas Butler

                        I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                        List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                        It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                        List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                        Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                        www.NickButler.net

                        E Offline
                        E Offline
                        Ennis Ray Lynch Jr
                        wrote on last edited by
                        #12

                        I like to call it poor programming. But I am outnumbered in the MS world.

                        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                        1 Reply Last reply
                        0
                        • N Nicholas Butler

                          I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                          List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                          It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                          List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                          Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                          www.NickButler.net

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #13

                          As an alternative, it also looks a bit like a Query Object - mapping onto a Repository pattern.

                          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                          My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                          V 1 Reply Last reply
                          0
                          • N Nicholas Butler

                            I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                            List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                            It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                            List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                            Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                            www.NickButler.net

                            B Offline
                            B Offline
                            BobJanova
                            wrote on last edited by
                            #14

                            I'm thinking condition-based programming. I'm not sure if I just made that up right now though. Also, isn't that exactly the type of thing you can already do with a Linq query? It is elegant, just like Linq, and it's a good thing to do as long as you can implement it in such a way that the condition is only executed as little as possible, and you don't have to load the whole potential result set into memory and then filter it. It's more functional programming than declarative, I think. In languages where functions are first class objects (e.g. Javascript) it is more common to pass filter functions or other types of function (for example a sort order comparator) around and potentially declare them locally as you have done here. What you're passing in the 'where' parameter is a pure function.

                            N 1 Reply Last reply
                            0
                            • P peterchen

                              It's known as PNAMUT - Pretentious Name for Muddling Through. Sorry :-O The purpose of the data layer method (as you call it) is to protect the application against changes; e.g. a new privacy regulation mandates you may not track age, only states such as "above minimum drinking age". (before anyone barks back please consider that I nowhere endorsed or condemned either method)

                              FILETIME to time_t
                              | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                              N Offline
                              N Offline
                              Nicholas Butler
                              wrote on last edited by
                              #15

                              peterchen wrote:

                              It's known as PNAMUT - Pretentious Name for Muddling Through.

                              Correct, but not very catchy :)

                              peterchen wrote:

                              The purpose of the data layer method (as you call it) is to protect the application against changes; e.g. a new privacy regulation mandates you may not track age, only states such as "above minimum drinking age".

                              That was a contrived example but I agree: it's certainly not High Church. Nick

                              www.NickButler.net

                              P 1 Reply Last reply
                              0
                              • P Pete OHanlon

                                The closest version of this that I could see without contemplating my navel would be an Identity Map. It's not a 100% fit, but it does fit some of your intent.

                                *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                                N Offline
                                N Offline
                                Nicholas Butler
                                wrote on last edited by
                                #16

                                Interesting. I have also implemented this in my framework, but I just called it caching. Nick

                                www.NickButler.net

                                P 1 Reply Last reply
                                0
                                • H Henry Minute

                                  Suggestion: Predicated Queries/Query

                                  Henry Minute Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is. Cogito ergo thumb - Sucking my thumb helps me to think.

                                  N Offline
                                  N Offline
                                  Nicholas Butler
                                  wrote on last edited by
                                  #17

                                  Henry Minute wrote:

                                  Predicated Queries/Query

                                  I like it - thanks Henry :) Nick

                                  www.NickButler.net

                                  1 Reply Last reply
                                  0
                                  • N Nicholas Butler

                                    Interesting. I have also implemented this in my framework, but I just called it caching. Nick

                                    www.NickButler.net

                                    P Offline
                                    P Offline
                                    Pete OHanlon
                                    wrote on last edited by
                                    #18

                                    Nicholas Butler wrote:

                                    I just called it caching

                                    Most people do. First law of patterns. They are a fancy name for stuff you already do.

                                    *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                                    N L S 3 Replies Last reply
                                    0
                                    • B BobJanova

                                      I'm thinking condition-based programming. I'm not sure if I just made that up right now though. Also, isn't that exactly the type of thing you can already do with a Linq query? It is elegant, just like Linq, and it's a good thing to do as long as you can implement it in such a way that the condition is only executed as little as possible, and you don't have to load the whole potential result set into memory and then filter it. It's more functional programming than declarative, I think. In languages where functions are first class objects (e.g. Javascript) it is more common to pass filter functions or other types of function (for example a sort order comparator) around and potentially declare them locally as you have done here. What you're passing in the 'where' parameter is a pure function.

                                      N Offline
                                      N Offline
                                      Nicholas Butler
                                      wrote on last edited by
                                      #19

                                      BobJanova wrote:

                                      Also, isn't that exactly the type of thing you can already do with a Linq query?

                                      Yes, it's certainly like Linq :-D The difference is that it may or may not cause a Linq-to-Entities query to run and hit the database server.

                                      BobJanova wrote:

                                      It's more functional programming than declarative, I think.

                                      Yes, I suppose it is. I was focused on making it easy to use rather than the programming paradigm. Thanks, Nick

                                      www.NickButler.net

                                      1 Reply Last reply
                                      0
                                      • N Nicholas Butler

                                        I'm having difficulty finding a name for a style of programming. You can make one up if you like, but I'd prefer something that is already documented :) I've written a layer over the Entity Framework that allows the application code to pass parameters into the data layer that shape the returned result sets. So you can write something like this:

                                        List users = DAL.User.FetchAll( where: user => user.Age > 21 );

                                        It's declarative programming, but I was looking for a more specific name. Something like "locality of intent". Basically, you say what you need in the place where you need it. It's the opposite of having a data layer method like this:

                                        List FetchAllUsersWhereAgeGreaterThan( int minimumAge )

                                        Is this a known pattern? I've run out of obvious words to Google. Ta, Nick

                                        www.NickButler.net

                                        T Offline
                                        T Offline
                                        TheGreatAndPowerfulOz
                                        wrote on last edited by
                                        #20

                                        I don't know if it's known or not. You could call it "Query Mapper"

                                        If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
                                        You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

                                        1 Reply Last reply
                                        0
                                        • P Pete OHanlon

                                          Nicholas Butler wrote:

                                          I just called it caching

                                          Most people do. First law of patterns. They are a fancy name for stuff you already do.

                                          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                          My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                                          N Offline
                                          N Offline
                                          Nicholas Butler
                                          wrote on last edited by
                                          #21

                                          Pete O'Hanlon wrote:

                                          First law of patterns. They are a fancy name for stuff you already do.

                                          Along with the first law of programming ( "it's already been done" ), I was hoping someone had already come up with the fancy name. Nick

                                          www.NickButler.net

                                          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