Passing the Current Object to a Global Function
As you begin to recognize that you are writing repetitive code in more than one object's
            functions, triggers, or validation rules, you can refactor that common code into a
            global function that accepts a parameter of type Object and then have
            your various usages call the global function. Since a global function does not have a
            "current object" context, you need to pass the current object as an argument to your
            global function to provide it the context you want it to work with. When you define the
            global function, the Object type is not shown in the drop-down list of
            most commonly used argument types, but you can type it in yourself. Note that the value
            is case-sensitive, so Object must have an initial capital letter
            "O".
When writing code in an object trigger, object function, or other object script, you can
            use the expression adf.source to pass the current object to a global
            function that you invoke. Referencing Original Values of Changed Fields shows an
            example of putting these two techniques into practice.