How I may help
LinkedIn Profile Email me!
Call me using Skype client on your machine

Reload this page Programming Languages

This page examines the differences among programming languages.

Take the Brainbench certification test on OO Concepts

There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies; the other is to make it so complicated that there are no obvious deficiencies. —C.A.R. Hoare

 

Topics this page:

  • Language Features
  • Naming Conventions
  • Reserved Words
  • Case/Switch Statements, For, While, Recursive Loops
  • Stop It!
  • Operators in Precedence:
  • Arithmetic
  • Comparative
  • Typecasting
  • Your comments???
  •  

    Site Map List all pages on this site 
    About this site About this site 
    Go to first topic Go to Bottom of this page

    Search

    Set screen Language Features Compared

      Adapted from John December's Presenting Java

      Feature C++ Java C#
      Inheritance Multiple Single Multiple
      Preprocessor Yes No Yes
      Header files Yes No [1] Yes
      Operator Overloading Yes No Yes
      Pointers Yes No Yes
      Auto. Garbage Collection No Yes Yes*
      Native multi-threading No Yes Yes
      Exception handling Yes Yes Yes
      Encapsulation ? ?
      Polymorphism ? ?

      Set screen Inheritance "is a" relationship

      An object that is inherited from another object automatically receives all of the variables and methods defined by the parent. The extends keyword is used to indicate class inheritance.

      Unlike C, a new class written in Java can extend only one class. Java supports single inheritance. However, a Java program can use many interfaces. Interfaces can be used as data types. Interfaces specify the methods the class must have.

      The outcome from an Object Oriented (OO) approach to Analysis and Design is an Object Model. During the design of an application, functions are identified and grouped based on common objectives and their relationship to each other:

      • is a subfunction (or subclass), and
      • Guitarist has a guitar. contained within the other function (or class)


    Go to Top of this page.
    Previous topic this page
    Next topic this page

      Set screen Preprocessor Compiler Directive $Include

      Preprocessors handle compiler directives that are written as comments in code. An example:
        '$Include header files.

      In C, implementation-specific values are defined in the C header file limits.h. Constants are also defined in a header file.

      Define an include (.inc) file that defines constants for return values. Include this file in the source code for both the module which calls a function and the module which services the function. This way, if the value changes, the changes will be automatically reflected in all using and consuming functions.

      The RobotSQA uses

      In pure Java, implementation-specific values are defined in .ini files. Constants are defined with the final modifier.

     

    OO and Java Development: Guidelines and Resources by Mark.Fussell at ChiMu.com.

    $156 Object Oriented Systems Development: Using the Unified Modeling Language by Bahrami, Ali. (Irwin McGraw-Hill, 1999)


    Go to Top of this page.
    Previous topic this page
    Next topic this page

      Set screen Encapsulation

      Unlike C, COBOL, and other procedureal languages that focus on data members being manipulated by functions, Java and other Obect Oriented languages focus on the relationships among classes (also called user defined types). Data is hidden (encapsulated) and methods are instantiated (created) with data.

      Java code is modular: each class implements one function and functions are not intertwined. In other words, the members of one method must not be supporting the accomplishment of the function of another class.

      Each OO function is implemented as a class. Access is isolated One class can only see what it needs to access. Access is only available if there is a need to know or a need to use the class or the member of the other class.

      States should only be represented by variables that are directly accessible by the object itself, and behaviors should only be represented through methods. Variables of an object should only be accessible outside of the object through methods. That way, if changes are needed within the structure or operation of the object, they can happen without affecting any code outside of the object.

      The benefits of this:

      • Hides details of implementation. You can modify one class without having to worry about the changes affecting the behavior of another class. The only factor that can affect the other class is the interface that enables the classes to communicate.
      • Extensibility. You can inherit a class and its behavior in a subclass, and add to its behavior in the subclass. It keeps the code small and efficient.
      • Modulariy. You can manage and maintain modular code much better than you can if it were all one big class.
      • Safety. One class does not have access to members of classes that it does not need have access to.

      There are two ways Programmers reuse objects within their applications without having to always rewrite everything from scratch.

      • Composition "has a" relationship
      • Composition is using an object within another object.

      Set screen Polymorphism - Interfaces

      Each set of attribute definitions defines a signature to an interface. Each interface defines a cohesive set of behaviors performed by classes and components. Interfaces are realized when implementing the attributes and operations of the interface.

      A class or component may not implement an interface. And several classes or components can implement the same interface.

      Java interface names (such as Serializable) end in -able or -ible
      Microsoft coding practice typcially prefix interface names with a capital I, resulting in names such as IComponent.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Naming Conventions

      Abbreviation Item
      mnu Menu
      btn Button
      Pascal casing means that the first letter of each word is capitalized.

      Camel casing — where the first letter of the first word is NOT capitalized — is used to distinguish between two items that would otherwise have the same name, such as when defining property set and get.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Reserved Words

      Note: VB keywords have initial caps unless otherwise indicated.

      Javascript Java MS
      C++
      MS
      VB
      MS
      C#
      abstract   
        as
        base
      booleanbool
      break    
      byte
      case
      cast 
      catch
      char
        checked
      class
      const
      continue  
      default
        delegate
      delete 
      do
      double
      else
        enum
      extends 
        event
        explicit
        extern
      false  
      final 
      finally
        fixed
      float  
      for
        foreach
      function   
       future  
       generic  
      goto
      if
      implements 
        implicit
      import Imports  
      in
       inner 
      instanceof 
      int  Integer int
      interface
        internal
        is
        lock
      long
        namespace
      native 
      new
      null  
        object
       operator  
       outer  out
        override
      package 
        params
      private
      protected
      public
       rest 
        readonly
        ref
      return
        sbyte
        sealed
      short
        sizeof
        stackalloc
      static
       strictfp 
        string
        struct
      super 
      switch  
      synchronized 
      this
      throw
      throws 
      transient 
       true
      try
       typeofTypeOf
        uint
        ulong
        uchecked
        unsafe
        ushort
        using
      var 
        virtual
      void  
       volatile 
      while
       with 

      VB.NET keywords:


      AddHandler
      AddressOf
      Alias
      And
      AndAlso
      Ansi
      As
      Assembly
      Auto
      ByRef
      ByVal
      Call
      Case
      CBool
      CByte
      CChar
      CDate
      CDec
      CInt
      CLng
      CObj
      CShort
      CSng
      CStr
      CType
      Date
      * Decimal
      * Declare
      Delegate
      Dim
      DirectCast
      Each
      Elseif
      End
      Enum
      Erase
      Error
      Event
      Exit
      Friend
      Get
      GetType
      Handles
      In
      Inherits
      Integer
      Is
      Lib
      Like
      Loop
      Me
      Mod
      Module
      MustInherit
      MustOverride
      MyBase
      MyClass
      Namespace
      Next
      Not
      Nothing
      NotInheritable
      NotOverridable
      Object
      On
      Option
      Optional
      Or
      OrElse
      Overloads
      Overrides
      ParamArray
      Preserve
      Property
      RaiseEvent
      ReadOnly
      ReDim
      Rem
      RemoveHandler
      Resume
      Select
      Set
      Shadows
      Shared
      Single
      Step
      Stop
      String
      Structure
      Sub
      SyncLock
      Then
      To
      Unicode
      Until
      When
      With
      WithEvents
      WriteOnly
      Xor

      With C#, a keyword can be used as a variable name by appending the "at" symbol @ in front of the name, such as @Xor.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Programming Control Logic

     

    Complexity

    McCabe suggests that developers should keep each module's cyclomatic complexity number below 10. This numer defines the minimum number of tests to exercise a complete basis set of paths through the control flow graph of a single module. v(G) is calculated by adding up every decision in the module — 1 for each if and while statement, one for each edge and node. called predicates.

    August 1996 NIST Special Publication 500-235 by Arthur H. Watson and Thomas J. McCabe

    Javaprepare.com by Naveen Gabrani

    Data Structures & Algorithms in Java by Robert Lafore (Sams, 1998), 617 pages.

    Typically, 50% of the run time within a program is concentrated within only 4% of the code. —Knuth, D., "An Empirical Study of FORTRAN Programs," Software Practice and Experience, April-June 1971.


    Go to Top of this page.
    Next topic this page

    Set screen Nested If-Else Statements

      C

      In C and Java there are several formats:

      if studentGrade >= 60 {
          "Passed"
      } else {
          "Failed"
      }

      Tertiary operator:

      studentGrade >= 60 ? "Passed" : "Failed"

      A if-else-if ladder can be more efficient and easier to read than a case statement:

      if(month == 12 || month == 1 || month == 2)
        season = "Winter";
      else if(month == 3 || month == 4 || month == 5)
        season = "Spring";
      else if(month == 6 || month == 7 || month == 8)
        season = "Summer";
      else if(month == 9 || month == 10 || month == 11)
        season = "Autumn";
      else
        season = "Bogus Month";

      This is useful for logic based on strings and other objects, because Java case statements only handle numbers.

      Where ELSE IF is employed in C, PL/SQL uses ELSIF but standard PSM (Persistent Stored Modules) expects ELSEIF.

      If you need to add an item upon not finding it in a Hashtable, avoid two operations and use the get method to get the value within the if statement instead of a containskey method followed by a put.

      if ( (md = (MyData)htable.get (keyCode) != null ){
        return md;
      } else {
        // insert New Element into Hashtable here.
      }

      Unix Shell Scripts

      In UNIX shells, if commands are ended with if spelled backward. Multiple branching is specified using "elif".

      echo "read word 1 \c"
      read word1
      echo "read word 2 \c"
      read word2
      if [[ test !-r file1 ]]  
      	echo "cannot open file1"
      else
      	elif test "$word1" = "$word2" then
      		echo "The words are the same"
      	else
      		echo "The words are not the same"
      fi 
      

      A space is mandatory before and after each pair of double brackets used to access extended tests.

      SAP ABAP IF/ELSE Conditional Programing

      Remember the periods (not commas):

      if expression1.
      ABAP statements.
      [elseif expression2.
      ABAP statements.]
      [else. 
      ABAP statements.]
      endif.
      

     

      In UML (and traditionally), the diamond is used to illustrate if/else statements.

    Go to Top of this page.
    Next topic this page

    Set screen Case/Switch Decision Statements

      Reminder A common mistake is leaving out the break; statement.

        switch (inputChar) {
           case 'A':
           case 'a':
              System.out.println("\"" + args[0] + "\" for \"Apple\"");
              break;
           case 'B':
           case 'b':
              System.out.println("\"" + args[0] + "\" for \"Boy\"");
              break;
           case 'C':
           case 'c':
              System.out.println("\"" + args[0] + "\" for \"Cat\"");
              break;
           case 'D':
           case 'd':
              System.out.println("\"" + args[0] + "\" for \"Dog\"");
              break;
           default:
              System.out.println("\"" + args[0] + "\" - Whatever!");
              break;
        }
        

      C and Java compilers are silent when it sees a “drop-through”, but the C# compiler issues an error.

      Use a consistent design throughout your application for handling the situation when the case value is not anticipated.

      C#

      Unlike in Java, C, or C++, C# switch statements can have a string as its governing type, with a value of null is permitted as a case label constant.

      Case statements in UNIX shells use *) to signal the default and case spelled backwards.

        echo "Enter a, b, or c: \c"
        read sletter
        case $sletter in
        a|A)
        echo "You entered an a"
        ;;
        b|B)
        echo "You entered a b"
        ;;
        c|C)
        echo "You entered a c"
        ;;
        *)
        echo "You did not enter an a, b, or c"
        ;;
        esac
        

      Ruby

      Ruby's range construct:

      answer = case age
        when 0..17 then puts "not adult"
        else puts "adult"
      end
      

      SAP ABAP CASE Conditional Programing

      Remember the periods (not commas):

      case counter.
      when value1.
      ABAP statements.
      when value2.
      ABAP statements.
      endcase.
      


    Go to Top of this page.
    Next topic this page

    Set screen For Counter-Controlled Repetition

      This routine (a set of Java statements) steps through a series of values and performs some action based on whether each value meets some predefined criteria.

      This loop is performed 19 times because it starts from 1:

        int loopLimit = Interger.parseInt (args[0]);
        outer_loop: for (int i = 1 ; i <= loopLimit ; i++ ) {
            for(int j = 0; j < 20; j++) {
                // some code
               if( boolean_expression ) {
                   continue outer_loop;
               }
           }
        }
        

      To leave a loop conditionally, PL/SQL uses EXIT, or EXIT WHEN(...). PSM uses LEAVE, and puts the leave-statement in an if-statement to exit conditionally.

      The generic syntax of a for loop using teritiary operators:

        for( initialization value ; conditional expression ; update increment expression ) {
            statements
        }

      The four basic elements involved in counter-controlled repetition:

      • The name of the loop counter, which is also called the loop variable (“i”)
      • The initial value of the loop variable (“1”)
      • The update expression, which determines how the loop variable is incremented (or decremented) each time through the loop (“i++”)
      • The condition that determines when to continue the loop (“i <= loopLimit”)

      Reminder The for loop exits when the condition in the middle (such as x <= loopLimit) is evaluated as false.

      Reminder One of the most common errors is the one-off error, typically caused by replacing <= with < in the condition portion of the for loop.

      C# provides the foreach statement to iterate through a collection without using multiple statements. This avoids the need to explicitly extracting each element from a collection. Best of all, foreach syntax is specific to the particular collection.

        foreach (int number in numbers) {     
        	Console.WriteLine(number); 
        }

      An example using the ASP Fields Collection:

        For Each ofield in oRS.Fields
            Response.Write ofield.name
            Response.Write ofield.type
        Next
        
      In UNIX shells, the index variable following the "for" is used to iterate from 0 through the list after keyword "in".

        for animal in dog cat rabbit iguana cow
        do
        	echo "I see a "$animal 
        done
        

        A space is mandatory before and after each pair of double brackets used to access extended tests.

      SAP ABAP Do Loop Programing

      Remember the periods (not commas):

      do n times.
      counter = counter + 1.
      if counter = 2.
      continue. "another loop pass.
      if counter = 3.
      exit. "terminate loop.
      if counter = 4.
      stop. "jump out to end-of-selection section.
      else.
      	ABAP statements.
      enddo.
      


    Go to Top of this page.
    Next topic this page

    Set screen While Loops

      Reminder A while loop in C may never be processed since it checks for exit condition before the code is executed. This is also why you should initialize when counters to 1 rather than zero.

        i = 1, j = 1;
        
        while (i <=loopLimit) {
           j = 1;
           while (j <= i) {
              System.out.print ("*");
              j++;
           }
        
           System.out.println (" ");
           i++;
        }
        
      Use do loops for code that should be processed at least once, because checking is done after the embedded code is executed.

        class WhileTest {
          public static void main (String args[]) {
        
           int loopLimit = Integer.parseInt (args[0]);
           int i = 1;
        
           do {
             System.out.println ("The loop count is: " + i);
             i++;
           } while (i <=loopLimit);
          }
        } 
        

      Did I mention that while loops check for its exit condition before the embedded code is executed? ;)

      A VBScript/ASP example of looping through a file until End Of File:

        Response.Write "<table>"
        Do while NOT oRS.EOF
           Response.Write "<tr><td>&" & oRS("LastName").Value & "nbsp;</td></tr>"
           oRS.MoveNext
        Loop
        Response.Write "</table>"
        oRS.Close
        Set oRS=Nothing
        

      In UNIX shells:

        num=0
        while test $num -le 10 do
        	echo $num
        	let num=num+2
        done
        echo "The value is " $num
        
        
        until false do
        	commands
        done
        

      SAP ABAP While Loop Programing

      Remember the periods (not commas):
      Processing is terminated when the logical expression is false.

      while counter < 10
      ABAP statements.
      counter = counter + 1.
      endwhile.
      


    Go to Top of this page.
    Next topic this page

    Set screen Loops of Logic: Recursion: Factorials

      Recursion is when a base class/function calls itself (in a disciplined, hierarchical manner). One reason for recursion is for the calculation of factorials (written as n!), the product of

        n * ( n-1 ) * ( n-2 ) * ... * 1

        For example, 5! (5 factorial) is the product of 5 * 4 * 3 * 2 * 1

        “If the number is less than zero, reject it. If it isn't an integer, round it down to the next integer. If the number is zero or one, its factorial is one. If the number is larger than one, multiply it by the factorial of the next smaller number.” To calculate the factorial of any number that is larger than 1, you need to calculate the factorial of at least one other number. The function you use to do that is the function you're in the middle of already; the function must call itself for the next smaller number, before it can execute on the current number.

      Here is an example written in JScript code, using the java.math package and the keyword return:

        function factorial(aNumber)  {
        // If the number is not an integer, round it down:
        aNumber = Math.floor(aNumber);  
        // If the number is less than zero, reject it:
        if (aNumber < 0)  {  
            return "not a defined quantity";
            }
              // If the number is 0 or 1, its factorial is 1:
              if ((anumber == 0) || (anumber == 1))  {  
              return 1;
              }
                // Otherwise, recurse until done:
                else return (anumber * factorial(anumber - 1));  
        }
        

      Recursion was used to create this artwork


    Go to Top of this page.
    Next topic this page

    Set screen Stop It!

      To unload a Java executable from memory:
        System.exit(0);

      The destroy() method is invoked by the browser or applet viewer to notify the applet to release any resources it has used. The applet viewer or browser decides when this is necessary.

      If you are running a Java program from a Console Window and the cursor does not provide a system prompt after the program is done, terminate the program by pressing

        Ctrl-C



    .

    Go to Top of this page.
    Next topic this page

    Set screen Precedence of Operators

      Below are operators listed in order of precedence, from the highest (evaluated firs), to the lowest (evaluated last).

      Reminder Java operators behave slightly differently than in traditional programming languages. For example: d + (1/2) * d and d + d / 2 are not the same. When Java encounters “(1/2)” or an operation involving integer data types, it performs integer division and throws away (truncates) the remainder. To avoid this, specify “(1.0/2.0)” to force floating point division.

    Set screen Unary Operators

      Parentheses

      Parentheses () are used to control the order of precedence. They ensure that expressions are evaluated as intended.

      Boolean NOT

      The ! (exclamation point character) negates whatever logic is within the parentheses to its right. For example, the result from this statement is true when the variable age contains 21. This simplifies coding an if-then-else statement into just an if-then statement, such as when testing for a lack of desired conditions.

      if (!(age == 21))

      Bitwise Negation

      The ~ (tilde character) negates bits from false to true. Used only with integral data types (int, short, byte, char, long) .

    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Typecasting

      Typecasting, also known as casting, is when programmers explicitly instruct Java to convert the value of a datatype to a new value with a new datatype. This is as opposed to conversion, or implicit type changing performed by Java without programmer intervention.

      An explicit cast is needed to convert a narrowing conversion to a datatype with less digits results in a loss of precision: This statements results in an explicit convertion before the arithmetic is performed:

        x = (byte) (y * 4);

      Narrowing occurs with the transformation of a data type with a larger range and precision into a smaller data type, resulting in a loss of data.

      Compile-time casting rules when transforming between a NewType and OldType:


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Arithmetic Operators

      Operator Description Sample Coding Before After
      x y x y
      * Multiplication x = x * y 5 7 35 7
      / Division x = x / y 35 7 5 7
      % Modulus (remainder) x = x % y 21 5 1 5 (5 * 4) = 20
      + Addition x = x + y 12 27 39 27
      - Subtraction x = x - y 39 12 27 12

      One use for Modulus is to determine whether aNumber is odd or even: calculate aNumber modulus 2. A result of zero means aNumber is even.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Shift Operators

      Shifting operations move the bit pattern (binary representation) of integral (int or long) data types left or right.

      This is commonly done in control systems to align bits that are read from, or to be written to, I/O ports. Tricky programmers use it to efficiently perform integer multiplication or division by powers of two (doubling values).

      Shifting can be used with confidence in Java because the bit-level representation of all types is defined and platform-independent.

      Operator Description Sample Coding Result if
      x=6, y=5
      Result if
      x=5, y=5
      << shift left (multiply by power of 2) . . . Trailing bits are discarded. Java does not have the Assembly languages rotate operation to define the value of such bits.
      >> shift right (divide by power of 2) . . . Leading bits are padded with zero.
      >>> unsigned (logical) shift right . . . Java only because (unlike C/C++) Java numeric types (except char) are signed. Don't use for data typed as byte because promotion occurs before the operator is applied.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Comparative Operators

      Comparative Operators yield a result of boolean value True or False.

      Operator Description Sample Coding Result if
      x=6, y=5
      Result if
      x=5, y=5
      < Less than x < y false false
      <= Less than or equal to x <= y False True
      > Greater than x > y True False
      >= Greater than or equal to x >= y True True
      . instanceof . . .
      = = Equals x = = y False True
      != Not equals x != y True False

      To compare the values referenced by two objects rather than the existance of the objects, use the Boolean.equals() method or the String.equals() method.

      Set screen Where contains text operator is used by CGI

      For server-side CGI scripts, the value of CONTENT_TYPE has changed from HTTP 1.0 value of

        Content-Type: application/x-www-form-urlencoded

      to the HTTP 1.1 value of:

        Content-Type: application/x-www-form-urlencoded; charset=ISO-8859-1

      So defensive programmers should avoid using an equal operator which expects a precise match to check for “application/x-www-form-urlencoded”. Programmers should instead check whether the value is included in the CONTENT_TYPE string. In Perl, the code is:

        if ($ENV{'CONTENT_TYPE'} =~ /application\/x-www-form-urlencoded/) {
            print " Here's your page back.\n";
        }

      This script would work for Internet Explorer 5.0, Navigator 4.x, and Navigator 5.0 because it allows for the inclusion of a charset specification in the CONTENT_TYPE string.

      from Eric Krock's Updating Your JavaScript and CGI Scripts for Version 5 Browsers

      Set screen Bit-wise operator usage

      Column Value
      1st 1
      2nd 2
      3rd 4
      4th 8
      5th 16
      6th 32
      7th 64
      8th 128
      9th 256
      10th 512
      11th 1028
      Sum 1184

      With SQL 7, the IF statement below following is a bit-wise comparison:

      CREATE TRIGGER trigMine ON tableX FOR UPDATE AS
      IF
      COLUMNS_UPDATED() & 14 <> 0

      A bit mask value of 14 tests whether the 2nd or 3rd or 4th columns of tableX have been updated. (values 2 + 4 + 8 = 14).

      The bitmask to verify if columns 6, 8, or 11 was modified can be determined by the following: power(2,(6-1)) + power(2,(8-1)) + power(2,(11-1)) = 1184.

      To detect if any rows have been updated:

      If (COLUMNS_UPDATED() & 1184) > 0

      To verify that all the rows in question have been updated:

      If (COLUMNS_UPDATED() & 1184) = 1184

      IP Address Subnetting

      Question: What bitwise operation was calculated if 5=0101 and 4=0100, return a result of 5?

      Answer: AND, XOR, or OR


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Logical Operators

      These are rarely used to combine boolean expressions. They yield a result of value True or False.

      Operator Description Sample Coding Condition x Condition y Result z
      & AND z = x & y true false false
      ^ XOR (eXclusive OR) z = x ^ y true true false
      | OR z = x | y true false true
      && Optimized AND z = x && y true false false
      || Optimized OR z = x || y true false true

      For example: The b increment operation may not be performed if a is less than or equal to 0.

        if((a > 0) && (b++ < 1)) {
            // do something
        }
        

      Set screen Ternary Operator

      Operator Description Sample Coding Expanded Equivalent Coding Before x,y After x,y Result z
      ? : If-then-else z = x>y
      ? 2*x :
      2*y

      if (x > y) {
        z = 2*x;
      }
      else {
        z = 2*y;
      }
      
      10, 30 10, 30 60

      Set screen Logical Assignment Operators

      Operator Description Sample
      Coding
      Expanded
      Equivalent
      Coding
      Before x,y After x,y
      &= AND Assignment x &= y x = x & y; true, false false, false
      |= OR Assignment x |= y x = x | y; true, false true, false
      ^= XOR Assignment x ^= y x = x ^ y; true, true false, true

      A B AND XOR OR
      0 0 0 0 0
      0 1 0 1 1
      1 0 0 1 1
      1 1 1 0 1
      In boolean logic, 1 = True, 0 = False.

      0 OR 0 produces 0. Any 1 produces 1.
      1 AND 1 produces 1. Unless all are 1, it's 0.
      0 XOR 1 produces 1, as does
      1 XOR 0 produces 1. All others produce 0.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Arithmetic Assignment Operators

      Operator Description Sample
      Coding
      Expanded
      Equivalent
      Coding
      Before After
      x y x y
      += Addition Assignment x += y; x = x + y; 12 27 39 27
      -= Subtraction Assignment x -= y; x = x - y; 39 12 27 12
      *= Multiplication Assignment x *= y; x = x * y; 5 7 35 7
      /= Division Assignment x /= y; x = x / y; 35 7 5 7
      %= Modulus (Remainder) Assignment x %= y; x = x % y; 21 5 1 5


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Classification of Anomalies

      Beizer (in his "Software Testing Techniques") and Copeland (in his "A Practitioners Guide to Software Test Design") in the "Technical Testing" field reference those in the "Software Engineering" field who use these annotations:

        d = Declaration (creation, initialization) of data in variables (on the left hand side of a computation)
        u = Used for something (=c and p)
          c - Right hand side of computation, pointer (calculation)
          p = Used in a predicate (or as control variable of loop)

        k = kill (deallocate)
        - = nothing

      These annotations are combined in time-sequence pairs to define anomalies (an illogical or useless sequence of data object state change) usually caught by compilers:

        dd = Data defined twice.
        dk = Data defined and then killed without being used.
        kk = Killed twice.
        ku = Killed and then used.
        -k = variable not defined but killed
        -u = used before defined
        d- = defined but never used

      In compiler design dataflow analysis:

      • An UD chain is a list of all definitions that can reach a given use of a variable.
      • An DU chain is a list of all uses that can be reached by a given definition of a variable.


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Portions ©Copyright 1996-2014 Wilson Mar. All rights reserved. | Privacy Policy |

    Related:

  • Arrays
  • Applications Development
  • On the web

  • How I may help

    Send a message with your email client program


    Your rating of this page:
    Low High




    Your first name:

    Your family name:

    Your location (city, country):

    Your Email address: 



      Top of Page Go to top of page

    Thank you!