Trying to understand what a Method is, how can it be 'part of a class'?

how to apply feynman technique
feynman technique of learning
method definition
concept of method
the feynman technique: the best way to learn anything
feynman technique wiki
method in a sentence
feynman technique medical school

I've done some work with functions in Javascript, and thought that a Method was the Ruby name for the same. I recently did a technical interview and the interviewer was trying to help me debug by explaining how Methods were part of a class, and that it's an OOP thing.

I can't spot a functional difference between a Method and an equivalent Function, so I don't see what classes have to do with it.

Can you explain the whole 'Methods are part of a class' thing and why it matters? How can a Method be part of a class? Class as in an integer or a string?

The interviewer believed it would help, but it seems like a tiny technicality more than something useful.

Can you explain the whole 'Methods are part of a class' thing and why it matters? How can a Method be part of a class? Class as in an integer or a string?

Let's say you have two classes, Apple and Cake. Let's assume that when you sell an apple, it has a tax rate of 10%, and cake 20%. By splitting the methods into individual classes, we can define a different method for 'price_with_tax' to each class:

class Apple < ApplicationRecord
  def price_with_tax
    self.price * 1.1

class Cake < ApplicationRecord
  def price_with_tax
    self.price * 1.2

In javascript we wouldn't be able to do this, and would need to have 2 methods, 'add 10% tax' and 'add 20% tax'. By structuring the methods as we have, we're able to do:

apple = Apple.find(1)
cake = Cake.find(1)

100 Activities for Teaching Research Methods, These tensions and anxieties influence, or interfere with, a person's ability to solve Students should try to understand what they are reading rather than  The scientific method allows psychological data to be replicated and confirmed in many instances, under different circumstances, and by a variety of researchers. Through replication of experiments, new generations of psychologists can reduce errors and broaden the applicability of theories.

Methods are generally something that a class can do, class MailClient(for example) might have methods such as sendMail, getMail, forwardMail, etc. In OOP, methods should for the most part be something that a class can do.


The above code can be conceptualized as telling the class to invoke its getMail() behavior.

You may think of this in real-life terms such as:


Objects have behavior and attributes, the behaviors are the methods.

I'm trying to understand how "calling an object's method" works in , So, You got a class named Positive , there you got a public static void main function. As you remember, Java programs start executing at the  Research methods can be used alone to solve a problem, or explore a question as part of a piece of work. They can also be a key part of writing a thesis or dissertation. For more about this, see our section on Writing a Dissertation, and particularly Writing Your Methodology.


Class is like a blueprint/template. It has properties, methods etc. An object can be created with it. So an object can call method in class. Usually a method is created to perform an operation.


// a demo class
public class Animal{
    // a method
    public void sound(){
        // do something...

    // main class, we create an object and call sound() method
    public static void main(String[] args){
        Animal dog = new Animal();     // create an object so that we can use the method
        dog.sound();    // method call

Foundations of Economic Method: A Popperian Perspective, Socrates is on his way to the court, where he is to be tried for 'impiety'. Now, Socrates does not understand why he is being charged with impiety – that is to say,  Trying to understand people is a process that can take decades. Understanding the other side require different elemants, among them are; good communication, flexibility, patience and many more

ECRM2013-Proceedings of the 12th European Conference on Research , “The problem that we have got is that we do not try to understand the nature of methodologies and methods are rarely highlighted in research dissertations. Analysis (understanding of the root causes) …and for the “what to do about it” side to include: Possible countermeasures; Gantt chart; Follow-up (when will we verify the problem has been addressed? how will we know?) A3’s can be handwritten, or they can be written on a computer.

The Feynman Technique: The Best Way to Learn Anything, The Feynman Technique is a method of learning that helps you understand deeply, learn faster, and apply what you've learned. Read this article to supercharge  An abstract method is simply a function definition that serves to tell the programmer that the method must be implemented in a child class. Here is an example:

Method, orderly or systematic arrangement, sequence, or the like. the Method. Also called Stanislavski Method, Stanislavski System. a theory and technique of acting in  We can make a worthy attempt at getting closer to the correct meaning of what the other person is trying to tell us by keeping in mind how we are reacting to the situation. Experiencing their feelings by physically positioning ourselves similarly to their posture will help us understand them on a deeper level.

  • Well, ruby doesn't have functions. Only methods. And they all belong to some class.
  • "and why it matters" - classes are "data + behaviour". Methods are the behaviour part. Without them, classes become just dumb structs and are much less useful (from OOP perspective anyway)
  • @SergioTulentsev Doesnt ruby lambdas kind of a functions in js?
  • @MartinZinovsky: similar, but not quite the same. 1) They are fully-fledged objects themselves and because of that 2) they are not directly invocable (you can't do my_lambda(), only or my_lambda.() or one of 50 other ways)
  • "How can a Method be part of a class?" – by definition, that's essentially what makes it a method.
  • I think I get it, part of the problem was my understanding of what a class was. So is it that a Method requires a class, that is to say some information that can be contained within or without of the Method to work, and that the information is considered an object in itself?
  • I think your confusions comes from using functions in JS which don't require a class. You can call any function you've defined from anywhere in your code. Class orientated design is pretty much the opposite of this - you want the same method (function name) to do different things to different classes. A ruby method has to operate on a class (and where it looks like you aren't calling it on a class it's in fact happening without you realising - like when you call a method in a controller, the method is called on an instance of that controller class)
  • So my understanding now is that you can create some information as a class, and then apply a Method to it. Does a Method always require a class, and would you say that Methods are built around classes?
  • Methods/Functions in JavaScript do not require a class, although it helps greatly with code organization, and can improve readability by logically grouping a class's specific functions together. I would suggest reading more on JavaScript classes as they work differently than some OOP languages today. A lot of it boils down to personal preference, however, following known JavaScript coding conventions will make your code more easily understandable by a wider array of audiences.