abstract data types via the constructor before any operation can be used other than the initialization requirementan operation may not have any other preconditions it all depends on the type of adt and the respective operation likewisesome operations may not have postconditionas is the case for simple access methodswhich simply return value without modifying the adt instance itself throughout the textwe do not explicitly state the precondition and postcondition as suchbut they are easily identified from the description of the adt operations when implementing abstract data typesit' important that we ensure the proper execution of the various operations by verifying any stated preconditions the appropriate mechanism when testing preconditions for abstract data types is to test the precondition and raise an exception when the precondition fails you then allow the user of the adt to decide how they wish to handle the erroreither catch it or allow the program to abort pythonlike many other object-oriented programming languagesraises an exception when an error occurs an exception is an event that can be triggered and optionally handled during program execution when an exception is raised indicating an errorthe program can contain code to catch and gracefully handle the exceptionotherwisethe program will abort python also provides the assert statementwhich can be used to raise an assertionerror exception the assert statement is used to state what we assume to be true at given point in the program if the assertion failspython automatically raises an assertionerror and aborts the programunless the exception is caught throughout the textwe use the assert statement to test the preconditions when implementing abstract data types this allows us to focus on the implementation of the adts instead of having to spend time selecting the proper exception to raise or creating new exceptions for use with our adts for more information on exceptions and assertionsrefer to appendix implementing the adt after defining the adtwe need to provide an implementation in an appropriate language in our casewe will always use python and class definitionsbut any programming language could be used partial implementation of the date class is provided in listing with the implementation of some methods left as exercises date representations there are two common approaches to storing date in an object one approach stores the three components--monthdayand year--as three separate fields with this formatit is easy to access the individual componentsbut it' difficult to compare two dates or to compute the number of days between two dates since the number of days in month varies from month to month the second approach stores the date as an integer value representing the julian daywhich is the number of days elapsed since the initial date of november bc (using the gregorian calendar notationgiven julian day numberwe can compute any of the three gregorian components and simply subtract the two integer values to determine