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. Routines, methods, procedures and functions

Routines, methods, procedures and functions

Scheduled Pinned Locked Moved The Lounge
question
26 Posts 18 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.
  • R Rei Miyasaka

    People use these words interchangeably. It confuses students. How would you define them? How do they differ?

    L Offline
    L Offline
    Leslie Sanford
    wrote on last edited by
    #5

    reinux wrote:

    People use these words interchangeably. It confuses students. How would you define them? How do they differ?

    Routine and procedure I'd say mean the same thing. They are, erm, functions, that change state and do not return a value. A function is a, erm, function that returns a value and does not change state. A method is a function or procedure that belongs to a class. Note: sometimes the lines are blurred and a procedure will return a value, e.g. bool MoveNext(). And you'll have functions that do change state... I find these labels not too terribly important, but I do find it important when designing a function/procedure/method to think through what state it changes, if any, and what return value it should have, if any.

    R 1 Reply Last reply
    0
    • R Rei Miyasaka

      People use these words interchangeably. It confuses students. How would you define them? How do they differ?

      M Offline
      M Offline
      M dHatter
      wrote on last edited by
      #6

      Here is a long answer short. ------------------------------------------------ A function is an action that starts a routine that initializes a method to rectify a situation for implementing a procedure. ;) ;P :-D :laugh: :laugh: :rolleyes:

      KISS "Keep It Simple, Stupid"

      1 Reply Last reply
      0
      • L Leslie Sanford

        reinux wrote:

        People use these words interchangeably. It confuses students. How would you define them? How do they differ?

        Routine and procedure I'd say mean the same thing. They are, erm, functions, that change state and do not return a value. A function is a, erm, function that returns a value and does not change state. A method is a function or procedure that belongs to a class. Note: sometimes the lines are blurred and a procedure will return a value, e.g. bool MoveNext(). And you'll have functions that do change state... I find these labels not too terribly important, but I do find it important when designing a function/procedure/method to think through what state it changes, if any, and what return value it should have, if any.

        R Offline
        R Offline
        Rohde
        wrote on last edited by
        #7

        Yeah, that's how I'd define it as well.


        "When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
        -Atlas Shrugged, Ayn Rand

        1 Reply Last reply
        0
        • R Rei Miyasaka

          People use these words interchangeably. It confuses students. How would you define them? How do they differ?

          P Offline
          P Offline
          Paul Watson
          wrote on last edited by
          #8

          Are you looking for just a technical definition or definitions in the English language too?

          regards, Paul Watson Ireland & South Africa

          Fernando A. Gomez F. wrote:

          At least he achieved immortality for a few years.

          R 1 Reply Last reply
          0
          • P Paul Watson

            Are you looking for just a technical definition or definitions in the English language too?

            regards, Paul Watson Ireland & South Africa

            Fernando A. Gomez F. wrote:

            At least he achieved immortality for a few years.

            R Offline
            R Offline
            Rei Miyasaka
            wrote on last edited by
            #9

            Something like what Leslie provided, I think. His is pretty close to mine, but I'm just curious what other people think about it. Sorta like the difference between nerd and geek, nude and naked.

            M 1 Reply Last reply
            0
            • R Rei Miyasaka

              People use these words interchangeably. It confuses students. How would you define them? How do they differ?

              L Offline
              L Offline
              Luca Leonardo Scorcia
              wrote on last edited by
              #10

              I'd say... Procedure = A block of code with a name and some parameters Routine = A procedure that belongs to the global namespace Method = A procedure that belongs to a class Function = A procedure that returns a value but while speaking I tend to use only the Method/Function names.

              Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása

              1 Reply Last reply
              0
              • R Rei Miyasaka

                Something like what Leslie provided, I think. His is pretty close to mine, but I'm just curious what other people think about it. Sorta like the difference between nerd and geek, nude and naked.

                M Offline
                M Offline
                Member 96
                wrote on last edited by
                #11

                reinux wrote:

                Sorta like the difference between nerd and geek, nude and naked.

                Not at all!! Originally: Either: According to Dr. Seuss the inventor of the term, a nerd is a creature for an imaginary zoo (along with a nerkle and a seersucker). Or: It was originally spelled knurd and was used in the 40's by university students to define the opposite of the partying unattentive students or "drunk"s A geek is someone who eats bugs for entertainment in a carnival. Modern times: A geek is someone who is all consumed with one particular area of expertise to the exclusion of all else particularly hygiene and a social life. I.E. a Film geek, a Star Wars geek etc. A nerd is like a geek only the area of expertise is actually many and changes regularly. A nerd is in other words a renaissance geek. And nude and NAKED are entirely different! A stripper onstage is naked but in the shower at home merely nude. As for procedures and functions and methods: Routine - (also "subroutine") is bad science fiction writer terminology most often heard in bad tv series or movies. Used by writers who don't actually care at all about the subject, they just need a plot devices to move things along. Method - hip dark-sunglasses c# coder terminology. Procedure - what your great aunt has done in the hospital. Function - C++ geek terminology. ;)


                When everyone is a hero no one is a hero.

                P 1 Reply Last reply
                0
                • R Rei Miyasaka

                  People use these words interchangeably. It confuses students. How would you define them? How do they differ?

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

                  Routines can become boring. Methods may involve madness. Procedures might rip your guts out. Functions will occasionally misfunction.

                  1 Reply Last reply
                  0
                  • R Rei Miyasaka

                    People use these words interchangeably. It confuses students. How would you define them? How do they differ?

                    H Offline
                    H Offline
                    Hans Dietrich
                    wrote on last edited by
                    #13

                    The words routine, method, and procedure are not used by Stroustrup in connection with subroutines. The only word he uses in this regard is function. You can check this by looking in the index to The C++ Programming Language. You can look at the specs for other languages to see what is correct for them.

                    Best wishes, Hans


                    [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

                    P 1 Reply Last reply
                    0
                    • M Member 96

                      reinux wrote:

                      Sorta like the difference between nerd and geek, nude and naked.

                      Not at all!! Originally: Either: According to Dr. Seuss the inventor of the term, a nerd is a creature for an imaginary zoo (along with a nerkle and a seersucker). Or: It was originally spelled knurd and was used in the 40's by university students to define the opposite of the partying unattentive students or "drunk"s A geek is someone who eats bugs for entertainment in a carnival. Modern times: A geek is someone who is all consumed with one particular area of expertise to the exclusion of all else particularly hygiene and a social life. I.E. a Film geek, a Star Wars geek etc. A nerd is like a geek only the area of expertise is actually many and changes regularly. A nerd is in other words a renaissance geek. And nude and NAKED are entirely different! A stripper onstage is naked but in the shower at home merely nude. As for procedures and functions and methods: Routine - (also "subroutine") is bad science fiction writer terminology most often heard in bad tv series or movies. Used by writers who don't actually care at all about the subject, they just need a plot devices to move things along. Method - hip dark-sunglasses c# coder terminology. Procedure - what your great aunt has done in the hospital. Function - C++ geek terminology. ;)


                      When everyone is a hero no one is a hero.

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

                      John C wrote:

                      And nude and NAKED

                      Yeah, naked requires an observer. You may be sunning yourself nude in your backyard and suddenly find yourself naked when a neighbour greets you over the fence.

                      John C wrote:

                      When everyone is a hero no one is a hero.

                      Or, from Gilbert and Sullivan's, "The Gondoliers" -- "When everyone is somebody then no one's anybody."

                      R 1 Reply Last reply
                      0
                      • C Christian Graus

                        Potato, potato.

                        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

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

                        you pronounced them the wrong way round.

                        We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                        blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                        M 1 Reply Last reply
                        0
                        • H Hans Dietrich

                          The words routine, method, and procedure are not used by Stroustrup in connection with subroutines. The only word he uses in this regard is function. You can check this by looking in the index to The C++ Programming Language. You can look at the specs for other languages to see what is correct for them.

                          Best wishes, Hans


                          [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

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

                          That is also true of B and C, going by early Bell Labs documents that are available online.

                          1 Reply Last reply
                          0
                          • P peterchen

                            you pronounced them the wrong way round.

                            We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                            blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                            M Offline
                            M Offline
                            Mark Salsbery
                            wrote on last edited by
                            #17

                            Aussies... :rolleyes: ;)

                            Mark Salsbery Microsoft MVP - Visual C++ :java:

                            1 Reply Last reply
                            0
                            • R Rei Miyasaka

                              People use these words interchangeably. It confuses students. How would you define them? How do they differ?

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

                              Routine, n., a set of instructions executed to perform a specific task. Subroutine, n., a routine invoked in some fashion from another routine, with a mechanism to return control to the calling location when the subroutine has finished. Subroutines may be referenced by address, line number, or a symbolic name depending on the language and system in use. Procedure, n., see Routine Function, n., a subroutine, invoked by name, that returns a value but does not otherwise alter the state of the system. Also another name for a subroutine in C and C-like languages. Method, n., in Object-Oriented Programming: a subroutine, invoked by name and context (object). Methods are generally used to retrieve information about the context object, or to modify it in some way, although they may do neither, instead acting as functions (in OO systems that do not provide a means of defining functions, this practice may be used to simulate them).

                              L 1 Reply Last reply
                              0
                              • R Rei Miyasaka

                                Been eating lots of beans today, I see.

                                C Offline
                                C Offline
                                Christian Graus
                                wrote on last edited by
                                #19

                                No, as others have said, a method, and a procedure are the same thing. Even a function is the same thing, if it's inside a class, it's a *member* function. And a routine, I've not heard them called that by anyone for a long time.

                                Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                                R 1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  John C wrote:

                                  And nude and NAKED

                                  Yeah, naked requires an observer. You may be sunning yourself nude in your backyard and suddenly find yourself naked when a neighbour greets you over the fence.

                                  John C wrote:

                                  When everyone is a hero no one is a hero.

                                  Or, from Gilbert and Sullivan's, "The Gondoliers" -- "When everyone is somebody then no one's anybody."

                                  R Offline
                                  R Offline
                                  Rei Miyasaka
                                  wrote on last edited by
                                  #20

                                  My Performing Arts prof would argue differently :) He'd say that a nude figure is objectified. Not that I agree with much of what he says...

                                  1 Reply Last reply
                                  0
                                  • R Rei Miyasaka

                                    People use these words interchangeably. It confuses students. How would you define them? How do they differ?

                                    P Offline
                                    P Offline
                                    Paul Conrad
                                    wrote on last edited by
                                    #21

                                    reinux wrote:

                                    How do they differ?

                                    Not different at all as all the others have said.

                                    "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

                                    1 Reply Last reply
                                    0
                                    • S Shog9 0

                                      Routine, n., a set of instructions executed to perform a specific task. Subroutine, n., a routine invoked in some fashion from another routine, with a mechanism to return control to the calling location when the subroutine has finished. Subroutines may be referenced by address, line number, or a symbolic name depending on the language and system in use. Procedure, n., see Routine Function, n., a subroutine, invoked by name, that returns a value but does not otherwise alter the state of the system. Also another name for a subroutine in C and C-like languages. Method, n., in Object-Oriented Programming: a subroutine, invoked by name and context (object). Methods are generally used to retrieve information about the context object, or to modify it in some way, although they may do neither, instead acting as functions (in OO systems that do not provide a means of defining functions, this practice may be used to simulate them).

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

                                      You forgot lambda ;P

                                      xacc.ide - now with IronScheme support
                                      IronScheme - 1.0 alpha 1 out now

                                      S 1 Reply Last reply
                                      0
                                      • C Christian Graus

                                        No, as others have said, a method, and a procedure are the same thing. Even a function is the same thing, if it's inside a class, it's a *member* function. And a routine, I've not heard them called that by anyone for a long time.

                                        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

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

                                        Christian Graus wrote:

                                        And a routine, I've not heard them called that by anyone for a long time.

                                        Have you stopped programming in FORTRAN?

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

                                        C 1 Reply Last reply
                                        0
                                        • R Rei Miyasaka

                                          People use these words interchangeably. It confuses students. How would you define them? How do they differ?

                                          G Offline
                                          G Offline
                                          Gary R Wheeler
                                          wrote on last edited by
                                          #24

                                          For me, it's programming language dependent: Routine: Only for assembly language, FORTRAN, and command line batch files. Yes, I consider batch files programming, at least for purposes of this discussion. Method: C++ functions within a class, or COM methods within an interface. I don't C# (I'm near-sighted) or Java, but I imagine they're equivalent. Procedure: Pascal or Ada; any language that distinguishes between routines that return a value and those that don't. Procedures don't return a value, and can't be used on the right hand side of an assignment. Function: C/C++, or any language where a piece of code returns a value that can be used in a right hand side expression.

                                          Software Zen: delete this;
                                          Fold With Us![^]

                                          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