PDA

View Full Version : Superficial Syntax thread: Your favorite keywords/class names etc.



indigo0086
06-03-2008, 08:15 AM
So what are your favorite keywords that denote something either unique to a language or shared across a language?

Personally I prefer the term Function rather than Method. I guess I was introduced to it firstin C/C++ but it just has a more reminiscent ring to it.

Dino
06-03-2008, 08:25 AM
If it's OO, I prefer the term Method over Function.

I despise "Property" with OO.

indigo0086
06-03-2008, 08:48 AM
I also don't like the term "Getter/Setter". I prefer properties actually.

DavidP
06-03-2008, 08:51 AM
I despise the terms "property" and "method". I think they are the bane of our existence.

I think they should always be referred to as "function" and "member variable".

laserlight
06-03-2008, 09:15 AM
In C++, methods are virtual member functions :)

Dino
06-03-2008, 09:37 AM
Maybe someone will post that has an opinion... :rolleyes:

DavidP
06-03-2008, 09:37 AM
I once read that a "method" is any member function of a class, and a "function" is any function that is not part of a class. Despite what might define a method or a function, I still despise "method" and like to use "function" because I view the term "method" as a Java-ization of the programming community. Yes I am completely biased. :)

SlyMaelstrom
06-03-2008, 09:51 AM
I don't think too much about the terminology and try not to let any of it get to me. However, I would agree with indigo about "getters" and "setters." That always seemed very VB to me. I personally like the term (and concept) of Polymorphism because it makes me feel more like a wizard than any other programming term.

Dino
06-03-2008, 09:51 AM
I do code in Java, but I cut my teeth on OO programming with Ruby and its terms.

Classes
Class Instance Variables
Class Instances
Instance variables
Class Methods
Instance Methods

I occasionally use the "member" adjective when discussing with Java programmers, but only when talking Java. Haven't gotten that deep with C++ yet.

whiteflags
06-03-2008, 09:54 AM
I'm more intrigued by the buzzwords softwae companies twist into sentences in press releases, such as "robust" and "synergy."

Dino
06-03-2008, 10:00 AM
I like encapsulation and reflection.

In my day job, "FFDC" is a big term. Stands for First Failure Data Capture, with means if the software abends, it is able to capture the failing environment so the user does not have spend time recreating the failing scenario.

indigo0086
06-03-2008, 10:02 AM
I prefec object to Class Instance, and members of member variable to Class varables.

abachler
06-03-2008, 10:24 AM
I like the term method, it refers specifically to a member function. Properties to me is specifically a member variable. I use the terms interchangeably depending on who im speaking with. I guess I'm really still a C programmer though.

laserlight
06-03-2008, 10:29 AM
I personally like the term (and concept) of Polymorphism because it makes me feel more like a wizard than any other programming term.
lol, come to think about it, I agree, but I would include type cast into the mix :D

DavidP
06-03-2008, 11:33 AM
I mainly prefer "function" because I like to go back to programming's roots: math. Math has functions.

I also prefer "elegant" rather than "robust". I don't mind robust though. I think it is a good word. I just like thinking of something as "an elegant way of doing things" or "an elegant solution."

laserlight
06-03-2008, 11:36 AM
Math has functions.
But mathematics has a method in the madness :D

indigo0086
06-03-2008, 11:45 AM
and mathematics are boring :(

CornedBee
06-03-2008, 12:09 PM
I'm a geek. I like weird acronyms for patterns or functionality, like RAII or SFINAE.

Perspective
06-03-2008, 01:04 PM
I mainly prefer "function" because I like to go back to programming's roots: math. Math has functions.


I think that's why some people prefer method. Not all programming functions are actual functions in the math sense.



I also prefer "elegant" rather than "robust". I don't mind robust though. I think it is a good word. I just like thinking of something as "an elegant way of doing things" or "an elegant solution."

I generally hear robust used to describe systems that perform well during failures, bad input, or malicious input. I think its quite different from elegant.


I'm ok with basically every convention mentioned in this thread.

Thantos
06-03-2008, 01:37 PM
I like the Pascal def of function vs method: functions return a value and methods don't.

SlyMaelstrom
06-03-2008, 01:42 PM
I like the Pascal def of function vs method: functions return a value and methods don't.I see... so Method according to Pascal is the equivilent to a Visual Basic's Sub.

Thantos
06-03-2008, 01:44 PM
/shrug
Never learned VB as I don't learn fake languages ;)

SlyMaelstrom
06-03-2008, 01:50 PM
/shrug
Never learned VB as I don't learn fake languages ;)Surely you've encountered it in your life experiences. :)

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.

Mario F.
06-03-2008, 01:58 PM
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.

CornedBee
06-03-2008, 02:22 PM
I like the Pascal def of function vs method: functions return a value and methods don't.

Aren't the latter called procedures?

whiteflags
06-03-2008, 02:25 PM
Aren't procedures methodical in execution? I think they could be synonyms.

Thantos
06-03-2008, 02:26 PM
Aren't the latter called procedures?

I would have to double check as I haven't done Pascal in a while.

jEssYcAt
06-03-2008, 03:03 PM
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.

DavidP
06-03-2008, 03:57 PM
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 agree 100%.



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.


I always divide my C++ classes into the following sections:
- member variables
- constructors/destructors
- accessors
- modifiers
- operators
- 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)

indigo0086
06-03-2008, 09:32 PM
/shrug
Never learned VB as I don't learn fake languages ;)

Fake languages used to develop real software...

THERE GOES THE NEIGHBORHOOD!

P4R4N01D
06-03-2008, 11:40 PM
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.I heard in a python lecture that a method is a function that operates on an object and a function takes an object or a series of objects. E.g. (I will make up an example):

:WNDCLASS.hCursor.LoadCursor(NULL, IDC_ARROW); //method, if this existed
DialogBox(hinst, MAKEINTRESOURCE(DLG_0100), NULL, (DLGPROC) DialogFunc); //Function
string.split(' ') random python example of a method (not C)There are probably better examples of methods in C++, but I haven't learnt it yet. Helps distinguish the difference though. As for a property, this is an example:

WNDCLASS.lpszClassName

zacs7
06-03-2008, 11:49 PM
I'd say objects have methods (hence when dealing with OOP I call them methods) otherwise it's a function.

But I don't like the terms, "accessor" & "mutator".

brewbuck
06-04-2008, 12:17 AM
I've always liked the term "brittle." In other words, code that may work, but doesn't easily support arbitrary changes either to itself or to the structure of code around it. It's ready to snap in half like a granola bar left to dry in the desert sun.

As far as the function/method debate, I don't think it's really that important. The term "function" is already far removed from the mathematical definition of a function as a mapping from values to values. Many C and C++ "functions" serve no purpose except for their side-effects, a decidedly non-functional role.