But mathematics has a method in the madnessMath has functions.
This is a discussion on Superficial Syntax thread: Your favorite keywords/class names etc. within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Math has functions. But mathematics has a method in the madness...
and mathematics are boring
I'm a geek. I like weird acronyms for patterns or functionality, like RAII or SFINAE.
All the buzzt!
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
I'm ok with basically every convention mentioned in this thread.
I like the Pascal def of function vs method: functions return a value and methods don't.
Never learned VB as I don't learn fake languages
Either way, I don't agree with the definition. While you can surely say that you would expect a function to return a value... I don't really see why one would say a method would not return some sort of useful result. I generally use the two as mentioned above with classes. However, they are of subtle difference. I do, however, always use the term properties when talking about an object's constant or variable members.
Sent from my iPadŽ
In C++, and following the creator own terminology, member functions and member variables are the usual terminology used to describe functions and variables of a class. I understand this is not the same on all languages. If I recall correctly Java users use method and properties.
I don't see a problem with any way, albeit I prefer to use the term that is more spread in whatever language I'm working on in order to make myself better understood.
It's been always my thought that Method and Property usage seem to focus more on the object instance since this is where those nouns make more sense, I think. Whereas member function and member variable make more sense when describing a class... particularly in C++ where the terms pointer to method or friend method don't make much sense at all.
Getter and Setter on the other hand are mostly VB, and as far as I know also used as a terminology in C#. They don't seem to be that spread around C++ programmers. I prefer the collective term accessor functions but find myself using getter and setter when not thinking about it. This is so mostly, I think, because I always prefix them with get and set.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
Aren't procedures methodical in execution? I think they could be synonyms.
I only ever used Borland's Turbo Pascal IDE when I was learning programming (Pascal was my first non-line numbered language, prior to that it was all BASIC on an IBM PCjr), but the keywords were definitely Functions and Procedures.
I never heard "method" until I started learning Java, but I don't particularly like that term for a function. A method to me is a way of doing something, which is more like an algorithm than a function. The method is the algorithm used while the function is the implementation of the algorithm.
Learning C was a bit of a shock in that regard as instead of Functions and Procedures, everything was a function (even if it doesn't return anything), but the keyword "function" wasn't used. I've been doing some Visual Basic programming for a project at work (automating an Excel spreadsheet to generate a web page so the maintainer of the project only needs to update the spreadsheet and then hit the [Generate] button) which uses "Function" and "Sub" much like Pascal's function and procedure. I'm sure there's a reason for having to include the keywords, but bleh, I like C's syntax so much better.
abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "
I agree 100%.but I don't particularly like that term for a function. A method to me is a way of doing something, which is more like an algorithm than a function. The method is the algorithm used while the function is the implementation of the algorithm.
I always divide my C++ classes into the following sections:I prefer the collective term accessor functions but find myself using getter and setter when not thinking about it. This is so mostly, I think, because I always prefix them with get and set.
- member variables
- actions (actions is kind of a category that i defined myself)
That is the terminology I always heard, and when I first learned C++ the AP classes (apstring, apvector, apmatrix, etc.) divided their classes into those categories (except for actions), and so I do the same. I define accessors as functions that grab data from an object. modifiers are functions that modify the data of the object. actions are functions of the object that modify external things that are not part of the object (i.e. raising an event or drawing a shape on a surface which was passed into the function as an argument)
"Circular logic is good because it is."