PLC Chapter V – Expression and Assignment Statements

 A. Expression Statements

A combination of variables, constants and operators that represents a computation forms an expression. Depending upon the type of operands involved in an expression or the result obtained after evaluating expression, there are different categories of an expression. These categories of an expression are discussed here.

  • Constant expressions: The expressions that comprise only constant values are called constant expressions. Some examples of constant expressions are 20,‘ a‘ and 2/5+30 .
  • Integral expressions:The expressions that produce an integer value as output after performing all types of conversions are called integral expressions. For example, x, 6*x-y and 10 +int (5.0) are integral expressions. Here, x and yare variables of type into.
  • Float expressions:The expressions that produce floating-point value as output after performing all types of conversions are called float expressions. For example, 9.25, x-y and 9+ float (7) are float expressions. Here, x ‘and yare variables of type float.
  • Relational or Boolean expressions:The expressions that produce a bool type value, that is, either true or false are called relational or Boolean expressions. For example, x + y<100, m + n==a-b and a>=b + c .are relational expressions.
  • Logical expressions:The expressions that produce a bool type value after combining two or more relational expressions are called logical expressions. For example, x==5 &&m==5 and y>x I I m<=n are logical expressions.
  • Bitwise expressions:The expressions which manipulate data at bit level are called bitwise expressions. For example, a >> 4 and b<< 2 are bitwise expressions.
  • Pointer expressions:The expressions that give address values as output are called pointer  For example, &x, ptr and -ptr are pointer expressions. Here, x is a variable of any type and ptr is a pointer.
  • Special assignment expressions:An expression can be categorized further depending upon the way the values are assigned to the variables.
  • Chained assignment: Chained assignmentis an assignment expression in which the same value is assigned to more than one variable, using a single statement. For example, consider these statements.

 a = (b=20); or a=b=20;

In these statements, value 20 is assigned to variable b and then to variable a. Note that variables cannot be initialized at the time of declaration using chained assignment. For example, consider these statements.

                                       int a=b=30; // illegal

                                       int a=30, int b=30; //valid

  • Embedded assignment: Embedded assignment is an assignment expression, which is enclosed within another assignment expression. For example, consider this statement

                                       a=20+(b=30);   //equivalent to b=30; a=20+30;

In this statement, the value 30 is assigned to variable b and then the result of (20+ 30) that is, 50 is assigned to variable a. Note that the expression (b=30) is an embedded assignment.

  • Compound Assignment: Compound Assignment is an assignment expression, which uses a compound assignment operator that is a combination of the assignment operator with a binary arithmetic operator. For example, consider this statement.

                                                a + =20; //equivalent to a=a+20;

In this statement, the operator += is a compound assignment operator, also known as short-hand assignment operator.


B. Type Conversion
An expression· may involve variables and constants either of same data type or of different data types. However, when an expression consists of mixed data types then they are converted to the same type while evaluation, to avoid compatibility issues. This is accomplished by type conversion, which is defined as the process of converting one predefined data type into another. Type conversions are of two types, namely, implicit conversions and explicit conversions also known as typecasting.

  • Implicit Conversions

Implicit conversion, also known as automatic type conversion refers to the type conversion that is automatically performed by the compiler. Whenever compiler confronts a mixed type expression, first of all char and short int values are converted to int. This conversion is known as integral promotion. After applying this conversion, all the other operands are converted to the type of the largest operand and the result is of the type of the largest operand. Table 3.8 illustrates the implicit conversion of data type starting from the smallest to largest data type. For example, in expression 5 + 4.25, the compiler converts the int into float as float is larger than int and then performs the addition.

  • Typecasting

Typecasting refers to the type conversion that is performed explicitly using type cast operator. In C++, typecasting can be performed by using two different forms which are given here.

data_type (expression) //expression in parentheses

                                   (data_type)expression //data type in parentheses

where,

data_type = data type (also known as cast operator) to which the expression is to be converted.

To understand typecasting, consider this example.

                                    float (num)+ 3.5; //num is of int type

In this example, float () acts as a conversion function which converts int to float. However, this form of conversion cannot be used in some situations. For example, consider this statement.

ptr=int * (x) ;

In such cases, conversion can be done using the second form of typecasting (which is basically C-style typecasting) as shown here.

                                           ptr=(int*)x;

C. Assignment Statement in C++

It is essential that every variable in a program is given a value explicitly before any attempt is made to use it. It is also very important that the value assigned is of the correct type.The most common form of statement in a program uses the assignment operator, =, and either an expression or a constant to assign a value to a variable:

                                 variable = expression;
                                 variable = constant;

The symbol of the assignment operator looks like the mathematical equality operator but in C++ its meaning is different. The assignment statement indicates that the value given by the expression on the right hand side of the assignment operator (symbol =) must be stored in the variable named on the left hand side. The assignment operator should be read as “becomes equal to” and means that the variable on the left hand side has its value changed to the value of the expression on the right hand side. For the assignment to work successfully, the type of the variable on the left hand side should be the same as the type returned by the expression.

The statement in line 10 of the simple adder program is an example of an assignment statement involving an arithmetic expression.

total = a + b;

It takes the values of a and b, sums them together and assigns the result to the variable total. As discussed above, variables can be thought of as named boxes into which values can be stored. Whenever the name of a box (i.e. a variable) appears in an expression, it represents the value currently stored in that box. When an assignment statement is executed, a new value is dropped into the box, replacing the old one. Thus, line 10 of the program means “get the value stored in the box named a, add it to the value stored in the box named b and store the result in the box named total”.

The assignment statement:

total = total + 5;

is thus a valid statement since the new value of total becomes the old value of total with 5 added to it. Remember the assignment operator (=) is not the same as the equality operator in mathematics (represented in C++ by the operator ==).

Arithmetic expressions

Expressions can be constructed out of variables, constants, operators and brackets. The commonly used mathematical or arithmetic operators include:

Operator Operation
+ addition
subtraction
* multiplication
/ division
% modulus (modulo division)

The definitions of the first four operators are as expected. The modulo division (modulus) operation with an integer is the remainder after division, e.g. 13 modulus 4 (13%4) gives the result 1. Obviously it makes no sense at all to use this operator with float variables and the compiler will issue a warning message if you attempt to do so.

Although addition, subtraction and multiplication are the same for both integers and reals (floating point numbers), division is different. If you write (see later for declaration and initialisation of variables on the same line):

float a=13.0, b=4.0, result;

result = a/b;

Then a real division is performed and 3.25 is assigned to result. A different result would have been obtained if the variables had been defined as integers:

int i=13,j=4, result;

result = i/j;

when result is assigned the integer value 3.

The remainder after integer division can be determined by the modulo division (modulus) operator, %. For example, the value of i%j would be 1.

Precedence and nesting parentheses

The use of parentheses (brackets) is advisable to ensure the correct evaluation of complex expressions. Here are some examples:

4+2*3 equals 10
(4+2)*3 equals 18
-3 * 4 equals -12
4 * -3 equals -12 (but should be avoided)
4 * (-3) equals -12
0.5 (a+b) illegal (missing multiplication operator)
(a+b) / 2 equals the average value of a and b only if they are of type float

The order of execution of mathematical operations is governed by rules of precedence. These are similar to those of algebraic expressions. Parentheses are always evaluated first, followed by multiplication, division and modulus operations. Addition and subtraction are last. The best thing, however, is to use parentheses (brackets) instead of trying to remember the rules.

Initialisation of variables

Variables can be assigned values when they are first defined (called initialisation):

type variable = literal constant;
float ratio = 0.8660254;
int myAge = 19;
char answer = ‘y’;
bool raining = false;

The terms on the right hand side are called constants.

(Note the ASCII character set is represented by type char. Each character constant is specified by enclosing it between single quotes (to distinguish it from a variable name). Each char variable can only be assigned a single character. These are stored as numeric codes. The initialisation of words and character strings will be discussed later in the section on advanced topics.)

The declaration of a variable and the assignment of its value in the same statement can be used to define variables as they are needed in the program.

 type     variable = expression;
float   product = factor1*factor2;

The variables in the expression on the right hand side must of course have already been declared and had values assigned to them.

Warning: When declaring and initialising variables in the middle of a program, the variable exists (i.e. memory is assigned to store values of the variable) up to the first right brace that is encountered, excluding any intermediate nested braces, { }. For the simple programs described here, this will usually be the closing brace mark of the program. However we will see later that brace marks can be introduced in many parts of the program to make compound statements.

Expressions with mixed variable types

At a low level, a computer is not able to perform an arithmetic operation on two different data types of data. In general, only variables and constants of the sametype, should be combined in an expression. The compiler has strict type checking rules to check for this.

In cases where mixed numeric types appear in an expression, the compiler replaces all variables with copies of the highest precision type. It promotes them so that in an expression with integers and float variables, the integer is automatically converted to the equivalent floating point number for the purpose of the calculation only. The value of the integer is not changed in memory. Hence, the following is legal:

int i=13;

float x=1.5;

x = (x * i) + 23;

since the values of i and 23 are automatically converted to floating point numbers and the result is assigned to the float variable x.

However the expression:

int i=13,j=4;

float result;

result = i/j;

is evaluated by integer division and therefore produces the incorrect assignment of 3.0 for the value of result. You should try and avoid expressions of this type but occasionally you will need to compute a fraction from integer numbers. In these cases the compiler needs to be told specifically to convert the variables on the right-hand side of the assignment operator to type float. This is done by casting.

In the C++ language this is done by using the construction: static_cast< type > expression (In the C language this is done by a different construction using: (type) expression.) For example:

int count=3, N=100;

float fraction;

fraction  = static_cast<float>(count)/N;

converts (casts) the value stored in the integer variable count into a floating point number, 3.0. The integer N is then promoted into a floating point number to give a floating point result.

Declaration and initialisation of symbolic constants

Like variables, symbolic constants have types and names. A constant is declared and initialised in a similar way to variables but with a specific instruction to the compiler that the value cannot be changed by the program. The values of constants must always be assigned when they are created.

const   type      constant-name = literal constant;

const   float    Pi = 3.14159265;

const   int      MAX = 10000;

The use of constants helps programmers avoid inadvertent alterations of information that should never be changed. The use of appropriate constant names instead of using the numbers also helps to make programs more readable.


Tags: , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

PLC Chapter IV – Data Types

Data types in any of the language means that what are the various type of data the variables can have in that particular language. Information is stored in a computer memory with different data types. Whenever a variable is declared it becomes necessary to define data type that what will be the type of data that variable can hold.

There are two data types available in C++:

1. Primary Data Type character, integer, floating point, boolean, double floating point, void, wide character.
2. Additional Data Types typedef, enumerated.


Character Data Types

Data Type (Keywords) Description Size Typical Range
char Any single character. It may include a letter, a digit, a punctuation mark, or a space. 1 byte -128 to 127 or 0 to 255
signed char Signed character. 1 byte -128 to 127
unsigned char Unsigned character. 1 byte 0 to 255
wchar_t Wide character. 2 or 4 bytes 1 wide character

Integer Data Types

Data Type (Keywords) Description Size Typical Range
int Integer. 4 bytes -2147483648 to 2147483647
signed int Signed integer. Values may be negative, positive, or zero. 4 bytes -2147483648 to 2147483647
unsigned int Unsigned integer. Values are always positive or zero. Never negative. 4 bytes 0 to 4294967295
short Short integer. 2 bytes -32768 to 32767
signed short Signed short integer. Values may be negative, positive, or zero. 2 bytes -32768 to 32767
unsigned short Unsigned short integer. Values are always positive or zero. Never negative. 2 bytes 0 to 65535
long Long integer. 4 bytes -2147483648 to 2147483647
signed long Signed long integer. Values may be negative, positive, or zero. 4 bytes -2147483648 to 2147483647
unsigned long Unsigned long integer. Values are always positive or zero. Never negative. 4 bytes 0 to 4294967295

Floating-point Data Types

Data Type (Keywords) Description Size Typical Range
float Floating point number. There is no fixed number of digits before or after the decimal point. 4 bytes +/- 3.4e +/- 38 (~7 digits)
double Double precision floating point number. More accurate compared to float. 8 bytes +/- 1.7e +/- 308 (~15 digits)
long double Long double precision floating point number. 8 bytes +/- 1.7e +/- 308 (~15 digits)

Boolean Data Type

Data Type (Keywords) Description Size Typical Range
bool Boolean value. It can only take one of two values: true or false. 1 byte true or false

Note: Variables sizes might be different in your pc from those shown in the above table, depending on the compiler you are using.

  • Enum Data Type

This is an user defined data type having finite set of enumeration constants. The keyword ‘enum‘ is used to create enumerated data type.

Syntax:

enum enum-name {list of names} var-list;

enum mca(software, internet, seo);

  • Typedef

It is used to create new data type. But it is commonly used to change existing data type with another name.

Syntax:

typedef [data_type] synonym;

or

typedef [data_type] new_data_type; 

Example:

typedef int integer;

integer rollno;

Tags: , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

PLC Chapter III – Names, Binding, and Scopes

A. Naming Convention
There are various things that have to be paid attention to when giving name for a variable, class, and such in C++, such as the following:

– Naming should be unique and a variable should not have the same name with other variables in the same scope.
– Reserved words and keywords may not be used for a variable name.
– Naming can only consist of alphabets (A-Z, a-z), numbers (-0-9), dollar symbol ($), and underscore (_).
– The first character of the name should be either an alphabet or an underscore.
– Names in C++ are case-sensitive, so, for example, the variable index and Index are different from each other. This may cause a problem in both readibility and writability as it considers similar names as different.
– While there are no limit in character length, during execution the program will only recognize the first 32 characters of the name.
– It is advised to use relevant, short, and clear names for variables, classes, etc., so when the coder or other people read the codes again, they would not be confused of what are the use of several variables and the variables would be easier to use.

Pay attention to the following snippet of codes:
int main() {

int 2nama, nim, _alamat, for;
cin>> 2nama >> NIM >> _alamat >> for;

}
There are a few mistakes that can be seen from the codes above:

– During the declaration (line 1), the variable 2nama violated the rule that a name can only be started with alphabets or underscore, not numbers. The variable for can’t be used too, as for is already a keyword used for looping function.
– During the value input of the variables (line 2), same as line 1, variables 2nama and for violate the rule. In addition, athe variable NIM would cause an error too as the compiler does not recognize that name, because C++ is a case-sensitive language, so it considers the variable nim declared on the first line different from the variable NIM used on the second line.


B. Binding
Binding is the association between an entity and an attribute, such as the association of a variable and its attributes like name, address, data type, value, lifetime, and scope. Binding time is the time at which binding takes place.
The examples of binding time:

o Language design time
o Language implementation time
o Program translation / compile time
o Link edit time
o Load time
o Run time

For a variable to be able to be referenced in a program, first it need to be bound to a type, which is called type binding. It can be differentiated into two kinds of type binding:

o Static type binding, binding that took place during compile time. The data type that the variable is bound to is decided either by directly specifying a data type to the variable name (explicit) or by default associating a variable with a type during compile time (implicit). In C++, Explicit static type binding is usually used.

o Dynamic type binding, where a variable is bound to a type when it is assigned a value in an assignment statement (at run time, take the type of the value on the right-hand side). By using dynamic type binding, it’s more flexible compared to static type binding, but error detection is harder and prone to typing errors. In C++, dynamic type binding can be used with the help of template by using generics.


C. Scope
The scope of a variable is the range of statements over which it is visible. The scope rules of a language determine how references to names are associated with variables. In C++, the scope of a variable depends on the block where the variable is declared or called. There are two kinds of scope, static and dynamic scope. Depending on the scope it is in, a variable can be divided into two kinds:

o Local Variable is variable declared in a block of program and can only be called in said block.
o Global Variable is variable declared outside of all block of programs and can be called from anywhere after its declaration. In the case when a global variable and a local variable share a name, the local variable will be prioritized if the variable name is called inside the same block of that local variable.

– Static Scope
Static scope is based on program text and connect a name reference to a variable by finding the declaration. The search process of the declaration starts locally, then in increasingly larger enclosing scopes, until one is found for given name.
– Dynamic Scope
Dynamic scope is based on calling sequences of program units, not their textual layout. References to variables are connected to declarations by searching back through the chain of subprogram calls that forced execution to this point.

Tags: , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

PLC Chapter II – Describing Syntax and Semantics

A. Definition

The word syntax comes from Ancient Greek: σύνταξις “coordination”, which consists of σύν syn, “together,” and τάξις táxis, “an ordering”.
In computer science, the syntax of a computer language is the set of grammatical rules that defines the combinations of words and symbols that are considered to be a correctly structured document or fragment in that language.
Semantic focuses on the relationship between signifiers— like words, phrases, signs, and symbols—and what they stand for, their denotation. In computer science, semantics is the meaning of the expressions, statements, and program units.

B. C++ Syntax

The syntax of textual programming languages is usually defined using a combination of regular expressions (for lexical structure) and Backus–Naur Form (for grammatical structure) to inductively specify syntactic categories (nonterminals) and terminal symbols. Syntactic categories are defined by rules called productions, which specify the values that belong to a particular syntactic category. Terminal symbols are the concrete characters or strings of characters (for example keywords such as define, if, main, or void) from which syntactically valid programs are constructed.

The following are the examples of basic C++ keywords syntax:

  1. #include, which is used to insert the library of functions we are going to use in our program. For example, #include , which includes the standard input and output codes.
  2. int main(), which is called first by the program after the initialization. A statement return 0; should be written at the end of the codes inside int main().
  3. cout, which is used to print output on the screen.
  4. cin, which is used to input data by user and store it as a variable.
  5. int, char, etc., which are used to declare a variable, according to the data types. (int for integer, char for a character, string for string of characters, etc.)
  6. if, which is used in selection and will execute the codes if the condition is true.

There are also various points that should be paid attention to:

  1. The semicolon (;) is used to separate each statements.
  2. The curly brackets ({ }) must be used on several functions such as if, for, and while if there are more than one statements that will be executed in the function.
  3. C++ is a case-sensitive programming language, so if you use capitalization incorrectly, the compiler will give an error message.
  4. To set the value of char and string data types or to print text on a program, double quotation mark (“ “) is necessary.
  5. For comments, we use double slash (//) to mark the following text in a line as comment or type them between /* and */ to mark several lines of code or text as comments.

Here are an example of a program with correct syntax in C++:

#include
using namespace std;

int main() {

int x,y,z;
cout<<“Masukkan nilai x dan y : “; cin>> x >> y;
fflush(stdin);
z=x+y;
if (z>50) cout<<“Jumlah dari x dan y lebih dari 50”;
else cout<<“Jumlah dari x dan y kurang dari 50”;
getchar();
return 0;

}

C. Semantics
The requirements for a methodology and notation for semantics are as follows:
– Programmers need to know what statements mean
– Compiler writers must know exactly what language constructs do
– Correctness proofs would be possible
– Compiler generators would be possible
– Designers could detect ambiguities and inconsistencies
There are some kinds of semantics:
Operational semantics, which describes the meaning of a program directly by executing its statements on a machine, either simulated or actual. The change in the state of the machine (memory, registers, etc.) defines the meaning of the statement.
Denotational semantics, where each phrase in the language is interpreted as a denotation, i.e. a conceptual meaning that can be thought of abstractly.
Axiomatic semantics, where axioms or inference rules are defined for each statement type in the language (to allow transformations of logic expressions into more formal logic expressions).

Tags: , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

PLC Chapter I – Introduction

A. Reasons for Studying Concepts of Programming Languages

➢ Increased ability to express ideas.

  • It is believed that the depth at which we think is influenced by the expressive power of the language in which we communicate our thoughts. It is difficult for people to conceptualize structures they can’t describe, verbally or in writing.
  • Language in which they develop software places limits on the kinds of control structures, data structures, and abstractions they can use.

➢ Improved background for choosing appropriate languages.

  • Many programmers, when given a choice of languages for a new project, continue to use the language with which they are most familiar, even if it is poorly suited to new projects.
  • If these programmers were familiar with other languages available, they would be in a better position to make informed language choices.

➢ Greater ability to learn new languages.

  • Programming languages are still in a state of continuous evolution, which means continuous learning is essential.
  • Programmers who understand the concept of OO programming will have easier time learning Java.
  • Once a thorough understanding of the fundamental concepts of languages is acquired, it becomes easier to see how concepts are incorporated into the design of the language being learned.

➢ Understand significance of implementation.

  • Understanding of implementation issues leads to an understanding of why languages are designed the way they are. • This in turn leads to the ability to use a language more intelligently, as it was designed to be used.

➢ Ability to design new languages.

  • The more languages you gain knowledge of, the better understanding of programming languages concepts you understand.

➢ Overall advancement of computing.

  • Many believe that ALGOL 60 was a better language than Fortran; however, Fortran was most widely used. It is attributed to the fact that the programmers and managers didn’t understand the conceptual design of ALGOL 60.

B. Programming Domains

➢ Scientific applications

  • In the early 40s computers were invented for scientific applications.
  • The applications require large number of floating point computations.
  • Fortran was the first language developed scientific applications.
  • ALGOL 60 was intended for the same use.

➢ Business applications

  • The first successful language for business was COBOL.
  • Produce reports, use decimal arithmetic numbers and characters.
  • The arrival of PCs started new ways for businesses to use computers.
  • Spreadsheets and database systems were developed for business.

➢ Artificial intelligence

  • Symbolic rather than numeric computations are manipulated.
  • Symbolic computation is more suitably done with linked lists than arrays.
  • LISP was the first widely used AI programming language.

➢ Systems programming

  • The operation system and all the programming supports tools are collectively known as its system software.
  • Need efficiency because of continuous use.

➢ Scripting languages

  • Put a list of commands, called a script, in a file to be executed.
  • PHP is a scripting language used on Web server systems. Its code is embedded in HTML documents. The code is interpreted on the server before the document is sent to a requesting browser.

C. Language Evaluation Criteria

1.  Readability

  • Language constructs were designed more from the point of view of the
    computer than the users.
  • Because ease of maintenance is determined in large part by the readability of
    programs, readability became an important measure of the quality of programs
    and programming languages. The result is a crossover from focus on machine orientation to focus on human orientation.
  • The most important criteria “ease of use”
  • Orthogonality

✓ Makes the language easy to learn and read.
✓ Meaning is context independent. Pointers should be able to point to
any type of variable or data structure. The lack of orthogonality leads
to exceptions to the rules of the language.
✓ A relatively small set of primitive constructs can be combined in a
relatively small number of ways to build the control and data structures
of the language.
✓ Every possible combination is legal and meaningful.
✓ The more orthogonal the design of a language, the fewer exceptions
the language rules require.
✓ The most orthogonal programming language is ALGOL 68. Every
language construct has a type, and there are no restrictions on those
types.
✓ This form of orthogonality leads to unnecessary complexity.

2. Writability

  • It is a measure of how easily a language can be used to create programs for a
    chosen problem domain.
  • Most of the language characteristics that affect readability also affect
    writability.

Simplicity and orthogonality

  • A smaller number of primitive constructs and a consistent set of rules
    for combining them is much better than simply having a large number
    of primitives.

Support for abstraction

  • Abstraction means the ability to define and then use complicated
    structures or operations in ways that allow many of the details to be
    ignored.
  • A process abstraction is the use of a subprogram to implement a sort
    algorithm that is required several times in a program instead of
    replicating it in all places where it is needed.

Expressivity

  • It means that a language has relatively convenient, rather than
    cumbersome, ways of specifying computations.

3. Reliability

  • A program is said to be reliable if it performs to its specifications under all
    conditions.
  • Type checking: is simply testing for type errors in a given program, either by
    the compiler or during program execution.
  • The earlier errors are detected, the less expensive it is to make the
    required repairs. Java requires type checking of nearly all variables
    and expressions at compile time.
  • Exception handling: the ability to intercept run-time errors, take corrective
    measures, and then continue is a great aid to reliability.
  • Aliasing: it is having two or more distinct referencing methods, or names, for
    the same memory cell.
  • It is now widely accepted that aliasing is a dangerous feature in a
    language.
  • Readability and writablity: Both readability and writability influence
    reliability.

4. Cost

✓ Training programmers to use language
✓ Writing programs “Writability”
✓ Compiling programs
✓ Executing programs
✓ Language implementation system “Free compilers is the key, success
of Java”
✓ Maintaining programs: Maintenance costs can be as high as two to
four times as much as development costs.
✓ Portability “standardization of the language”
✓ Generality (the applicability to a wide range of applications)


D. Influences on Language Design

➢ Computer architecture: Von Neumann
➢ We use imperative languages, at least in part, because we use von Neumann machines

• Data and programs stored in same memory
• Memory is separate from CPU
• Instructions and data are piped from memory to CPU
• Results of operations in the CPU must be moved back to memory
• Basis for imperative languages

✓ Variables model memory cells
✓ Assignment statements model piping
✓ Iteration is efficient

plc1
➢ Program Design Methodologies

• New software development methodologies (e.g., object-oriented software
development) led to new programming paradigms and by extension, new
programming languages

➢ Programming methodologies

• 1950s and early 1960s: Simple applications; worry about machine efficiency
• Late 1960s: People efficiency became important; readability, better control
structures

✓ Structured programming
✓ Top-down design and step-wise refinement

• Late 1970s: Process-oriented to data-oriented

✓ data abstraction

• Middle 1980s: Object-oriented programming

✓ Data abstraction + inheritance + polymorphism


E. Language Categories

➢ Imperative

• Central features are variables, assignment statements, and iteration
• C, Pascal

➢ Functional

• Main means of making computations is by applying functions to given
parameters
• LISP, Scheme

➢ Logic

• Rule-based
• Rules are specified in no special order
• Prolog

➢ Object-oriented

• Encapsulate data objects with processing
• Inheritance and dynamic type binding
• Grew out of imperative languages
• C++, Java


F. Implementation Methods

➢ Compilation

• Programs are translated into machine language; includes JIT systems
• Use: Large commercial applications
• Translate high-level program (source language) into machine code (machine
language)
• Slow translation, fast execution

plc2

➢ Pure Interpretation

• Programs are interpreted by another program known as an interpreter
• Use: Small programs or when efficiency is not an issue
• No translation
• Easier implementation of programs (run-time errors can easily and immediately be
displayed)
• Slower execution (10 to 100 times slower than compiled programs)
• Often requires more space
• Now rare for traditional high-level languages
• Significant comeback with some Web scripting languages (e.g., JavaScript, PHP)

plc3

➢ Hybrid Implementation Systems

• A compromise between compilers and pure interpreters
• Use: Small and medium systems when efficiency is not the first concern
• A compromise between compilers and pure interpreters
• A high-level language program is translated to an intermediate language that
allows easy interpretation
• Faster than pure interpretation

plc4

Tags: , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

HTTP 2016 – HIMTI Togetherness & Top Performance 2016

HTTP 2016 Logo

Logo HTTP 2016

    HTTP (HIMTI Togetherness & Top Performance) adalah acara kebersamaan dan penyambutan mahasiswa baru School of Computer Science Binus University yang diadakan setiap tahunnya oleh HIMTI (Himpunan Mahasiswa Teknik Informatika) Binus University sejak tahun 2001, di mana HTTP 2016 menyambut khusus mahasiswa baru SoCS 2020 dan diadakan pada tanggal 10 September 2016 di Gedung BPPT II, Jl. M. H. Thamrin No. 8, Jakarta Pusat. Tahun ini, HTTP mengangkat tema Passion, Innovation, and Togetherness. Di post ini, saya, Piterson Satio, Binusian 2020 dari jurusan Teknik Informatika akan menceritakan tentang pengalaman saat menghadiri acara HTTP 2016.

Screenshot_3

Mobile BINUS Virtual Tour

    Sebelum acara HTTP 2016 dibuka, sambil menunggu para mahasiswa yang lain datang, diputarlah film Zootopia di dalam auditorium agar mereka yang datang terlebih dahulu tidak bosan. Di luar auditorium, juga terdapat stand-stand IT Showcase yang memamerkan hasil karya dari mahasiswa SoCS Binus University, dimulai dari aplikasi, game, hingga dengan menggunakan alat yang memanfaatkan teknologi Virtual Reality, kita bisa merasakan berada di daerah yang dimiliki Binus, seperti kampus-kampus di Kemanggisan, Binus Square, dan lain-lain.

Peanut Butter Band

Peanut Butter Band

        Kemudian, saat waktu menunjukkan kira-kira pukul 9 pagi, pemutaran film dipotong meski belum selesai (dan mengecewakan banyak orang hahaha) dan acara HTTP pun dimulai. Acara dibuka dengan penampilan dari Peanut Butter Band yang membawakan beberapa lagu.

214019

MC Clarisa Valencia dan Sandy Alta yang membawakan acara

Memperkenalkan para staff penting SoCS BINUS

Memperkenalkan para staff penting SoCS BINUS

        Selanjutnya, acara ini akan dibawakan oleh Clarisa Valencia dan Sandy sebagai para MC. Setelah itu, kata-kata sambutan diberikan oleh Martin Arlando Teng selaku Ketua HTTP, Jonathan Gozali selaku Kepala HIMTI Kemanggisan, Rionaldo Aureri Linggautama selaku Kepala HIMTI Alam Sutra, kemudian Fredy Purnomo, S.Kom., M.Kom. selaku Dean of SoCS Binus University yang juga memperkenalkan para staff yang nantinya akan mengajar dan membimbing para mahasiswa baru SoCS ke depannya. Tidak hanya itu, juga diputarkan video sambutan dari salah satu Vice Rector Binus University yaitu Drs. Andreas Chang, MBA yang memberikan wejangan mengenai kunci sukses bagi para mahasiswa baru SoCS 2020.

        Ada juga dilakukan games yang dibawakan kedua MC, yang pertama yaitu games Rantai kata, di mana tiap pemain harus sambung-menyambungkan kalimat dari pemain-pemain sebelumnya, tapi jika pemain salah mengucapkan kalimat yang telah terrangkai, maka ia akan dieleminasi dari permainan, hingga tersisa 2 pemain yang keluar menjadi pemenang. Kemudian, waktunya break untuk makan siang dan tiap orang mendapatkan kotak nasi serta diberi waktu sekitar 1 jam untuk mengunjungi IT Showcase yang saya sebutkan tadi dan juga stand yang dibuka di lapangan yang menjual berbagai makanan dan minuman untuk dinikmati.

Permainan Rantai Kata

Permainan Rantai Kata

IT Showcase

IT Showcase

        Setelah break berakhir, dimulai acara Talkshow yang menghadirkan 3 narasumber yang merupakan lulusan SoCS Binus University yang telah berprestasi dan membanggakan bangsa, yakni Christian Tarunajaya, Reinhard Lazuardi Kuwandy, dan Natanael Febrianto. Mereka menceritakan tentang suka-duka menjadi mahasiswa SoCS, alasan mereka memilih jurusan IT di Binus, kata-kata semangat bagi para mahasiswa baru, dan tentu saja menceritakan tentang hasil ciptaan mereka. Mereka berecerita bahwa, tanpa kerja keras, passion, dan inovasi, mereka tidak akan bisa menciptakan karya mereka tersebut. Jadi, kita sebagai mahasiswa baru bisa termotivasi untuk menciptakan karya kita mulai dari sekarang.

Talkshow

Talkshow

        Kak Natanael membuat aplikasi yang dapat digunakan untuk mengetahui kepribadian seseorang hanya berdasarkan isi dari postingan akun Twitter orang tersebut, karena ketertarikannya terhadap bidang psikologi belakangan ini dan juga karena Twitter yang isi postingannya lebih ke arah teks lebih mudah dianalisis daripada media sosial lain yang lebih ke arah gambar. Sedangkan Kak Christian dan Kak Reinhard bersama dengan satu teman mereka lagi menciptakan robot yang bernama Bimax sebagai tugas akhir kuliah mereka. Robot Bimax ini spesial karena selain dapat mengenali ucapan dalam Bahasa Indonesia, juga mampu dalam merespon dalam Bahasa Indonesia pula.

Robot Bimax - robot yang dapat berbahasa Indonesia

Robot Bimax – robot yang dapat berbahasa Indonesia

         Setelah acara talkshow berakhir, dimulailah game kedua di mana 6 pemain harus berpasangan menjadi 3 tim. Dari jarak tertentu, seseorang dari suatu tim harus melemparkan 9 buah bola ping pong satu per satu ke arah rekan satu timnya agar bola masuk ke wadah di atas kepala rekannya tersebut, kemudian mereka berdua akan bertukar posisi. Permainan ini melatih kekompakan dan strategi dalam melempar maupun menangkap.

   Kemudian dimulailah acara Visualisasi HIMTI, yaitu semacam drama/sketsa yang menceritakan tentang sekelompok mahasiswa baru SoCS dari masa FEP mereka, pengenalan mengenai HIMTI dan aspirasi mereka untuk menjadi Cavis HIMTI, namun terlebih dahulu mereka harus menjadi panitia dari acara lain yang diselenggarakan HIMTI, yaitu HEXION. Meskipun awalnya ada pertentangan dan perbedaan pendapat di antara mereka, terutama dengan ketuanya, namun mereka menerima satu sama lain dan akhirnya mampu bekerja sama untuk mensukseskan event HEXION ini, dan mereka semua akhirnya diterima menjadi aktivis HIMTI. Dari visualisasi ini kita belajar bahwa dalam berorganisasi, kita harus bisa menerima kelebihan dan kekurangan setiap orang, termasuk diri kita sendiri, dan mau berkerja sama dengan rekan-rekan kita dan menganggap mereka sebagai keluarga sendiri. Para pemeran dalam drama ini ketika diwawancarai mengatakan bahwa mereka latihan demi acara HTTP ini selama 2 bulan loh! Jadi kita juga harus kerja keras dan berdedikasi tinggi untuk mencapai hasil yang memuaskan. Di akhir sesi ini, seluruh anggota panitia HTTP bersama-sama melakukan dance yang diiringi lagu untuk menunjukkan kekompakan mereka. Keren!

Adegan dalam Visualisasi HIMTI

Adegan dalam Visualisasi HIMTI

Dance Panitia HTTP

Dance Panitia HTTP

        Ketika Visualisasi telah berakhir, break yang kedua dimulai yang kemudian diikuti oleh berbagai performance dan bintang tamu yang telah disiapkan oleh panitia HTTP. Semua peserta HTTP berkumpul di bagian bawah auditorium di dekat panggung sambil menonton berbagai performance, antara lain Revolution Dance, Vibing High yang membawakan beberapa lagu, diselingi oleh pelantikan mahasiswa SoCS dengan mengenakan jaket almamater dan juga pembagian hadiah undian serta doorprize. Setelah itu, acara diakhiri dengan performance DJSnake yang banyak ditunggu-tunggu. Saat acara berakhir, sebelum meninggalkan ruangan, semua orang dibagi berdasarkan ukuran baju yang dipesan dan juga shift bus bagi mereka yang transportasinya disediakan oleh panitia HTTP.


 

        Sekian dari pengalaman sekali seumur hidup saya dalam menghadiri event HTTP 2016. Semoga acara ini dan event-event HIMTI yang lainnya akan memuaskan para peserta yang telah menghadiri!

HIMTI, One Family One GOAL!

Tags: , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
 Page 2 of 2 « 1  2