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. Prefix or suffix? [modified * 2]

Prefix or suffix? [modified * 2]

Scheduled Pinned Locked Moved The Lounge
javacomjsonquestion
30 Posts 13 Posters 3 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.
  • R Rajesh R Subramanian

    Look at a bunch of functions like: GetWindowName(), GetWindowClass(), GetWindowState(), SetWindowPos(). Window is an entity here and these functions are performing some action (or querying it for its own state information) on it to yield some result. I generally don't put the entity/type that I am performing an action upon at the end (of course, there can be something like GetWindow(), but that's different). Historic data (is that the term :~ ) is an entity in your case and you may perform various actions on it, like getting the index curve of it, getting the correlation, etc., Similarly, live data is another entity. So, we've got two different entities and we you shall build up functions around them. :) Of course, I know there may be exceptions and I'm just talking in general.

    Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

    C Offline
    C Offline
    Christoph Menge
    wrote on last edited by
    #14

    Hey Rajesh, obvioulsy we agree on this :-) I just read a few lines of "Code Complete 2" about naming methods: "To name a procedure, use a strong verb followed by an object" As you pointed out already, "Get" is already a strong verb - so the real question here is whether "Correlation" itself can be regarded as an entity - but that requires some knowledge about the subject matter (which I don't have). However, in "Code Complete", Steve McConnell also points out that in an OO-environment, the method itself does not need to include the object name, because it is included in the invocation such as myHistoricData.GetCorrelation(). I think I'd still go for this, if possible. On the other hand, that might raise question whether to name the class/webService "financialDataHistoric" or "historicFinancialData"... Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    R V 2 Replies Last reply
    0
    • C Christoph Menge

      Hey Rajesh, obvioulsy we agree on this :-) I just read a few lines of "Code Complete 2" about naming methods: "To name a procedure, use a strong verb followed by an object" As you pointed out already, "Get" is already a strong verb - so the real question here is whether "Correlation" itself can be regarded as an entity - but that requires some knowledge about the subject matter (which I don't have). However, in "Code Complete", Steve McConnell also points out that in an OO-environment, the method itself does not need to include the object name, because it is included in the invocation such as myHistoricData.GetCorrelation(). I think I'd still go for this, if possible. On the other hand, that might raise question whether to name the class/webService "financialDataHistoric" or "historicFinancialData"... Chris

      "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
      Articles  Blog

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #15

      Christoph Menge wrote:

      myHistoricData.GetCorrelation()

      I was thinking of a situation where you're writing this API on the global namespace. So, it made perfect sense to me to have names like ::GetHistoricCorrelation() and ::GetCurrentCorrlation(). Of course, it were a member function, then GetCorrelation() is sweet enough. :) On the perverted side, we can have an overload like ::GetCorrelation(Entity E) if we have too may entities on which we could possibly make this call. :-O

      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

      1 Reply Last reply
      0
      • R Rajesh R Subramanian

        Look at a bunch of functions like: GetWindowName(), GetWindowClass(), GetWindowState(), SetWindowPos(). Window is an entity here and these functions are performing some action (or querying it for its own state information) on it to yield some result. I generally don't put the entity/type that I am performing an action upon at the end (of course, there can be something like GetWindow(), but that's different). Historic data (is that the term :~ ) is an entity in your case and you may perform various actions on it, like getting the index curve of it, getting the correlation, etc., Similarly, live data is another entity. So, we've got two different entities and we you shall build up functions around them. :) Of course, I know there may be exceptions and I'm just talking in general.

        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #16

        Rajesh R Subramanian wrote:

        Historic data (is that the term ) is an entity in your case and you may perform various actions on it, like getting the index curve of it, getting the correlation, etc.

        Au contraire. Correlation, IndexCurve, etc are entities, and I'm getting their historic (anything before today) and live (today's) values.

        Cheers, Vikram.


        "real dictators don't loose[sic] elections." - Diego Moita.

        1 Reply Last reply
        0
        • C Christoph Menge

          Hey Rajesh, obvioulsy we agree on this :-) I just read a few lines of "Code Complete 2" about naming methods: "To name a procedure, use a strong verb followed by an object" As you pointed out already, "Get" is already a strong verb - so the real question here is whether "Correlation" itself can be regarded as an entity - but that requires some knowledge about the subject matter (which I don't have). However, in "Code Complete", Steve McConnell also points out that in an OO-environment, the method itself does not need to include the object name, because it is included in the invocation such as myHistoricData.GetCorrelation(). I think I'd still go for this, if possible. On the other hand, that might raise question whether to name the class/webService "financialDataHistoric" or "historicFinancialData"... Chris

          "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
          Articles  Blog

          V Offline
          V Offline
          Vikram A Punathambekar
          wrote on last edited by
          #17

          Christoph Menge wrote:

          the real question here is whether "Correlation" itself can be regarded as an entity

          Yes. SpreadCurve, IndexCurve, Correlation, etc are the entities. I'm building functions to get their historic (anything before today) and live (today's) values.

          Cheers, Vikram.


          "real dictators don't loose[sic] elections." - Diego Moita.

          C 1 Reply Last reply
          0
          • V Vikram A Punathambekar

            Christoph Menge wrote:

            the real question here is whether "Correlation" itself can be regarded as an entity

            Yes. SpreadCurve, IndexCurve, Correlation, etc are the entities. I'm building functions to get their historic (anything before today) and live (today's) values.

            Cheers, Vikram.


            "real dictators don't loose[sic] elections." - Diego Moita.

            C Offline
            C Offline
            Christoph Menge
            wrote on last edited by
            #18

            Hi Vikram, what I meant is: "Is correlation alone a sufficient description for the entity, or is it necessary to call it liveCorrelation?". In essence, I prefer GetHistoricalCorrelation() over GetCorrelationHistorical() like most (all?) of the other posters did. Chris

            "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
            Articles  Blog

            V 1 Reply Last reply
            0
            • C Christoph Menge

              Hi Vikram, what I meant is: "Is correlation alone a sufficient description for the entity, or is it necessary to call it liveCorrelation?". In essence, I prefer GetHistoricalCorrelation() over GetCorrelationHistorical() like most (all?) of the other posters did. Chris

              "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
              Articles  Blog

              V Offline
              V Offline
              Vikram A Punathambekar
              wrote on last edited by
              #19

              Christoph Menge wrote:

              Is correlation alone a sufficient description for the entity, or is it necessary to call it liveCorrelation?

              Actually, yes. A SpreadCurve is an entity by itself. The only thing that differentiates between live and historical SpreadCurves is that the historical ones are from previous days. Thanks for your input; I'm somewhat surprised (and somewhat pleasantly so) to see pretty much everybody actually disagrees. ;)

              Cheers, Vikram.


              "real dictators don't loose[sic] elections." - Diego Moita.

              R 1 Reply Last reply
              0
              • V Vikram A Punathambekar

                I am designing an API, which will (amongst other things) provide live and historic values for many types of data. Let's say the data types will be Correlation, IndexCurve, and RollDate, amongst many others. The methods that get live data will be called getCorrelation(), getIndexCurve(), and getRollDate() respectively (the word **live** will not be part of the name). Would you prefer the methods that deal with historic data (anything before today's data) to be called

                getCorrelationHistoric()
                getRollDateHistoric()

                or

                getHistoricCorrelation()
                getHistoricRollDate()

                I strongly want to keep the modifier as the suffix (i.e., getCorrelationHistoric()) but I'm interested in knowing what you would do, and why. :) [EDIT]If it makes any difference, these methods will be part of a web service. Written in Java ;) [/EDIT] [EDIT2]Added clarifications[/EDIT2]

                Cheers, Vikram.


                "real dictators don't loose[sic] elections." - Diego Moita.

                modified on Tuesday, February 26, 2008 7:15 AM

                R Offline
                R Offline
                Robert Rohde
                wrote on last edited by
                #20

                Are you really planning that these methods don't have any arguments? What about making the difference with some kind of overload? Something like:

                getCoorelation() --current
                getCorrelation(Date date) --historic correlation of date

                Robert

                V 1 Reply Last reply
                0
                • R Robert Rohde

                  Are you really planning that these methods don't have any arguments? What about making the difference with some kind of overload? Something like:

                  getCoorelation() --current
                  getCorrelation(Date date) --historic correlation of date

                  Robert

                  V Offline
                  V Offline
                  Vikram A Punathambekar
                  wrote on last edited by
                  #21

                  Generally speaking, the methods will have quite a few arguments. They are far from being finalized, though. Great suggestion, I was surprised nobody else noticed. :-D

                  Cheers, Vikram.


                  "real dictators don't loose[sic] elections." - Diego Moita.

                  R 1 Reply Last reply
                  0
                  • V Vikram A Punathambekar

                    Christoph Menge wrote:

                    Is correlation alone a sufficient description for the entity, or is it necessary to call it liveCorrelation?

                    Actually, yes. A SpreadCurve is an entity by itself. The only thing that differentiates between live and historical SpreadCurves is that the historical ones are from previous days. Thanks for your input; I'm somewhat surprised (and somewhat pleasantly so) to see pretty much everybody actually disagrees. ;)

                    Cheers, Vikram.


                    "real dictators don't loose[sic] elections." - Diego Moita.

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #22

                    I think in that case GetIndexCurveHistory() and GetIndexCurve(), etc., should fit in right. The word, histor_ic_ is a bit confusing.

                    Vikram A Punathambekar wrote:

                    I'm somewhat surprised (and somewhat pleasantly so) to see pretty much everybody actually disagrees.

                    Everyone disagrees, for a reason, may be? Or you just think that is plain coincidence? :-D

                    Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                    V 1 Reply Last reply
                    0
                    • V Vikram A Punathambekar

                      Generally speaking, the methods will have quite a few arguments. They are far from being finalized, though. Great suggestion, I was surprised nobody else noticed. :-D

                      Cheers, Vikram.


                      "real dictators don't loose[sic] elections." - Diego Moita.

                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #23

                      Vikram A Punathambekar wrote:

                      I was surprised nobody else noticed.

                      On my reply to Cristoph, I already said we could have overloads.

                      Rajesh R Subramanian wrote:

                      On the perverted side, we can have an overload like ::GetCorrelation(Entity E) if we have too may entities on which we could possibly make this call. :-O

                      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                      1 Reply Last reply
                      0
                      • V Vikram A Punathambekar

                        I am designing an API, which will (amongst other things) provide live and historic values for many types of data. Let's say the data types will be Correlation, IndexCurve, and RollDate, amongst many others. The methods that get live data will be called getCorrelation(), getIndexCurve(), and getRollDate() respectively (the word **live** will not be part of the name). Would you prefer the methods that deal with historic data (anything before today's data) to be called

                        getCorrelationHistoric()
                        getRollDateHistoric()

                        or

                        getHistoricCorrelation()
                        getHistoricRollDate()

                        I strongly want to keep the modifier as the suffix (i.e., getCorrelationHistoric()) but I'm interested in knowing what you would do, and why. :) [EDIT]If it makes any difference, these methods will be part of a web service. Written in Java ;) [/EDIT] [EDIT2]Added clarifications[/EDIT2]

                        Cheers, Vikram.


                        "real dictators don't loose[sic] elections." - Diego Moita.

                        modified on Tuesday, February 26, 2008 7:15 AM

                        A Offline
                        A Offline
                        Al Beback
                        wrote on last edited by
                        #24

                        I would consider: getCorrelation(bool historic); getRollDate(bool historic); along with getCorrelation(); // calls above with false getRollDate(); // calls above with false Cheers.

                        - Is God willing to prevent evil, but not able? Then he is impotent. - Is he able, but not willing? Then he is malevolent. - Is he both able and willing? Whence then is evil? - Is he neither able nor willing? Then why call him God? Epicurus

                        V 1 Reply Last reply
                        0
                        • A Al Beback

                          I would consider: getCorrelation(bool historic); getRollDate(bool historic); along with getCorrelation(); // calls above with false getRollDate(); // calls above with false Cheers.

                          - Is God willing to prevent evil, but not able? Then he is impotent. - Is he able, but not willing? Then he is malevolent. - Is he both able and willing? Whence then is evil? - Is he neither able nor willing? Then why call him God? Epicurus

                          V Offline
                          V Offline
                          Vikram A Punathambekar
                          wrote on last edited by
                          #25

                          Not quite. Historic data should be available for a few years, so the date has to be specified. I'm gravitating towards what the other guy said - one overload that takes a date parameter.

                          Cheers, Vikram.


                          "real dictators don't loose[sic] elections." - Diego Moita.

                          1 Reply Last reply
                          0
                          • R Rajesh R Subramanian

                            I think in that case GetIndexCurveHistory() and GetIndexCurve(), etc., should fit in right. The word, histor_ic_ is a bit confusing.

                            Vikram A Punathambekar wrote:

                            I'm somewhat surprised (and somewhat pleasantly so) to see pretty much everybody actually disagrees.

                            Everyone disagrees, for a reason, may be? Or you just think that is plain coincidence? :-D

                            Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                            V Offline
                            V Offline
                            Vikram A Punathambekar
                            wrote on last edited by
                            #26

                            Rajesh R Subramanian wrote:

                            I think in that case GetIndexCurveHistory() and GetIndexCurve(), etc., should fit in right. The word, historic is a bit confusing.

                            History doesn't really make sense. It implies you want the entire bunch of past values. I thought Historic was bang on target (and so did my UK colleague).

                            Rajesh R Subramanian wrote:

                            Everyone disagrees, for a reason, may be? Or you just think that is plain coincidence?

                            Not sure I understand what you're saying. :~ I still think getIndexCurveHistoric is better than getHistoricIndexCurve but I will go with the date overload. It will look like this:

                            IndexCurve getIndexCurve(string curveID);
                            IndexCurve getIndexCurve(string curveID, DateTime asOfDate);

                            Cheers, Vikram.


                            "real dictators don't loose[sic] elections." - Diego Moita.

                            D R 2 Replies Last reply
                            0
                            • V Vikram A Punathambekar

                              I am designing an API, which will (amongst other things) provide live and historic values for many types of data. Let's say the data types will be Correlation, IndexCurve, and RollDate, amongst many others. The methods that get live data will be called getCorrelation(), getIndexCurve(), and getRollDate() respectively (the word **live** will not be part of the name). Would you prefer the methods that deal with historic data (anything before today's data) to be called

                              getCorrelationHistoric()
                              getRollDateHistoric()

                              or

                              getHistoricCorrelation()
                              getHistoricRollDate()

                              I strongly want to keep the modifier as the suffix (i.e., getCorrelationHistoric()) but I'm interested in knowing what you would do, and why. :) [EDIT]If it makes any difference, these methods will be part of a web service. Written in Java ;) [/EDIT] [EDIT2]Added clarifications[/EDIT2]

                              Cheers, Vikram.


                              "real dictators don't loose[sic] elections." - Diego Moita.

                              modified on Tuesday, February 26, 2008 7:15 AM

                              S Offline
                              S Offline
                              Shog9 0
                              wrote on last edited by
                              #27

                              getCorrelation(string timePeriod) getRollDate(string timePeriod)

                              You must be careful in the forest Broken glass and rusty nails If you're to bring back something for us I have bullets for sale...

                              1 Reply Last reply
                              0
                              • V Vikram A Punathambekar

                                Rajesh R Subramanian wrote:

                                I think in that case GetIndexCurveHistory() and GetIndexCurve(), etc., should fit in right. The word, historic is a bit confusing.

                                History doesn't really make sense. It implies you want the entire bunch of past values. I thought Historic was bang on target (and so did my UK colleague).

                                Rajesh R Subramanian wrote:

                                Everyone disagrees, for a reason, may be? Or you just think that is plain coincidence?

                                Not sure I understand what you're saying. :~ I still think getIndexCurveHistoric is better than getHistoricIndexCurve but I will go with the date overload. It will look like this:

                                IndexCurve getIndexCurve(string curveID);
                                IndexCurve getIndexCurve(string curveID, DateTime asOfDate);

                                Cheers, Vikram.


                                "real dictators don't loose[sic] elections." - Diego Moita.

                                D Offline
                                D Offline
                                Dan Neely
                                wrote on last edited by
                                #28

                                Vikram A Punathambekar wrote:

                                I still think getIndexCurveHistoric is better than getHistoricIndexCurve but I will go with the date overload. It will look like this:

                                I like this better than any of the other suggestions I've seen.

                                Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop. -- Matthew Faithfull

                                1 Reply Last reply
                                0
                                • V Vikram A Punathambekar

                                  I am designing an API, which will (amongst other things) provide live and historic values for many types of data. Let's say the data types will be Correlation, IndexCurve, and RollDate, amongst many others. The methods that get live data will be called getCorrelation(), getIndexCurve(), and getRollDate() respectively (the word **live** will not be part of the name). Would you prefer the methods that deal with historic data (anything before today's data) to be called

                                  getCorrelationHistoric()
                                  getRollDateHistoric()

                                  or

                                  getHistoricCorrelation()
                                  getHistoricRollDate()

                                  I strongly want to keep the modifier as the suffix (i.e., getCorrelationHistoric()) but I'm interested in knowing what you would do, and why. :) [EDIT]If it makes any difference, these methods will be part of a web service. Written in Java ;) [/EDIT] [EDIT2]Added clarifications[/EDIT2]

                                  Cheers, Vikram.


                                  "real dictators don't loose[sic] elections." - Diego Moita.

                                  modified on Tuesday, February 26, 2008 7:15 AM

                                  S Offline
                                  S Offline
                                  SuperJdynamite
                                  wrote on last edited by
                                  #29

                                  A convention I originally used for SQL, but has permeated into other code, was to not prefix procedures with "Get", "Set", "Update" or the like. Instead I have "CustomerNameSelect()" or "CustomerNameUpdate" instead of "SelectCustomerName()" or "UpdateCustomerName()". In an alphabetical listing I find it's easier to find what you want if all your "CustomerName" operations are lumped together rather than all your Select operations.

                                  1 Reply Last reply
                                  0
                                  • V Vikram A Punathambekar

                                    Rajesh R Subramanian wrote:

                                    I think in that case GetIndexCurveHistory() and GetIndexCurve(), etc., should fit in right. The word, historic is a bit confusing.

                                    History doesn't really make sense. It implies you want the entire bunch of past values. I thought Historic was bang on target (and so did my UK colleague).

                                    Rajesh R Subramanian wrote:

                                    Everyone disagrees, for a reason, may be? Or you just think that is plain coincidence?

                                    Not sure I understand what you're saying. :~ I still think getIndexCurveHistoric is better than getHistoricIndexCurve but I will go with the date overload. It will look like this:

                                    IndexCurve getIndexCurve(string curveID);
                                    IndexCurve getIndexCurve(string curveID, DateTime asOfDate);

                                    Cheers, Vikram.


                                    "real dictators don't loose[sic] elections." - Diego Moita.

                                    R Offline
                                    R Offline
                                    Rajesh R Subramanian
                                    wrote on last edited by
                                    #30

                                    Vikram A Punathambekar wrote:

                                    History doesn't really make sense.

                                    Hmm... My assumption was that you'd send a parameter like CDateTime (I don't know the .net equivalent of it... I guess it is DateTime from your post) to that call. I must have been clear about the parameters though. But, the overloads you've specified in this post looks just perfect.

                                    Vikram A Punathambekar wrote:

                                    Not sure I understand what you're saying.

                                    I'm saying that everyone disagreed with you, because they felt it could have been better. :)

                                    Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                                    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