Postingan

Menampilkan postingan dari Desember, 2017

Session 11 : Exception Handling and Event Handling

Gambar
Introduction to Exception Handling * In a language without exception handling When an exception occurs, control goes to the operating system, where a message is displayed and the program is terminated * In a language with exception handling Programs are allowed to trap some exceptions, thereby providing the possibility of fixing the problem and continuing so we can conclude that programmers need exception handling. Exception handling lets programs to trap some exceptions, thereby providing the possibility of fixing the problem and continuing. Basic Concepts * Many languages allow programs to trap input/output errors (including EOF) * An exception is any unusual event, either erroneous or not, detectable by either hardware or software, that may require special processing * The special processing that may be required after detection of an exception is called exception handling * The exception handling code unit is called an exception handler Exception Handling Alternatives ...

Session 9 : Object-Oriented Programming

There are many object-oriented programming language... - Some are support procedural and data-oriented programming (e.g., Ada 95+ and C++) - Some are support functional program (e.g., CLOS) - Newer languages do not support other paradigms but use their imperative structures (e.g., Java and C#) - Some are pure OOP language (e.g., Smalltalk & Ruby) - Some are functional languages support OOP, but they are not discussed in this chapter there are three major language features : 1. abstract data types 2. inheritance 3. polymorphism - Inheritance allows new classes defined  in terms of existing ones, i.e., by allowing them to inherit common parts - Inheritance addresses both of the above concerns--reuse ADTs after minor changes and define classes in a hierarchy to make it easily, inheritance can be imagined as parent and child. The parent is the class while  the child is a derived class or a subclass. There are several ways a derived class can differ from its parent...

Session 8 : Abstract Data Types(GSLC)

here is some task from ms.Yanfi because of GSLC 1. What are the similarities of and the differences between Java Packages and C++ Namespace?  The similarity between Java Package and Namespaces In C++ are :  - Java Packages are namespaces system while C++ also has namespace  - Both are abstract containers for classes  - Java Packages and namespaces provide breakup for class names  - both make the code cleaner and less redundant, by enabling some  parts of the code  The differences between C++ namespace and Java packages :  - As a unit that guarantees access to non-private members to classes in the same block, there is no equivalent in C++ that the access level granted to a class is independent of the namespace where the class is defined.  - In C++ namespaces are just about partitioning the available names. Java packages are about modules.  - Packages are used to organize files or public types to avoid type conflic...

Session 7 : Subprograms

Gambar
Two fundamental abstraction facilities can be included in a programming language: process abstraction and data abstraction. Fundamentals of Subprograms general subprogram characteristic : - Each subprogram has a single entry point - The calling program is suspended during execution of the called subprogram - Control always returns to the caller when the called subprogram’s execution terminates basic definition : A subprogram definition describes the interface to and the actions of the subprogram abstraction. A subprogram call is the explicit request that a specific subprogram be executed. A subprogram is said to be active if, after having been called, it has begun execution but has not yet completed that execution. Semantics Models of Parameter Passing there are three types of parameter passing : - In mode - Out mode - In-out mode Passing parameter methods 1. Pass-by-Value (In Mode) The value of the actual parameter is used to initialize the corresponding formal pa...

Session 6 : Statement-Level Control Structures

Control Structure What is control structure? A control structure is a control statement and the collection of statements whose execution it controls. there are two kinds of control structure : - Selection statements - Iterative statements Selection Statements - A selection statement provides the means of choosing between two or more paths of execution - Two general categories:       - Two-way selectors       - Multiple-way selectors - In C89, C99, Python, and C++, the control expression can be arithmetic. But In most other languages, the control expression must be Boolean. Two-Way Selection Statement the general form two-way selection statement : if control_expression then clause else clause for example : nesting selectors There are different ways to code nesting selectors in various programming language such as java, phyton, ruby, F#, and C. Java example if (sum == 0)        if (count == 0)     ...

Session 5 : Expression

4 Types of Expressions - Arithmetic Evaluation - Short-Circuit Evaluation - Relational Evaluation - Boolean Evaluation Arithmetic Expressions - Arithmetic evaluation was one of the motivations for the development of the first programming languages - In programming language, arithmetic expressions consist of operators, operands, parentheses, and function calls an operators can be : 1. Unary => meaning it has a single operand 2. Binary => meaning it has two operand 3. Ternary => meaning it has three operand there's some operator rules in arithmetic expressions : Operator Precedence Rules    Typical precedence levels - parentheses - unary operators - ** (if the language supports it) - *, / - +, - Operator Associativity Rule - The operator associativity rules for expression evaluation define the order in which adjacent operators with the same precedence level are evaluated - Typical associativity rules - Left to right, except **, which is right to...

Session 4 : Data types(GSLC)

here is some task given from ms. Yanfi because GSLC 1. What are the advantages and disadvantages of decimal data types?  Andvantages: being able to precisely store decimal values, at least those within a restricted range, which cannot be done with floating-point. Disadvantages: the range of values is restricted because no exponents are allowed, and their representation in memory is mildly wasteful. 2. How does a decimal value waste memory space?  Decimal types are stored very much like character strings, using binary codes for the decimal digits. These representations are  called binary coded decimal (BCD). In some cases, they are stored one digit per byte, but in others, they are packed two digits per byte. Either way, they take more storage than binary representations. It takes at least four bits to code a decimal digit. Therefore, to store a six-digit coded decimal number requires 24 bits of memory. However, it takes only 20 bits to store the sa...

Session 3 : Names, Binding, Scope

Name - If name length are too short, it can't be connotative. For each language, they have their own criteria, for examples FORTRAN 95 that has maximum of 31 characters, C  ++ has no limit, but implementers often impose one, C#, Ada, Java has no limit. - Names in most programming languages have the same form: a letter followed by a string consisting of letters, digits, and underscore characters ( _ ). - Names are case sensitive, and the disadvantage is readability which names that look alike are different. Examples : Names base in C languages are case sensitive,   names in other languages are not case sensitive. So, we have to pay attention using the capital letters in C based languages. - Special characters   Special words in programming languages are used to make programs more   readable by naming actions to be performed. They also are used to separate the   syntactic parts of statements and programs. In most languages, special words are   cl...

Session 2 : Describing Syntax and Semantics

Gambar
On this session, i just write about the meaning of syntax and semantics and some grammar from concept of programming language by Robert W Sebesta. Syntax => the form or structure of the expressions statements, and program units. Semantics => is the meaning of the expressions, statements, and program units. Syntax ans semantics provide a language's definitions :   Users of a language designers :     -Other Language designers.     -Implementers.     -Programmers (the users of the language). A Grammar for a Small Language <program> → begin <stmt_list> end <stmt_list> → <stmt>      | <stmt> ; <stmt_list> <stmt> → <var> = <expression> <var> → A | B | C <expression> → <var> + <var>       | <var> – <var>       | <var> Derivation of a program example : A = B * ( A + C ) is generated by the...

Session 1 : Introduction (part 2)

In the class, ms. Yanfi taught us that why should we learn Programming Language Concept(PLC), programming domain, language evaluation criteria, influences on language design, and it's implementation methods. first, why we should learn that PLC? 1. It's increased ability to express ideas 2. It's improved background for choosing appropriate languages 3. It's increased ability to learn new languages 4. Better understanding of significance of implementation 5. Better use of languages that are already known 6. Overall advancement of computing. And if you have learned PLC, you will be able to follow the development of the newest programming language. Programming Domain , This topic shows how computers have been applied for various purposes, and there is 5 programming domain such as : - Scientific applications - Business applications - Artificial intelligence - Systems programming - Web Software Language Evaluation Criteria that consist : 1. Readability =>...

Session 1 : Introduction

Pertemuan pertama, berisi perkenalan antara mahasiswa dan dosen. Dosen mengabsen kita satu persatu dan mulai memperkenalkan diri. Nama dosen kami adalah ms.Yanfi. Dia memberi tau kita tentang peraturan apa saja yang ada di kelas, yaitu :  1. Di dalam kelas akan mendapat point jika bertanya pada saat kelompok lain sedang presentasi dan point akan digunakan untuk menaikkan nilai. 2. Boleh menggunakaan handphone didalam kelas, tetapi tidak boleh bermain game. jika ketahuan bermain game akan diberikan hukuman. 3. Tidak boleh tidur didalam kelas. 4. Jika tidak membawa flazz atau lupa tapping, bisa di absenkan tetapi akan di kurangi point nya. 5. Bahasa dalam kelas bebas, boleh menggunakan english atau bahasa indonesia. Lalu kelas selesai dan para mahasiswa meniggalkan ruangan.