I have been doing a lot of object-oriented programming lately, so my question is a little related to it.

I was teaching mathematics (geometry) to my friend and I came up with a question:

In Scala we would have circle probably defined as this:

class Circle(val radius: Double) {

def area = π*radius^2

def diameter = 2*radius



So Circle class has a property name "radius" and methods (area, diameter, etc.) which use "radius" in calculations.

Are these all "properties" of a circle in mathematics, or are there different terms for radius (since everything is defined by radius) and methods such as an area?

  • $\begingroup$ A circle is defined fully its radius... if you fix a coordinate system you need a centre and a radius. $\endgroup$ – JP McCarthy Nov 23 '15 at 11:18

From a programmer's point of view, these are properties if you can invoke them without a (void) argument list.

Like print MyCircle.Area, rather than MyCircle.Area(), which would be a method.

If the properties are wrapped, one could also consider that GetArea() is a property, in the same sense as GetRadius().

In your description, Area seems to be a read-only property (hence no setter). But it could be otherwise, by defining

def SetArea(val Area: Double) radius= sqrt(Area / π)
  • $\begingroup$ I don't known the Scala syntax. $\endgroup$ – Yves Daoust Nov 23 '15 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.