Law & Legal & Attorney Wills & trusts

How to Differentiate Between Primitive & User-Created Methods

    • 1). Read through your code until you see where the type was instantiated. Examine its type and consult your documentation to see if it is a primitive or user-created: if the type is primitive, its associated methods are primitive in the great majority of languages.

    • 2). Open source code if you're using an object-oriented language and need to differentiate between a primitive and user-created method in an instantiated class. Read through the list of members of the class to identify those that are primitive and those that are not.

    • 3). Evaluate the method to see if it performs a very basic function related to numerical or string manipulation: the ".ToString," "math()," "char()" and other basic methods are nearly always primitive. Consult the documentation provided by your programming framework or language to asses whether the method is primitive, if in doubt.

    • 4). Trace the inheritance hierarchy, if your object was derived from another object. Locate the parent object that contains the method and examine its underlying data type.

    • 5). Review source code to locate extension methods if you're using a Microsoft .NET language, because these languages often contain an obscure feature called an "extension method." Search for all static classes and review them to see if they contain an extension method that in turn adds a method to a fundamental data type. Alternatively, you may simply wish to search for the method in the documentation provided by Microsoft -- if Microsoft has documented the method in the string, char or numerical base classes, it is primitive.



Leave a reply