Routines, methods, procedures and functions
-
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! | sighistAussies... :rolleyes: ;)
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
People use these words interchangeably. It confuses students. How would you define them? How do they differ?
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).
-
Been eating lots of beans today, I see.
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 )
-
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."
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...
-
People use these words interchangeably. It confuses students. How would you define them? How do they differ?
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
-
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).
-
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 )
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
-
People use these words interchangeably. It confuses students. How would you define them? How do they differ?
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![^] -
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
I skipped that entirely. Thankfully.
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 )
-
You forgot
lambda
;Pxacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 1 out now