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

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...

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    Math has functions.
    But mathematics has a method in the madness
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    and mathematics are boring

  3. #18
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    I'm a geek. I like weird acronyms for patterns or functionality, like RAII or SFINAE.
    All the buzzt!
    CornedBee

    "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

  4. #19
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by DavidP View Post
    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.

    Quote Originally Posted by DavidP View Post
    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.

  5. #20
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I like the Pascal def of function vs method: functions return a value and methods don't.

  6. #21
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,062
    Quote Originally Posted by Thantos View Post
    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.
    Sent from my iPad®

  7. #22
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    /shrug
    Never learned VB as I don't learn fake languages

  8. #23
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,062
    Quote Originally Posted by Thantos View Post
    /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.
    Sent from my iPad®

  9. #24
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,383
    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.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

  10. #25
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Quote Originally Posted by Thantos View Post
    I like the Pascal def of function vs method: functions return a value and methods don't.
    Aren't the latter called procedures?
    All the buzzt!
    CornedBee

    "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

  11. #26
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,524
    Aren't procedures methodical in execution? I think they could be synonyms.

  12. #27
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Quote Originally Posted by CornedBee View Post
    Aren't the latter called procedures?
    I would have to double check as I haven't done Pascal in a while.

  13. #28
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    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 "

  14. #29
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    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)
    My Website

    "Circular logic is good because it is."

  15. #30
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Quote Originally Posted by Thantos View Post
    /shrug
    Never learned VB as I don't learn fake languages
    Fake languages used to develop real software...

    THERE GOES THE NEIGHBORHOOD!

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PlaySound
    By cangel in forum C++ Programming
    Replies: 16
    Last Post: 10-08-2009, 05:29 PM
  2. Simple thread object model (my first post)
    By Codeplug in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2004, 10:34 PM
  3. Replies: 2
    Last Post: 04-12-2004, 01:37 AM
  4. Closing thread handles from within
    By Sang-drax in forum Windows Programming
    Replies: 6
    Last Post: 09-26-2003, 12:18 PM
  5. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 09:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21