As an example below, should the isClient() function be part of the Attendee class?import Foundation///A Node that can be used with the CriteriaEvaluator to determine if clients are present in a Meeting.class ClientCriteria  : Node {/** Calculates a score from 0..1 to identify the likelihood that a list of Attendees contains a client */func score(attendees : [Attendee]) -> Double{    for attendee in attendees    {        if isClient(attendee: attendee)        {            return 1        }    }    return 0}private func isClient(attendee: Attendee) -> Bool{    let IBMEmailRegex = [\\/\\w+\\s*]+\\/IBM\\@?\\w*$    if attendee.email.contains(IBMEmailRegex) {        return false    }    else{        return true    }}}
When should a function that calculates an object's property be defined within that same class?
object oriented;swift language
isClient() is a true function. It doesn't rely on state and always returns the same value given the same input.This means it can be used anywhere. If it's valuable elsewhere, consider moving it to the super class, or perhaps into a utility class. If it's only valuable here, then keep it here to prevent clutter. You can always move it later if someone else can make use of it.one minor personal preference: I preferreturn !attendee.email.contains(IBMEmailRegex) to what you have here. I prefer small code :)