39

ISBN : 978-81-963532-2-3 (E-Book) • Establish the changes made to the function’s input parameters after execution of the function. Pure mathematical functions do not change their input and therefore this type of assertion is not necessary for pure functions. • Combine all of the above into pre and post conditions of the function. Example1: - Specify the pre- and post-conditions of a function that takes a real number as argument and returns half the input value if the input is less than or equal to 100, or else returns double the value. f (x : real) : real pre : x ∈ R post : {(x≤100)  (f(x) = x/2)} ∨ {(x>100)  (f(x) = 2∗x)} Example2: - Axiomatically specify a function named search which takes an integer array and an integer key value as its arguments and returns the index in the array where the key value is present. search(X : IntArray, key : Integer) : Integer pre : ∃ i ∈ [Xfirst….Xlast], X[i] = key post : {(X′[search(X, key)] = key)  (X = X′)} Here the convention followed is: If a function changes any of its input parameters and if that parameter is named X, and then it is referred to as X′ after the function completes execution faster. SOFTWARE DESIGN Software design is a process to transform user requirements into some suitable form, which helps the programmer in software coding and implementation. For assessing user requirements, an SRS (Software Requirement Specification) document is created whereas for coding and implementation, there is a need of more specific and detailed requirements in software terms. The output of this process can directly be used into implementation in programming languages. 34 Software Engineering Keerthana P, Manasa KN, Ganga D Bengal

40 Publizr Home


You need flash player to view this online publication