8November2010

TUGAS BAHASA PEMROGRAMAN 4

Posted by wanto under: Uncategorized.

TUGAS BAHASA PEMROGRAMAN 4

Nama                          : Miswanto

Nim                             : 09320222

Kelas                          : 3e

Jurusan                       : Pendidikan Matematika dan Komputasi

Fakultas                      : Keguruan dan Ilmu Pendidikan

A.     Algoritma tentang bilangan berpangkat xa + yb :

1.      Mulai.

2.      Masukkan /tentukan nilai x dan y.

3.      Masukkan /tentukan nilai a dan b.

4.      Membatasi nilai x dan y, yaitu khusus untuk angka 10.

5.      Membatasi nilai a dan b, yaitu khusus bilangan bulat positif antara 1 s/d 3.

6.      Jika a=1 dan b=1, maka xa + yb = 20.

7.      Jika a=1 dan b=2, maka xa + yb =110.

8.      Jika a=1 dan b=3, maka xa + yb=1010.

9.      Jika a=2 dan b=1, maka xa + yb=110.

10.  Jika a=2 dan b=2, maka xa + yb=200.

11.  Jika a=2 dan b=3, maka xa + yb=1100.

12.  Jika a=3 dan b=1, maka xa + yb=1010.

13.  Jika a=3 dan b=2, maka xa + yb=1100.

14.  Jika a=3 dan b=3, maka xa + yb=2000.

15.  Jika tidak memenuhi syarat diatas maka hasilnya = 0.

16.  Selesai.

B.  Flowchart Tentang Pernyataan “CASE OF

0 

1November2010

TUGAS BAHASA PEMROGRAMAN 3

Posted by wanto under: Uncategorized.

TUGAS BAHASA PEMROGRAMAN 3

Nama              : MISWANTO

NIM                : 09320222

Kelas              : 3E

Jurusan           : Pendidikan Matematika dan Komputasi

v     Algoritma

1.      Mulai.

2.      Masukkan total (harga) pembelian.

3.      Jika total pembelian ≥ Rp100.000,- maka mendapatkan Voucher Belanja.

4.      Jika total pembelian ≥ Rp75.000,- maka mendapatkan Voucher Pulsa Rp25.000,-.

5.      Jika total pembelian ≥ Rp50.000,- maka mendapatkan Kaos Cantik.

6.      Jika total pembelian <Rp 50.000,- maka tidak mendapatkan Bonus.

7.      Selesai.

Flowchart


0 

11October2010

PROGRAMMING LANGUAGE

Posted by wanto under: Uncategorized.

PROGRAMMING LANGUAGE

From Wikipedia, the free encyclopedia

Jump to: navigation, search

A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication.

Many programming languages have some form of written specification of their syntax (form) and semantics (meaning). Some languages are defined by a specification document. For example, the C programming language is specified by an ISO Standard. Other languages, such as Perl, have a dominant implementation that is used as a reference.

The earliest programming languages predate the invention of the computer, and were used to direct the behavior of machines such as Jacquard looms and player pianos. Thousands of different programming languages have been created, mainly in the computer field, with many more being created every year. Most programming languages describe computation in an imperative style, i.e., as a sequence of commands, although some languages, such as those that support functional programming or logic programming, use alternative forms of description.

Definitions

A programming language is a notation for writing programs, which are specifications of a computation or algorithm.[1] Some, but not all, authors restrict the term “programming language” to those languages that can express all possible algorithms.[1][2] Traits often considered important for what constitutes a programming language include:

  • Function and target: A computer programming language is a language[3] used to write computer programs, which involve a computer performing some kind of computation[4] or algorithm and possibly control external devices such as printers, disk drives, robots,[5] and so on. For example PostScript programs are frequently created by another program to control a computer printer or display. More generally, a programming language may describe computation on some, possibly abstract, machine. It is generally accepted that a complete specification for a programming language includes a description, possibly idealized, of a machine or processor for that language.[6] In most practical contexts, a programming language involves a computer; consequently programming languages are usually defined and studied this way.[7] Programming languages differ from natural languages in that natural languages are only used for interaction between people, while programming languages also allow humans to communicate instructions to machines.
  • Abstractions: Programming languages usually contain abstractions for defining and manipulating data structures or controlling the flow of execution. The practical necessity that a programming language support adequate abstractions is expressed by the abstraction principle;[8] this principle is sometimes formulated as recommendation to the programmer to make proper use of such abstractions.[9]

Markup languages like XML, HTML or troff, which define structured data, are not generally considered programming languages.[12][13][14] Programming languages may, however, share the syntax with markup languages if a computational semantics is defined. XSLT, for example, is a Turing complete XML dialect.[15][16][17] Moreover, LaTeX, which is mostly used for structuring documents, also contains a Turing complete subset.[18][19]

The term computer language is sometimes used interchangeably with programming language.[20] However, the usage of both terms varies among authors, including the exact scope of each. One usage describes programming languages as a subset of computer languages.[21] In this vein, languages used in computing that have a different goal than expressing computer programs are generically designated computer languages. For instance, markup languages are sometimes referred to as computer languages to emphasize that they are not meant to be used for programming.[22] Another usage regards programming languages as theoretical constructs for programming abstract machines, and computer languages as the subset thereof that runs on physical computers, which have finite hardware resources.[23] John C. Reynolds emphasizes that formal specification languages are just as much programming languages as are the languages intended for execution. He also argues that textual and even graphical input formats that affect the behavior of a computer are programming languages, despite the fact they are commonly not Turing-complete, and remarks that ignorance of programming language concepts is the reason for many flaws in input formats.[24]

Elements

All programming languages have some primitive building blocks for the description of data and the processes or transformations applied to them (like the addition of two numbers or the selection of an item from a collection). These primitives are defined by syntactic and semantic rules which describe their structure and meaning respectively.

Syntax

Parse tree of Python code with inset tokenization

Syntax highlighting is often used to aid programmers in recognizing elements of source code. The language above is Python.

Main article: Syntax (programming languages)

A programming language’s surface form is known as its syntax. Most programming languages are purely textual; they use sequences of text including words, numbers, and punctuation, much like written natural languages. On the other hand, there are some programming languages which are more graphical in nature, using visual relationships between symbols to specify a program.

The syntax of a language describes the possible combinations of symbols that form a syntactically correct program. The meaning given to a combination of symbols is handled by semantics (either formal or hard-coded in a reference implementation). Since most languages are textual, this article discusses textual syntax.

Programming language syntax is usually defined using a combination of regular expressions (for lexical structure) and Backus–Naur Form (for grammatical structure). Below is a simple grammar, based on Lisp:

expression ::= atom   | list
atom       ::= number | symbol
number     ::= [+-]?['0'-'9']+
symbol     ::= ['A'-'Z''a'-'z'].*
list       ::= '(' expression* ')'

This grammar specifies the following:

  • an expression is either an atom or a list;
  • an atom is either a number or a symbol;
  • a number is an unbroken sequence of one or more decimal digits, optionally preceded by a plus or minus sign;
  • a symbol is a letter followed by zero or more of any characters (excluding whitespace); and
  • a list is a matched pair of parentheses, with zero or more expressions inside it.

The following are examples of well-formed token sequences in this grammar: ‘12345‘, ‘()‘, ‘(a b c232 (1))

Not all syntactically correct programs are semantically correct. Many syntactically correct programs are nonetheless ill-formed, per the language’s rules; and may (depending on the language specification and the soundness of the implementation) result in an error on translation or execution. In some cases, such programs may exhibit undefined behavior. Even when a program is well-defined within a language, it may still have a meaning that is not intended by the person who wrote it.

Using natural language as an example, it may not be possible to assign a meaning to a grammatically correct sentence or the sentence may be false:

  • Colorless green ideas sleep furiously.” is grammatically well-formed but has no generally accepted meaning.
  • “John is a married bachelor.” is grammatically well-formed but expresses a meaning that cannot be true.

The following C language fragment is syntactically correct, but performs an operation that is not semantically defined (because p is a null pointer, the operations p->real and p->im have no meaning):

complex *p = NULL;
complex abs_p = sqrt (p->real * p->real + p->im * p->im);

If the type declaration on the first line were omitted, the program would trigger an error on compilation, as the variable “p” would not be defined. But the program would still be syntactically correct, since type declarations provide only semantic information.

The grammar needed to specify a programming language can be classified by its position in the Chomsky hierarchy. The syntax of most programming languages can be specified using a Type-2 grammar, i.e., they are context-free grammars.[25] Some languages, including Perl and Lisp, contain constructs that allow execution during the parsing phase. Languages that have constructs that allow the programmer to alter the behavior of the parser make syntax analysis an undecidable problem, and generally blur the distinction between parsing and execution.[26] In contrast to Lisp’s macro system and Perl’s BEGIN blocks, which may contain general computations, C macros are merely string replacements, and do not require code execution.[27]

Static semantics

The static semantics defines restrictions on the structure of valid texts that are hard or impossible to express in standard syntactic formalisms.[1] For compiled languages, static semantics essentially include those semantic rules that can be checked at compile time. Examples include checking that every identifier is declared before it is used (in languages that require such declarations) or that the labels on the arms of a case statement are distinct.[28] Many important restrictions of this type, like checking that identifiers are used in the appropriate context (e.g. not adding a integer to a function name), or that subroutine calls have the appropriate number and type of arguments can be enforced by defining them as rules in a logic called a type system. Other forms of static analyses like data flow analysis may also be part of static semantics. Newer programming languages like Java and C# have definite assignment analysis, a form of data flow analysis, as part of their static semantics.

Type system

Main articles: Type system and Type safety

A type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. The goal of a type system is to verify and usually enforce a certain level of correctness in programs written in that language by detecting certain incorrect operations. Any decidable type system involves a trade-off: while it rejects many incorrect programs, it can also prohibit some correct, albeit unusual programs. In order to bypass this downside, a number of languages have type loopholes, usually unchecked casts that may be used by the programmer to explicitly allow a normally disallowed operation between different types. In most typed languages, the type system is used only to type check programs, but a number of languages, usually functional ones, perform type inference, which relieves the programmer from writing type annotations. The formal design and study of type systems is known as type theory.

Typed versus untyped languages

A language is typed if the specification of every operation defines types of data to which the operation is applicable, with the implication that it is not applicable to other types.[29] For example, “this text between the quotes” is a string. In most programming languages, dividing a number by a string has no meaning. Most modern programming languages will therefore reject any program attempting to perform such an operation. In some languages, the meaningless operation will be detected when the program is compiled (“static” type checking), and rejected by the compiler, while in others, it will be detected when the program is run (“dynamic” type checking), resulting in a runtime exception.

A special case of typed languages are the single-type languages. These are often scripting or markup languages, such as REXX or SGML, and have only one data type—most commonly character strings which are used for both symbolic and numeric data.

In contrast, an untyped language, such as most assembly languages, allows any operation to be performed on any data, which are generally considered to be sequences of bits of various lengths.[29] High-level languages which are untyped include BCPL and some varieties of Forth.

In practice, while few languages are considered typed from the point of view of type theory (verifying or rejecting all operations), most modern languages offer a degree of typing.[29] Many production languages provide means to bypass or subvert the type system.

Static versus dynamic typing

In static typing all expressions have their types determined prior to the program being run (typically at compile-time). For example, 1 and (2+2) are integer expressions; they cannot be passed to a function that expects a string, or stored in a variable that is defined to hold dates.[29]

Statically typed languages can be either manifestly typed or type-inferred. In the first case, the programmer must explicitly write types at certain textual positions (for example, at variable declarations). In the second case, the compiler infers the types of expressions and declarations based on context. Most mainstream statically typed languages, such as C++, C# and Java, are manifestly typed. Complete type inference has traditionally been associated with less mainstream languages, such as Haskell and ML. However, many manifestly typed languages support partial type inference; for example, Java and C# both infer types in certain limited cases.[30]

Dynamic typing, also called latent typing, determines the type-safety of operations at runtime; in other words, types are associated with runtime values rather than textual expressions.[29] As with type-inferred languages, dynamically typed languages do not require the programmer to write explicit type annotations on expressions. Among other things, this may permit a single variable to refer to values of different types at different points in the program execution. However, type errors cannot be automatically detected until a piece of code is actually executed, making debugging more difficult. Ruby, Lisp, JavaScript, and Python are dynamically typed.

Weak and strong typing

Weak typing allows a value of one type to be treated as another, for example treating a string as a number.[29] This can occasionally be useful, but it can also allow some kinds of program faults to go undetected at compile time and even at runtime.

Strong typing prevents the above. An attempt to perform an operation on the wrong type of value raises an error.[29] Strongly typed languages are often termed type-safe or safe.

An alternative definition for “weakly typed” refers to languages, such as Perl and JavaScript, which permit a large number of implicit type conversions. In JavaScript, for example, the expression 2 * x implicitly converts x to a number, and this conversion succeeds even if x is null, undefined, an Array, or a string of letters. Such implicit conversions are often useful, but they can mask programming errors.

Strong and static are now generally considered orthogonal concepts, but usage in the literature differs. Some use the term strongly typed to mean strongly, statically typed, or, even more confusingly, to mean simply statically typed. Thus C has been called both strongly typed and weakly, statically typed.[31][32]

Execution semantics

Further information: Formal semantics of programming languages

Once data has been specified, the machine must be instructed to perform operations on the data. For example, the semantics may define the strategy by which expressions are evaluated to values, or the manner in which control structures conditionally execute statements. The execution semantics (also known as dynamic semantics) of a language defines how and when the various constructs of a language should produce a program behavior. There are many ways of defining execution semantics. Natural language is often used to specify the execution semantics of languages commonly used in practice. A significant amount of academic research went into formal semantics of programming languages, which allow execution semantics to be specified in a formal manner. Results from this field of research have seen limited application to programming language design and implementation outside academia.

Core library

Main article: Standard library

Most programming languages have an associated core library (sometimes known as the ‘standard library’, especially if it is included as part of the published language standard), which is conventionally made available by all implementations of the language. Core libraries typically include definitions for commonly used algorithms, data structures, and mechanisms for input and output.

A language’s core library is often treated as part of the language by its users, although the designers may have treated it as a separate entity. Many language specifications define a core that must be made available in all implementations, and in the case of standardized languages this core library may be required. The line between a language and its core library therefore differs from language to language. Indeed, some languages are designed so that the meanings of certain syntactic constructs cannot even be described without referring to the core library. For example, in Java, a string literal is defined as an instance of the java.lang.String class; similarly, in Smalltalk, an anonymous function expression (a “block”) constructs an instance of the library’s BlockContext class. Conversely, Scheme contains multiple coherent subsets that suffice to construct the rest of the language as library macros, and so the language designers do not even bother to say which portions of the language must be implemented as language constructs, and which must be implemented as parts of a library.

Design and implementation

Programming languages share properties with natural languages related to their purpose as vehicles for communication, having a syntactic form separate from its semantics, and showing language families of related languages branching one from another.[3] But as artificial constructs, they also differ in fundamental ways from languages that have evolved through usage. A significant difference is that a programming language can be fully described and studied in its entirety, since it has a precise and finite definition.[33] By contrast, natural languages have changing meanings given by their users in different communities. While constructed languages are also artificial languages designed from the ground up with a specific purpose, they lack the precise and complete semantic definition that a programming language has.

Many languages have been designed from scratch, altered to meet new needs, combined with other languages, and eventually fallen into disuse. Although there have been attempts to design one “universal” programming language that serves all purposes, all of them have failed to be generally accepted as filling this role.[34] The need for diverse programming languages arises from the diversity of contexts in which languages are used:

  • Programs range from tiny scripts written by individual hobbyists to huge systems written by hundreds of programmers.
  • Programmers range in expertise from novices who need simplicity above all else, to experts who may be comfortable with considerable complexity.
  • Programs must balance speed, size, and simplicity on systems ranging from microcontrollers to supercomputers.
  • Programs may be written once and not change for generations, or they may undergo continual modification.
  • Finally, programmers may simply differ in their tastes: they may be accustomed to discussing problems and expressing them in a particular language.

One common trend in the development of programming languages has been to add more ability to solve problems using a higher level of abstraction. The earliest programming languages were tied very closely to the underlying hardware of the computer. As new programming languages have developed, features have been added that let programmers express ideas that are more remote from simple translation into underlying hardware instructions. Because programmers are less tied to the complexity of the computer, their programs can do more computing with less effort from the programmer. This lets them write more functionality per time unit.[35]

Natural language processors have been proposed as a way to eliminate the need for a specialized language for programming. However, this goal remains distant and its benefits are open to debate. Edsger W. Dijkstra took the position that the use of a formal language is essential to prevent the introduction of meaningless constructs, and dismissed natural language programming as “foolish”.[36] Alan Perlis was similarly dismissive of the idea.[37] Hybrid approaches have been taken in Structured English and SQL.

A language’s designers and users must construct a number of artifacts that govern and enable the practice of programming. The most important of these artifacts are the language specification and implementation.

Specification

Main article: Programming language specification

The specification of a programming language is intended to provide a definition that the language users and the implementors can use to determine whether the behavior of a program is correct, given its source code.

A programming language specification can take several forms, including the following:

Implementation

Main article: Programming language implementation

An implementation of a programming language provides a way to execute that program on one or more configurations of hardware and software. There are, broadly, two approaches to programming language implementation: compilation and interpretation. It is generally possible to implement a language using either technique.

The output of a compiler may be executed by hardware or a program called an interpreter. In some implementations that make use of the interpreter approach there is no distinct boundary between compiling and interpreting. For instance, some implementations of BASIC compile and then execute the source a line at a time.

Programs that are executed directly on the hardware usually run several orders of magnitude faster than those that are interpreted in software.[citation needed]

One technique for improving the performance of interpreted programs is just-in-time compilation. Here the virtual machine, just before execution, translates the blocks of bytecode which are going to be used to machine code, for direct execution on the hardware.

Usage

Thousands of different programming languages have been created, mainly in the computing field.[41] Programming languages differ from most other forms of human expression in that they require a greater degree of precision and completeness. When using a natural language to communicate with other people, human authors and speakers can be ambiguous and make small errors, and still expect their intent to be understood. However, figuratively speaking, computers “do exactly what they are told to do”, and cannot “understand” what code the programmer intended to write. The combination of the language definition, a program, and the program’s inputs must fully specify the external behavior that occurs when the program is executed, within the domain of control of that program.

A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. A programmer uses the abstractions present in the language to represent the concepts involved in a computation. These concepts are represented as a collection of the simplest elements available (called primitives).[42] Programming is the process by which programmers combine these primitives to compose new programs, or adapt existing ones to new uses or a changing environment.

Programs for a computer might be executed in a batch process without human interaction, or a user might type commands in an interactive session of an interpreter. In this case the “commands” are simply programs, whose execution is chained together. When a language is used to give commands to a software application (such as a shell) it is called a scripting language.[citation needed]

Measuring language usage

Main article: Measuring programming language popularity

It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of programmer hours, a different one have more lines of code, and a third utilize the most CPU time. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems; and other languages are regularly used to write many different kinds of applications.

Various methods of measuring language popularity, each subject to a different bias over what is measured, have been proposed:

  • counting the number of job advertisements that mention the language[43]
  • the number of books sold that teach or describe the language[44]
  • estimates of the number of existing lines of code written in the language—which may underestimate languages not often found in public searches[45]
  • counts of language references (i.e., to the name of the language) found using a web search engine.

Combining and averaging information from various internet sites, langpop.com claims that [46] in 2008 the 10 most cited programming languages are (in alphabetical order): C, C++, C#, Java, JavaScript, Perl, PHP, Python, Ruby, and SQL.

Taxonomies

For more details on this topic, see Categorical list of programming languages.

There is no overarching classification scheme for programming languages. A given programming language does not usually have a single ancestor language. Languages commonly arise by combining the elements of several predecessor languages with new ideas in circulation at the time. Ideas that originate in one language will diffuse throughout a family of related languages, and then leap suddenly across familial gaps to appear in an entirely different family.

The task is further complicated by the fact that languages can be classified along multiple axes. For example, Java is both an object-oriented language (because it encourages object-oriented organization) and a concurrent language (because it contains built-in constructs for running multiple threads in parallel). Python is an object-oriented scripting language.

In broad strokes, programming languages divide into programming paradigms and a classification by intended domain of use. Traditionally, programming languages have been regarded as describing computation in terms of imperative sentences, i.e. issuing commands. These are generally called imperative programming languages. A great deal of research in programming languages has been aimed at blurring the distinction between a program as a set of instructions and a program as an assertion about the desired answer, which is the main feature of declarative programming.[47] More refined paradigms include procedural programming, object-oriented programming, functional programming, and logic programming; some languages are hybrids of paradigms or multi-paradigmatic. An assembly language is not so much a paradigm as a direct model of an underlying machine architecture. By purpose, programming languages might be considered general purpose, system programming languages, scripting languages, domain-specific languages, or concurrent/distributed languages (or a combination of these).[48] Some general purpose languages were designed largely with educational goals.[49]

A programming language may also be classified by factors unrelated to programming paradigm. For instance, most programming languages use English language keywords, while a minority do not. Other languages may be classified as being esoteric or not.

History

A selection of textbooks that teach programming, in languages both popular and obscure. These are only a few of the thousands of programming languages and dialects that have been designed in history.

Main articles: History of programming languages and Programming language generations

Early developments

The first programming languages predate the modern computer. The 19th century had “programmable” looms and player piano scrolls which implemented what are today recognized as examples of domain-specific languages. By the beginning of the twentieth century, punch cards encoded data and directed mechanical processing. In the 1930s and 1940s, the formalisms of Alonzo Church‘s lambda calculus and Alan Turing‘s Turing machines provided mathematical abstractions for expressing algorithms; the lambda calculus remains influential in language design.[50]

In the 1940s, the first electrically powered digital computers were created. The first high-level programming language to be designed for a computer was Plankalkül, developed for the German Z3 by Konrad Zuse between 1943 and 1945. However, it was not implemented until 1998 and 2000.[51]

Programmers of early 1950s computers, notably UNIVAC I and IBM 701, used machine language programs, that is, the first generation language (1GL). 1GL programming was quickly superseded by similarly machine-specific, but mnemonic, second generation languages (2GL) known as assembly languages or “assembler”. Later in the 1950s, assembly language programming, which had evolved to include the use of macro instructions, was followed by the development of “third generation” programming languages (3GL), such as FORTRAN, LISP, and COBOL.[52] 3GLs are more abstract and are “portable”, or at least implemented similarly on computers that do not support the same native machine code. Updated versions of all of these 3GLs are still in general use, and each has strongly influenced the development of later languages.[53] At the end of the 1950s, the language formalized as ALGOL 60 was introduced, and most later programming languages are, in many respects, descendants of Algol.[53] The format and use of the early programming languages was heavily influenced by the constraints of the interface.[54]

Refinement

The period from the 1960s to the late 1970s brought the development of the major language paradigms now in use, though many aspects were refinements of ideas in the very first Third-generation programming languages:

Each of these languages spawned an entire family of descendants, and most modern languages count at least one of them in their ancestry.

The 1960s and 1970s also saw considerable debate over the merits of structured programming, and whether programming languages should be designed to support it.[57] Edsger Dijkstra, in a famous 1968 letter published in the Communications of the ACM, argued that GOTO statements should be eliminated from all “higher level” programming languages.[58]

The 1960s and 1970s also saw expansion of techniques that reduced the footprint of a program as well as improved productivity of the programmer and user. The card deck for an early 4GL was a lot smaller for the same functionality expressed in a 3GL deck.

Consolidation and growth

The 1980s were years of relative consolidation. C++ combined object-oriented and systems programming. The United States government standardized Ada, a systems programming language derived from Pascal and intended for use by defense contractors. In Japan and elsewhere, vast sums were spent investigating so-called “fifth generation” languages that incorporated logic programming constructs.[59] The functional languages community moved to standardize ML and Lisp. Rather than inventing new paradigms, all of these movements elaborated upon the ideas invented in the previous decade.

One important trend in language design for programming large-scale systems during the 1980s was an increased focus on the use of modules, or large-scale organizational units of code. Modula-2, Ada, and ML all developed notable module systems in the 1980s, although other languages, such as PL/I, already had extensive support for modular programming. Module systems were often wedded to generic programming constructs.[60]

The rapid growth of the Internet in the mid-1990s created opportunities for new languages. Perl, originally a Unix scripting tool first released in 1987, became common in dynamic websites. Java came to be used for server-side programming, and bytecode virtual machines became popular again in commercial settings with their promise of “Write once, run anywhere” (UCSD Pascal had been popular for a time in the early 1980s). These developments were not fundamentally novel, rather they were refinements to existing languages and paradigms, and largely based on the C family of programming languages.

Programming language evolution continues, in both industry and research. Current directions include security and reliability verification, new kinds of modularity (mixins, delegates, aspects), and database integration such as Microsoft’s LINQ.

The 4GLs are examples of languages which are domain-specific, such as SQL, which manipulates and returns sets of data rather than the scalar values which are canonical to most programming languages. Perl, for example, with its ‘here document‘ can hold multiple 4GL programs, as well as multiple JavaScript programs, in part of its own perl code and use variable interpolation in the ‘here document’ to support multi-language programming.[61]

Another definition about programming language

A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal. Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions.

High-level programming languages, while simple compared to human languages, are more complex than the languages the computer actually understands, called machine languages. Each different type of CPU has its own unique machine language.

Lying between machine languages and high-level languages are languages called assembly languages. Assembly languages are similar to machine languages, but they are much easier to program in because they allow a programmer to substitute names for numbers. Machine languages consist of numbers only.

Lying above high-level languages are languages called fourth-generation languages (usually abbreviated 4GL). 4GLs are far removed from machine languages and represent the class of computer languages closest to human languages.

Regardless of what language you use, you eventually need to convert your program into machine language so that the computer can understand it. There are two ways to do this:

  • interpret the program

See compile and interpreter for more information about these two methods.

The question of which language is best is one that consumes a lot of time and energy among computer professionals. Every language has its strengths and weaknesses. For example, FORTRAN is a particularly good language for processing numerical data, but it does not lend itself very well to organizing large programs. Pascal is very good for writing well-structured and readable programs, but it is not as flexible as the C programming language. C++ embodies powerful object-oriented features, but it is complex and difficult to learn.

The choice of which language to use depends on the type of computer the program is to run on, what sort of program it is, and the expertise of the programmer.

Language in which a computer programmer writes instructions for a computer to execute. Some languages, such as COBOL, FORTRAN, Pascal, and C, are known as procedural languages because they use a sequence of commands to specify how the machine is to solve a problem. Others, such as LISP, are functional, in that programming is done by invoking procedures (sections of code executed within a program). Languages that support object-oriented programming take the data to be manipulated as their point of departure. Programming languages can also be classified as high-level or low-level. Low-level languages address the computer in a way that it can understand directly, but they are very far from human language. High-level languages deal in concepts that humans devise and can understand, but they must be translated by means of a compiler into language the computer understands.

For more information on programming language, visit Britannica.com.

Sci-Tech Encyclopedia:

Programming languages

Top

Home > Library > Science > Sci-Tech Encyclopedia

The different notations used to communicate algorithms to a computer. A computer executes a sequence of instructions (a program) in order to perform some task. In spite of much written about computers being electronic brains or having artificial intelligence, it is still necessary for humans to convey this sequence of instructions to the computer before the computer can perform the task. The set of instructions and the order in which they have to be performed is known as an algorithm. The result of expressing the algorithm in a programming language is called a program. The process of writing the algorithm using a programming language is called programming, and the person doing this is the programmer. See also Algorithm.

In order for a computer to execute the instructions indicated by a program, the program needs to be stored in the primary memory of the computer. Each instruction of the program may occupy one or more memory locations. Instructions are stored as a sequence of binary numbers (sequences of zeros and ones), where each number may indicate the instruction to be executed (the operator) or the pieces of data (operands) on which the instruction is carried out. Instructions that the computer can understand directly are said to be written in machine language. Programmers who design computer algorithms have difficulty in expressing the individual instructions of the algorithm as a sequence of binary numbers. To alleviate this problem, people who develop algorithms may choose a programming language. Since the language used by the programmer and the language understood by the computer are different, another computer program called a compiler translates the program written in a programming language into an equivalent sequence of instructions that the computer is able to understand and carry out. See also Computer storage technology.

Machine language

For the first machines in the 1940s, programmers had no choice but to write in the sequences of digits that the computer executed. For example, assume we want to compute the absolute value of A + BC, where A is the value at machine address 3012, B is the value at address 3013, and C is the value at address 3014, and then store this value at address 3015.

It should be clear that programming in this manner is difficult and fraught with errors. Explicit memory locations must be written, and it is not always obvious if simple errors are present. For example, at location 02347, writing 101… instead of 111… would compute |A + B + C| rather than what was desired. This is not easy to detect.

Assembly language

Since each component of a program stands for an object that the programmer understands, using its name rather than numbers should make it easier to program. By naming all locations with easy-to-remember names, and by using symbolic names for machine instructions, some of the difficulties of machine programming can be eliminated. A relatively simple program called an assembler converts this symbolic notation into an equivalent machine language program.

The symbolic nature of assembly language greatly eased the programmer’s burden, but programs were still very hard to write. Mistakes were still common. Programmers were forced to think in terms of the computer’s architecture rather than in the domain of the problem being solved.

High-level language

The first programming languages were developed in the late 1950s. The concept was that if we want to compute |A + BC|, and store the result in a memory location called D, all we had to do was write D = |A + BC| and let a computer program, the compiler, convert that into the sequences of numbers that the computer could execute. FORTRAN (an acronym for Formula Translation) was the first major language in this period.

FORTRAN statements were patterned after mathematical notation. In mathematics the = symbol implies that both sides of the equation have the same value. However, in FORTRAN and some other languages, the equal sign is known as the assignment operator. The action carried out by the computer when it encounters this operator is, “Make the variable named on the left of the equal sign have the same value as the expression on the right.” Because of this, in some early languages the statement would have been written as −DD to imply movement or change, but the use of → as an assignment operator has all but disappeared.

The compiler for FORTRAN converts that arithmetic statement into an equivalent machine language sequence. In this case, we did not care what addresses the compiler used for the instructions or data, as long as we could associate the names A, B, C, and D with the data values we were interested in.

Structure of programming languages

Programs written in a programming language contain three basic components: (1) a mechanism for declaring data objects to contain the information used by the program; (2) data operations that provide for transforming one data object into another; (3) an execution sequence that determines how execution proceeds from start to finish.

Data declarations

Data objects can be constants or variables. A constant always has a specific value. Thus the constant 42 always has the integer value of forty-two and can never have another value. On the other hand, we can define variables with symbolic names. The declaration of variable A as an integer informs the compiler that A should be given a memory location much like the way the variable A in example (2) was given the machine address 03012. The program is given the option of changing the value stored at this memory location as the program executes.

Each data object is defined to be of a specific type. The type of a data object is the set of values the object may have. Types can generally be scalar or aggregate. An object declared to be a scalar object is not divisible into smaller components, and generally it represents the basic data types executable on the physical computer. In a data declaration, each data object is given a name and a type. The compiler will choose what machine location to assign for the declared name.

Data operations

Data operations provide for setting the values into the locations allocated for each declared data variable. In general this is accomplished by a three-step process: a set of operators is defined for transforming the value of each data object, an expression is written for performing several such operations, and an assignment is made to change the value of some data object.

For each data type, languages define a set of operations on objects of that type. For the arithmetic types, there are the usual operations of addition, subtraction, multiplication, and division. Other operations may include exponentiation (raising to a power), as well as various simple functions such as modula or remainder (when dividing one integer by another). There may be other binary operations involving the internal format of the data, such as binary and, or, exclusive or, and not functions. Usually there are relational operations (for example, equal, not equal, greater than, less than) whose result is a boolean value of true or false. There is no limit to the number of operations allowed, except that the programming language designer has to decide between the simplicity and smallness of the language definition versus the ease of using the language.

Execution sequence

The purpose of a program is to manipulate some data in order to produce an answer. While the data operations provide for this manipulation, there must be a mechanism for deciding which expressions to execute in order to generate the desired answer. That is, an algorithm must trace a path through a series of expressions in order to arrive at an answer. Programming languages have developed three forms of execution sequencing: (1) control structures for determining execution sequencing within a procedure; (2) interprocedural communication between procedures; and (3) inheritance, or the automatic passing of information between two procedures.

Corrado Böhm and Giuseppi Jacopini showed in 1966 that a programming language needs only three basic statements for control structures: an assignment statement, an IF statement, and a looping construct. Anything else can simplify programming a solution, but is not necessary. If we add an input and an output statement, we have all that we need for a programming language. Languages execute statements sequentially with the following variations to this rule.

IF statement. Most languages include the IF statement. In the IF-THEN statement, the expression is evaluated, and if the value is true, then Statement1 is executed next. If the value is false, then the statement after the IF statement is the next one to execute. The IF-THEN-ELSE statement is similar, except that specific true and false options are given to execute next. After executing either the THEN or ELSE part, the statement following the IF statement is the next one to execute.

The usual looping constructs are the WHILE statement and the REPEAT statement. Although only one is necessary, languages usually have both.

Inheritance is the third major form of execution sequencing. In this case, information is passed automatically between program segments. This is the basis for the models used in the object-oriented languages C++ and Java.

Inheritance involves the concept of a class object. There are integer class objects, string class objects, file class objects, and so forth. Data objects are instances of these class objects. Objects inherit the properties of the objects from which they were created. Thus, if an integer object were designed with the methods (that is, functions) of addition and subtraction, each instance of an integer object would inherit those same functions. One would only need to develop these operations once and then the functionality would pass on to the derived object.

All objects are derived from one master object called an Object. An Object is the parent class of objects such as magnitude, collection, and stream. Magnitude now is the parent of objects that have values, such as numbers, characters, and dates. Collections can be ordered collections such as an array or an unordered collection such as a set. Streams are the parent objects of files. From this structure an entire class hierarchy can be developed.

If we develop a method for one object (for example, print method for object), then this method gets inherited to all objects derived from that object. Therefore, there is not the necessity to always define new functionality. If we create a new class of integer that, for example, represents the number of days in a year (from 1 to 366), then this new integerlike object will inherit all of the properties of integers, including the methods to add, subtract, and print values. It is this concept that has been built into C++, Java, and current object-oriented languages.

Once we build concepts around a class definition, we have a separate package of functions that are self-contained. We are able to sell that package as a new functionality that users may be willing to pay for rather than develop themselves. This leads to an economic model where companies can build add-ons for existing software, each add-on consisting of a set of class definitions that becomes inherited by the parent class. See also Object-oriented programming.

Current programming language models

C was developed by AT&T Bell Laboratories during the early 1970s. At the time, Ken Thompson was developing the UNIX operating system. Rather than using machine or assembly language as in (2) or (3) to write the system, he wanted a high-level language. See also Operating system.

C has a structure like FORTRAN. A C program consists of several procedures, each consisting of several statements, that include the IF, WHILE, and FOR statements. However, since the goal was to develop operating systems, a primary focus of C was to include operations that allow the programmer access to the underlying hardware of the computer. C includes a large number of operators to manipulate machine language data in the computer, and includes a strong dependence on reference variables so that C programs are able to manipulate the addressing hardware of the machine.

C++ was developed in the early 1980s as an extension to C by Bjarne Stroustrup at AT&T Bell Labs. Each C++ class would include a record declaration as well as a set of associated functions. In addition, an inheritance mechanism was included in order to provide for a class hierarchy for any program.

By the early 1990s, the World Wide Web was becoming a significant force in the computing community, and web browsers were becoming ubiquitous. However, for security reasons, the browser was designed with the limitation that it could not affect the disk storage of the machine it was running on. All computations that a web page performed were carried out on the web server accessed by web address (its Uniform Resource Locator, or URL). That was to prevent web pages from installing viruses on user machines or inadvertently (or intentionally) destroying the disk storage of the user.

Java bears a strong similarity to C++, but has eliminated many of the problems of C++. The three major features addressed by Java are:

  1. There are no reference variables, thus no way to explicitly reference specific memory locations. Storage is still allocated by creating new class objects, but this is implicit in the language, not explicit.
  2. There is no procedure call statement; however, one can invoke a procedure using the member of class operation. A call to CreateAddress for class address would be encoded as address.CreateAddress( ).
  3. A large class library exists for creating web-based objects.

The Java bytecodes (called applets) are transmitted from the web server to the client web site and then execute. This saves transmission time as the executing applet is on the user’s machine once it is downloaded, and it frees machine time on the server so it can process more web “hits” effectively. See also Client-server system.

Visual Basic, first released in 1991, grew out of Microsoft’s GW Basic product of the 1980s. The language was organized around a series of events. Each time an event happened (for example, mouse click, pulling down a menu), the program would respond with a procedure associated with that event. Execution happens in an asynchronous manner.

Although Prolog development began in 1970, its use did not spread until the 1980s. Prolog represents a very different model of program execution, and depends on the resolution principle and satisfaction of Horn clauses of Robert A. Kowalski at the University of Edinburgh. That is, a Prolog statement is of the form p:- q, r which means p is true if both q is true or r is true.

A Prolog program consists of a series Horn clauses, each being a sequence of relations concerning data in a database. Execution proceeds sequentially through these clauses. Each relation can invoke another Horn clause to be satisfied. Evaluation of a relation is similar to returning a procedure value in imperative languages such as C or C++.

Unlike the other languages mentioned, Prolog is not a complete language. That means there are algorithms that cannot be programmed in Prolog. However, for problems that are amenable for searching large databases, Prolog is an efficient mechanism for describing those algorithms. See also Software engineering; Software engineering.


Modern Science:

programming language

Top

Home > Library > Science > Modern Science

programming language

In computer technology, a set of conventions in which instructions for the machine are written. There are many languages that allow humans to communicate with computers; FORTRAN, BASIC, and Pascal are some common ones.

Computer Desktop Encyclopedia:

programming language

Top

Home > Library > Technology > Computer Encyclopedia

A language used to write instructions for the computer. It lets the programmer express data processing in a symbolic manner without regard to machine-specific details.

From Source Code to Machine Language

The statements that are written by the programmer are called “source language,” and they are translated into the computer’s “machine language” by programs called “assemblers,” “compilers” and “interpreters.” For example, when a programmer writes MULTIPLY HOURS TIMES RATE, the verb MULTIPLY must be turned into a code that means multiply, and the nouns HOURS and RATE must be turned into memory locations where those items of data are actually located.

Grammar and Syntax

Like human languages, each programming language has its own grammar and syntax. There are many dialects of the same language, and each dialect requires its own translation system. Standards have been set by ANSI for many programming languages, and ANSI-standard languages are dialect free. However, it can take years for new features to be included in ANSI standards, and new dialects inevitably spring up as a result.

Low Level and High Level

Programming languages fall into two categories: low-level assembly languages and high-level languages. Assembly languages are available for each CPU family, and each assembly instruction is translated into one machine instruction by the assembler program. With high-level languages, a programming statement may be translated into one or several machine instructions by the compiler.

Following is a brief summary of the major high-level languages. Look up each one for more details. For a list of high-level programming languages designed for client/server development, see client/server development system.

ActionScript

Programming language for Flash programs. See Flash and ActionScript.

Ada

Comprehensive, Pascal-based language used by the Department of Defense. See Ada.

ALGOL

International language for expressing algorithms. See ALGOL.

APL

Used for statistics and mathematical matrices. Requires special keyboard symbols. See APL.

BASIC

Developed as a timesharing language in the 1960s. It has been widely used in microcomputer programming in the past, and various dialects of BASIC have been incorporated into many different applications. Microsoft’s Visual Basic is widely used. See BASIC and Visual Basic.

C

Developed in the 1980s at AT&T. Widely used to develop commercial applications. Unix is written in C. See C.

C++

Object-oriented version of C that is popular because it combines object-oriented capability with traditional C programming syntax. See C++.

C#

Pronounced “C-sharp.” A Microsoft .NET language based on C++ with elements from Visual Basic and Java. See .NET.

COBOL

Developed in the 1960s. Widely used for mini and mainframe programming. See COBOL.

dBASE

Used to be widely used in business applications, but FoxPro (Microsoft’s dBASE) has survived the longest. See Visual FoxPro, FoxBase, Clipper and Quicksilver.

F#

Pronounced “F-sharp.” A Microsoft .NET scripting language based on ML. See F#.

FORTH

Developed in the 1960s, FORTH has been used in process control and game applications. See FORTH.

FORTRAN

Developed in 1954 by IBM, it was the first major scientific programming language and continues to be widely used. Some commercial applications have been developed in FORTRAN. See FORTRAN.

Java

The programming language developed by Sun and repositioned for Web use. It is widely used on the server side, although client applications are increasingly used. See Java.

JavaScript

The de facto scripting language on the Web. JavaScript is embedded into millions of HTML pages. See JavaScript.

JScript

Microsoft’s version of JavaScript. Used in ASP programs. See JScript.

LISP

Developed in 1960. Used for AI applications. Its syntax is very different than other languages. See LISP.

Logo

Developed in the 1960s, it was noted for its ease of use and “turtle graphics” drawing functions. See Logo.

Lua

Fast, lightweight scripting language that runs on Windows, Unix/Linux and smartphone platforms. See Lua.

M

Originally MUMPS (Massachusetts Utility MultiProgramming System), it includes its own database. It is widely used in medical applications. See M.

Modula-2

Enhanced version of Pascal introduced in 1979. See Modula-2.

Pascal

Originally an academic language developed in the 1970s. Borland commercialized it with its Turbo Pascal. See Pascal.

Perl

A scripting language widely used on the Web to write CGI scripts. See Perl.

Prolog

Developed in France in 1973. Used throughout Europe and Japan for AI applications. See Prolog.

Python

A scripting language used for system utilities and Internet scripts. Developed in Amsterdam by Guido van Rossum. See Python.

REXX

Runs on IBM mainframes and OS/2. Used as a general-purpose macro language. See REXX.

VBScript

Subset of Visual Basic used on the Web similar to JavaScript. See VBScript.

Visual Basic

Version of BASIC for Windows programming from Microsoft that has been widely used. See Visual Basic.

Web Languages

Languages such as JavaScript, Jscript, Perl and CGI are used to automate Web pages as well as link them to other applications running in servers.

Millions of Languages!

Programmers must use standard names for the instruction verbs (add, compare, etc.) in the language they use. In addition, a company generally uses standardized names for the data elements in its databases. However, programmers typically “make up” names for all the functions (subroutines) in the program. Since programmers are loathe to document their code, the readability of the names chosen for these routines is critical.

In a single program, the programmer could make up hundreds of function names as well as names for data structures that hold fixed sums, predefined tables and display messages.

Just Make It Up!

Unless rigid naming conventions are enforced or pair programming is used, whereby one person looks over the shoulders of the other, programmers can make up names that make no sense whatsoever. Little understood by non-programmers, this is the bane of many professionals when they have to modify someone else’s program. Debugging another person’s code is very difficult if the names are cryptic, and there are few comments, which is often the case. It often requires tracing the logic one statement at a time.

In fact, if programmers are not attentive to naming things clearly, they can have a miserable time reading their own code later on. See pair programming, programmer, to the recruiter and naming fiascos.

Download Computer Desktop Encyclopedia to your iPhone/iTouch

Columbia Encyclopedia:

programming language

Top

Home > Library > Miscellaneous > Columbia Encyclopedia

programming language, syntax, grammar, and symbols or words used to give instructions to a computer.

Development of Low-Level Languages

All computers operate by following machine language programs, a long sequence of instructions called machine code that is addressed to the hardware of the computer and is written in binary notation (see numeration), which uses only the digits 1 and 0. First-generation languages, called machine languages, required the writing of long strings of binary numbers to represent such operations as “add,” “subtract,” “and compare.” Later improvements allowed octal, decimal, or hexadecimal representation of the binary strings.

Because writing programs in machine language is impractical (it is tedious and error prone), symbolic, or assembly, languages-second-generation languages-were introduced in the early 1950s. They use simple mnemonics such as A for “add” or M for “multiply,” which are translated into machine language by a computer program called an assembler. The assembler then turns that program into a machine language program. An extension of such a language is the macro instruction, a mnemonic (such as “READ”) for which the assembler substitutes a series of simpler mnemonics. The resulting machine language programs, however, are specific to one type of computer and will usually not run on a computer with a different type of central processing unit (CPU).

Evolution of High-Level Languages

The lack of portability between different computers led to the development of high-level languages-so called because they permitted a programmer to ignore many low-level details of the computer’s hardware. Further, it was recognized that the closer the syntax, rules, and mnemonics of the programming language could be to “natural language” the less likely it became that the programmer would inadvertently introduce errors (called “bugs”) into the program. Hence, in the mid-1950s a third generation of languages came into use. These algorithmic, or procedural, languages are designed for solving a particular type of problem. Unlike machine or symbolic languages, they vary little between computers. They must be translated into machine code by a program called a compiler or interpreter.

Early computers were used almost exclusively by scientists, and the first high-level language, Fortran [Formula translation], was developed (1953-57) for scientific and engineering applications by John Backus at the IBM Corp. A program that handled recursive algorithms better, LISP [LISt Processing], was developed by John McCarthy at the Massachusetts Institute of Technology in the early 1950s; implemented in 1959, it has become the standard language for the artificial intelligence community. COBOL [COmmon Business Oriented Language], the first language intended for commercial applications, is still widely used; it was developed by a committee of computer manufacturers and users under the leadership of Grace Hopper, a U.S. Navy programmer, in 1959. ALGOL [ALGOrithmic Language], developed in Europe about 1958, is used primarily in mathematics and science, as is APL [A Programming Language], published in the United States in 1962 by Kenneth Iverson. PL/1 [Programming Language 1], developed in the late 1960s by the IBM Corp., and ADA [for Ada Augusta, countess of Lovelace, biographer of Charles Babbage], developed in 1981 by the U.S. Dept. of Defense, are designed for both business and scientific use.

BASIC [Beginner’s All-purpose Symbolic Instruction Code] was developed by two Dartmouth College professors, John Kemeny and Thomas Kurtz, as a teaching tool for undergraduates (1966); it subsequently became the primary language of the personal computer revolution. In 1971, Swiss professor Nicholas Wirth developed a more structured language for teaching that he named Pascal (for French mathematician Blaise Pascal, who built the first successful mechanical calculator). Modula 2, a Pascallike language for commercial and mathematical applications, was introduced by Wirth in 1982. Ten years before that, to implement the UNIX operating system, Dennis Ritchie of Bell Laboratories produced a language that he called C; along with its extensions, called C++, developed by Bjarne Stroustrup of Bell Laboratories, it has perhaps become the most widely used general-purpose language among professional programmers because of its ability to deal with the rigors of object-oriented programming. Java is an object-oriented language similar to C++ but simplified to eliminate features that are prone to programming errors. Java was developed specifically as a network-oriented language, for writing programs that can be safely downloaded through the Internet and immediately run without fear of computer viruses. Using small Java programs called applets, World Wide Web pages can be developed that include a full range of multimedia functions.

Fourth-generation languages are nonprocedural-they specify what is to be accomplished without describing how. The first one, FORTH, developed in 1970 by American astronomer Charles Moore, is used in scientific and industrial control applications. Most fourth-generation languages are written for specific purposes. Fifth-generation languages, which are still in their infancy, are an outgrowth of artificial intelligence research. PROLOG [PROgramming LOGic], developed by French computer scientist Alain Colmerauer and logician Philippe Roussel in the early 1970s, is useful for programming logical processes and making deductions automatically.

Many other languages have been designed to meet specialized needs. GPSS [General Purpose System Simulator] is used for modeling physical and environmental events, and SNOBOL [String-Oriented Symbolic Language] is designed for pattern matching and list processing. LOGO, a version of LISP, was developed in the 1960s to help children learn about computers. PILOT [Programmed Instruction Learning, Or Testing] is used in writing instructional software, and Occam is a nonsequential language that optimizes the execution of a program’s instructions in parallel-processing systems.

There are also procedural languages that operate solely within a larger program to customize it to a user’s particular needs. These include the programming languages of several database and statistical programs, the scripting languages of communications programs, and the macro languages of word-processing programs.

Compilers and Interpreters

Once the program is written and has had any errors repaired (a process called debugging), it may be executed in one of two ways, depending on the language. With some languages, such as C or Pascal, the program is turned into a separate machine language program by a compiler, which functions much as an assembler does. Other languages, such as LISP, do not have compilers but use an interpreter to read and interpret the program a line at a time and convert it into machine code. A few languages, such as BASIC, have both compilers and interpreters. Source code, the form in which a program is written in a high-level language, can easily be transferred from one type of computer to another, and a compiler or interpreter specific to the machine configuration can convert the source code to object, or machine, code.

Bibliography

See R. Cezzar, A Guide to Programming Languages: Overview and Comparison (1995), T. W. Pratt and M. V. Zelkowitz, Programming Languages: Design and Implementation (3d ed. 1996); C. Ghezzi and M. Jazayem, Programming Language Concepts (3d ed. 1997); R. W. Sebasta, Concepts of Programming Languages (4th ed. 1998).

0 

11October2010

TUGAS BAHASA PEMROGRAMAN 2

Posted by wanto under: Uncategorized.

TUGAS BAHASA PEMROGRAMAN 2

Algoritma

1.      Mulai.

2.      Syarat pertama dapat mengikuti pemilu adalah Warga Negara Indonesia, jika bukan WNI maka tidak berhak memilih.

3.      Syarat kedua dapat mengikuti pemilu adalah Berusia 17 tahun keatas atau sudah menikah, jika tidak memenuhi maka tidak berhak memilih.

4.      Jika memenuhi syarat-syarat tersebut maka orang tersebut berhak memilih (mengikuti pemilu).

5.      Selesai.


Flowchart

0 

11October2010

TUGAS BAHASA PEMROGRAMAN

Posted by wanto under: Uncategorized.

TUGAS BAHASA PEMROGRAMAN

ALGORITMA

Langkah-langkah mencuci pakaian :

  1. Mulai.
  2. Siapkan pakaian kotor  yang akan dicuci.
  3. Masukkan ke dalam suatu wadah dan beri detergen.
  4. Tuang air ke dalam wadah tersebut.
  5. Rendam ±15 menit.
  6. Kucek seperlunya setelah beberapa saat.
  7. Bilas dengan air bersih.
  8. Pakaian bersih.
  9. Selesai

FLOWCHART



0 

11October2010

bilangan dan angka

Posted by wanto under: Uncategorized.

BILANGAN DAN ANGKA

Bilangan adalah suatu konsep matematika yang digunakan untuk pencacahan dan pengukuran. Simbol ataupun lambang yang digunakan untuk mewakili suatu bilangan disebut sebagai angka atau lambang bilangan. Dalam matematika, konsep bilangan selama bertahun-tahun lamanya telah diperluas untuk meliputi bilangan nol, bilangan negatif, bilangan rasional, bilangan irasional, dan bilangan kompleks.

Prosedur-prosedur tertentu yang mengambil bilangan sebagai masukan dan menghasil bilangan lainnya sebagai keluran, disebut sebagai operasi numeris. Operasi uner mengambil satu masukan bilangan dan menghasilkan satu keluaran bilangan. Operasi yang lebih umumnya ditemukan adalah operasi biner, yang mengambil dua bilangan sebagai masukan dan menghasilkan satu bilangan sebagai keluaran. Contoh operasi biner adalah penjumlahan, pengurangan, perkalian, pembagian, dan perpangkatan. Bidang matematika yang mengkaji operasi numeris disebut sebagai aritmetika

Dalam penggunaan sehari-hari, angka dan bilangan seringkali dianggap sebagai dua entitas yang sama. Selain itu terdapat pula konsep nomor yang berkaitan. Secara kaku, angka, bilangan, dan nomor merupakan tiga entitas yang berbeda.

Angka adalah suatu tanda atau lambang yang digunakan untuk melambangkan bilangan. Contohnya, bilangan lima dapat dilambangkan menggunakan angka Hindu-Arab “5” (sistem angka berbasis 10), “101” (sistem angka biner), maupun menggunakan angka Romawi ‘V’. Lambang “5”, “1”, “0”, dan “V” yang digunakan untuk melambangkan bilangan lima disebut sebagai angka.

Nomor biasanya menunjuk pada satu atau lebih angka yang melambangkan sebuah bilangan bulat dalam suatu barisan bilangan-bilangan bulat yg berurutan. Misalnya kata ‘nomor 3′ menunjuk salah satu posisi urutan dalam barisan bilangan-bilangan 1, 2, 3, 4, …, dst. Kata nomor sangat erat terkait dengan pengertian “urutan”.

Menurut sejarah ketika orang melakukan kegiatan membilang atau mencacah kebingungan untuk memberikan lambang bilangannya. tetapi kemudian dibuatlah sistem numerasi yaitu sistem yang terdiri dari numerial (lambang bilangan/angka) dan number (bilangan). Sistem numerasi adalah aturan untuk menyatakan menuliskan bilangan dengan menggunakan sejumlah lambang bilangan.

Bilangan sendiri itu adalah ide abstrak yang tidak didefinisikan. Setiap Bilangan mempunyai banyak lambang bilangan. Satu lambang bilangan menggambarkan satu bilangan. Setiap bilangan mempunyai banyak nama. Misal bilangan 125 mempunyai nama bilangan seratus dua puluh lima. terdiri dari lambang bilangan 1, 2, dan 5.

angka/digit terdiri dari 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 lambang bilangan ini disebut angka hindu arab yang digunakan sampai sekarang

Sebelum angka hindu arab ditemukan, terdapat lambang bilangan mesir kuno yang disebut heroglip, lambang bilangan romawi, lambang bilangan babilon, lambang bilangan maya

0 

11October2010

perbedaan write, writeln, read, readln, PHP

Posted by wanto under: Uncategorized.

Prosedur Write, Writeln, Read dan Readln

Pada program sebelumnya telah ditampilkan beberapa prosedur. Di antaranya Writeln dan Readln. Berikut adalah beberapa fungsi dari Write, Writeln, Read, dan Readln dari Pascal

  • write : menulis keluaran di layar, tetapi kursor di tempat yang sama
  • writeln : menulis keluaran di layar, kursor akan berganti baris
  • read : membaca masukan dari keyboard, tetapi kursor tetap di baris yang sama
  • readln : membaca masukan dari keyboard, kursor akan pindah ke baris berikutnya

Dalam bahasa Pascal, yang seringkali digunakan yaitu hanya writeln dan readln. Write dan read hanya dibutuhkan dalam beberapa hal. Jadi silakan pilih mana yang dibutuhkan sesuai dengan kebutuhan. Untuk contoh agar anda lebih memahami fungsi writeln dan readln, silakan simak program berikut:

view plaincopy to clipboardprint?

program Satu;

uses
crt;

begin
ClrScr;
writeln(‘Kita sedang berada pada Pascal’);
Readln;
end.

  1. program Kedua;
  2. uses
  3. crt;
  4. var
  5. nama: string[25];
  6. begin
  7. clrscr;
  8. write(‘Masukkan nama anda: ‘);
  9. readln(nama);
  10. writeln(‘Selamat Datang di Pascal, ‘, nama);
  11. readln;
  12. end.
program Kedua;

uses
    crt;

var
    nama: string[25];

begin
    clrscr;
    write('Masukkan nama anda: ');
    readln(nama);
    writeln('Selamat Datang di Pascal, ', nama);
    readln;
end.

Keterangan dari program di atas:

  • Baris 1: menerangkan bahwa program tersebut bernama kedua
  • Baris 3 dan 4: menerangkan bahwa program tersebut menggunakan unit crt
  • Baris 6 dan 7: menerangkan bahwa program tersebut menggunakan variabel nama dengan tipe string dengan panjang maksimal 25 karakter
  • Baris 9: permulaan blok program utama
  • Baris 10 : digunakan untuk membersihkan layar, clrscr artinya clear screen
  • Baris 11 : digunakan untuk menampilkan informasi ke monitor bahwa anda diminta untuk memasukkan nama posisi kursor ada di sebelah kanan
  • Baris 12 : digunakan untuk membaca masukan dari user dan menampungnya ke variabel nama
  • Baris 13 : digunakan untuk menampilkan output nama yang dimasukkan tadi dari variabel nama
  • Baris 14 : digunakan untuk menunggu user menekan tombol dari keyboard
  • Baris 15 : digunakan untuk mengakhiri program

PHP

The PHP development team would like to announce the immediate availability of PHP 5.3.3. This release focuses on improving the stability and security of the PHP 5.3.x branch with over 100 bug fixes, some of which are security related. All users are encouraged to upgrade to this release.

Backwards incompatible change:

  • Methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn’t affect non-namespaced classes.

<?php
namespace Foo;
class Bar {
public function Bar() {
// treated as constructor in PHP 5.3.0-5.3.2
// treated as regular method in PHP 5.3.3
}
}
?>

There is no impact on migration from 5.2.x because namespaces were only introduced in PHP 5.3.

Security Enhancements and Fixes in PHP 5.3.3:

  • Rewrote var_export() to use smart_str rather than output buffering, prevents data disclosure if a fatal error occurs (CVE-2010-2531).
  • Fixed a possible resource destruction issues in shm_put_var().
  • Fixed a possible information leak because of interruption of XOR operator.
  • Fixed a possible memory corruption because of unexpected call-time pass by refernce and following memory clobbering through callbacks.
  • Fixed a possible memory corruption in ArrayObject::uasort().
  • Fixed a possible memory corruption in parse_str().
  • Fixed a possible memory corruption in pack().
  • Fixed a possible memory corruption in substr_replace().
  • Fixed a possible memory corruption in addcslashes().
  • Fixed a possible stack exhaustion inside fnmatch().
  • Fixed a possible dechunking filter buffer overflow.
  • Fixed a possible arbitrary memory access inside sqlite extension.
  • Fixed string format validation inside phar extension.
  • Fixed handling of session variable serialization on certain prefix characters.
  • Fixed a NULL pointer dereference when processing invalid XML-RPC requests (Fixes CVE-2010-0397, bug #51288).
  • Fixed SplObjectStorage unserialization problems (CVE-2010-2225).
  • Fixed possible buffer overflows in mysqlnd_list_fields, mysqlnd_change_user.
  • Fixed possible buffer overflows when handling error packets in mysqlnd.

Key enhancements in PHP 5.3.3 include:

  • Upgraded bundled sqlite to version 3.6.23.1.
  • Upgraded bundled PCRE to version 8.02.
  • Added FastCGI Process Manager (FPM) SAPI.
  • Added stream filter support to mcrypt extension.
  • Added full_special_chars filter to ext/filter.
  • Fixed a possible crash because of recursive GC invocation.
  • Fixed bug #52238 (Crash when an Exception occured in iterator_to_array).
  • Fixed bug #52041 (Memory leak when writing on uninitialized variable returned from function).
  • Fixed bug #52060 (Memory leak when passing a closure to method_exists()).
  • Fixed bug #52001 (Memory allocation problems after using variable variables).
  • Fixed bug #51723 (Content-length header is limited to 32bit integer with Apache2 on Windows).
  • Fixed bug #48930 (__COMPILER_HALT_OFFSET__ incorrect in PHP >= 5.3).

For users upgrading from PHP 5.2 there is a migration guide available on http://php.net/migration53, detailing the changes between those releases and PHP 5.3.

For a full list of changes in PHP 5.3.3, see the ChangeLog.


The PHP development team would like to announce the immediate availability of PHP 5.2.14. This release focuses on improving the stability of the PHP 5.2.x branch with over 60 bug fixes, some of which are security related.

This release marks the end of the active support for PHP 5.2. Following this release the PHP 5.2 series will receive no further active bug maintenance. Security fixes for PHP 5.2 might be published on a case by cases basis. All users of PHP 5.2 are encouraged to upgrade to PHP 5.3.

Security Enhancements and Fixes in PHP 5.2.14:

  • Rewrote var_export() to use smart_str rather than output buffering, prevents data disclosure if a fatal error occurs.
  • Fixed a possible interruption array leak in strrchr().(CVE-2010-2484)
  • Fixed a possible interruption array leak in strchr(), strstr(), substr(), chunk_split(), strtok(), addcslashes(), str_repeat(), trim().
  • Fixed a possible memory corruption in substr_replace().
  • Fixed SplObjectStorage unserialization problems (CVE-2010-2225).
  • Fixed a possible stack exaustion inside fnmatch().
  • Fixed a NULL pointer dereference when processing invalid XML-RPC requests (Fixes CVE-2010-0397, bug #51288).
  • Fixed handling of session variable serialization on certain prefix characters.
  • Fixed a possible arbitrary memory access inside sqlite extension. Reported by Mateusz Kocielski.

Key enhancements in PHP 5.2.14 include:

  • Upgraded bundled PCRE to version 8.02.
  • Updated timezone database to version 2010.5.
  • Fixed bug #52238 (Crash when an Exception occured in iterator_to_array).
  • Fixed bug #52237 (Crash when passing the reference of the property of a non-object).
  • Fixed bug #52041 (Memory leak when writing on uninitialized variable returned from function).
  • Fixed bug #51822 (Segfault with strange __destruct() for static class variables).
  • Fixed bug #51552 (debug_backtrace() causes segmentation fault and/or memory issues).
  • Fixed bug #49267 (Linking fails for iconv on MacOS: “Undefined symbols: _libiconv”).

To prepare for upgrading to PHP 5.3, now that PHP 5.2’s support ended, a migration guide available on http://php.net/migration53, details the changes between PHP 5.2 and PHP 5.3.

For a full list of changes in PHP 5.2.14 see the ChangeLog at http://www.php.net/ChangeLog-5.php#5.2.14.


PHP is proud to announce TestFest 2010. TestFest is PHP’s annual campaign to increase the overall code coverage of PHP through PHPT tests. During TestFest, PHP User Groups and individuals around the world organize local events where new tests are written and new contributors are introduced to PHP’s testing suite.

Last year was very successful with 887 tests submitted and a code coverage increase of 2.5%. This year we hope to do better.

TestFest’s own SVN repository and reporting tools are back online for this year’s event. New to TestFest this year are automated test environment build tools as well as screencasts showing those build tools in action.

Please visit the TestFest 2010 wiki page for all the details on events being organized in your area, or find out how you can organize your own event.


The PHP development team is proud to announce the immediate release of PHP 5.3.2. This is a maintenance release in the 5.3 series, which includes a large number of bug fixes.

Security Enhancements and Fixes in PHP 5.3.2:

  • Improved LCG entropy. (Rasmus, Samy Kamkar)
  • Fixed safe_mode validation inside tempnam() when the directory path does not end with a /). (Martin Jansen)
  • Fixed a possible open_basedir/safe_mode bypass in the session extension identified by Grzegorz Stachowiak. (Ilia)

Key Bug Fixes in PHP 5.3.2 include:

  • Added support for SHA-256 and SHA-512 to php’s crypt.
  • Added protection for $_SESSION from interrupt corruption and improved “session.save_path” check.
  • Fixed bug #51059 (crypt crashes when invalid salt are given).
  • Fixed bug #50940 Custom content-length set incorrectly in Apache sapis.
  • Fixed bug #50847 (strip_tags() removes all tags greater then 1023 bytes long).
  • Fixed bug #50723 (Bug in garbage collector causes crash).
  • Fixed bug #50661 (DOMDocument::loadXML does not allow UTF-16).
  • Fixed bug #50632 (filter_input() does not return default value if the variable does not exist).
  • Fixed bug #50540 (Crash while running ldap_next_reference test cases).
  • Fixed bug #49851 (http wrapper breaks on 1024 char long headers).
  • Over 60 other bug fixes.

For users upgrading from PHP 5.2 there is a migration guide available here, detailing the changes between those releases and PHP 5.3.

Further information and downloads:

For a full list of changes in PHP 5.3.2, see the ChangeLog. For source downloads please visit our downloads page, Windows binaries can be found on windows.php.net/download/.


The PHP development team would like to announce the immediate availability of PHP 5.2.13. This release focuses on improving the stability of the PHP 5.2.x branch with over 40 bug fixes, some of which are security related. All users of PHP 5.2 are encouraged to upgrade to this release.

Security Enhancements and Fixes in PHP 5.2.13:

  • Fixed safe_mode validation inside tempnam() when the directory path does not end with a /). (Martin Jansen)
  • Fixed a possible open_basedir/safe_mode bypass in session extension identified by Grzegorz Stachowiak. (Ilia)
  • Improved LCG entropy. (Rasmus, Samy Kamkar)

Further details about the PHP 5.2.13 release can be found in the release announcement, and the full list of changes are available in the ChangeLog.

0 

11October2010

definisi algoritma, deklarasi dll

Posted by wanto under: Uncategorized.

Inventors Algorithm Concept

The origins of the word algorithm

The term algorithm, probably not something foreign to us. Friends there who know the meaning of the word ‘algorithm’? Judging from the origin of he said, the word ‘algorithm’ has a rather strange history. People just find a word that means the process of calculating Algorism with Arabic numerals. Someone said ‘Algorist’ If calculating using Arabic numerals. Linguists attempt to discover the origin of this word but the results are less satisfactory. Finally, historians of mathematics found the origin of the word is derived from the name of the author of the famous Arabic book, namely Abu Abdullah Muhammad Ibn Musa Al-Khuwarizmi read people west into Algorism.

Algorithm Definition

The definition of algorithm is “logical steps solving problems systematically and logically arranged.” A simple example is the preparation of a food recipe, which usually are the steps how to cook these dishes. However, the algorithm is generally used to create a flowchart (flowchart) in computer science / informatics.

The inventor of the concept of algorithm and algebra

The inventor is a mathematician from Uzbekistan named Abu Abdullah Muhammad Ibn Musa al-Khwarizmi. In western literature, he is better known as Algorism. Speed is then used to refer to the concept of an algorithm that finds. Abu Abdullah Muhammad Ibn Musa al-Khwarizmi (770-840) was born in Khwarizm (Kheva), city in the south of the river Oxus (now Uzbekistan) in 770 AD. Both his parents later moved to a place south of Baghdad (Iraq), when he was little. Khwarizm known as the man who introduced the concept of algorithms in mathematics, the concept is taken from a last name.

Al khwarizmi also is the inventor of some branch of mathematics known as an astronomer and geographer. He is one of the greatest mathematical scientists who ever lived, and his writings were very influential in its time. Algebra theory is also the invention and ideas of Al khwarizmi. Name algebra is taken from his famous book titled “Al Jabr wa al Muqabilah”. He developed a table that contains details of the trigonometric functions of sine, cosine and kotangen and the concept of differentiation.

His influence in the development of mathematics, astronomy and geography is no doubt in the historical records. The approach he uses a systematic and logical approach. He combines knowledge of Greek Hindu coupled with his very own in developing mathematics. Khwarizm adopted the use of zero, in the science of arithmetic and decimal system. Some of his many translated into Latin in the early 12th century, by two of the leading translators of Bath Adelard and Gerard of Cremona. Aritmetikanya treatises, such as Kitab al-wal-Tafreeq Jam’a Hisab bil al-Hindi, Algebra, Al-Maqala fi Hisab Jabr wa-al-al-Muqabilah, known only from a translation of the Latin language. The books were kept in use until the 16th century as a basic handbook by universities in Europe.

Geography book titled The Book of Surat-al-Ard containing maps of the world has also been translated into English. Fruit Khwarizmi thought in the field of geography is also outstanding. He does not just revise Ptolemy’s views on geography, but also fix some parts. Seventy-one geographers have worked under the leadership of Al khwarizmi when making a map of the world’s first 830 years. He is reported to have also formed a partnership with the Caliph Mamun al-Rashid when running a project to determine the volume and circumference of the earth.

Source: IlmuKomputer.com

The definition of algorithm

Once we know who invented the algorithm and the origin of the word ususl algorithm itself, it is time to identify its own algorithm, good read …., yes

“The algorithm is a sequence of logical steps solving problems systematically and logically arranged.” Logical word is the key word in the algorithm. The steps in the algorithm must be logical and must be determined is false or true.

Introduction

All agreed that the computer is a tool to solve the problem. In order for computers to solve problems then necessary to formulate the first steps in a series of instructions. A set of instructions that are solving a problem called “Program”.

So that the computer can run the program, it must be written in a language that can be understood by computers. Because the computer is a machine then the program should be written in a language specifically designed to communicate with the computer. Computer language used in writing a program called a programming language. One example of a programming language is the language C.

In solving problems with computer assistance, the first step taken is to create a design (design). Design presents ways of thinking programmers in solving problems. This design contains a sequence of steps achieving solutions that are written in descriptive notations. The sequence of systematic steps to solve the problem called ALGORITHM.

________________________________________

Algorithm Definition

ALGORITHM: sequence of logical steps solving problems systematically arranged.

The algorithm according to Big Indonesian Dictionary is the logical sequence of decision-making for solving the problem.

Examples of algorithms in daily life:

Algorithm Process Steps in Algorithm

Cake Making Cake Recipe 3buah take eggs, take the egg yolks and beaten

Making clothes Clothes Pattern Cut fabric according to pattern

Contents Voucher dial 555 HP Guide

________________________________________

Algorithm notation

Notation notation algorithm is not a programming language, so anyone can make a notation algorithm that berbeda.Hal important about it is easy to read notation and notation dimengerti.Meskipun algorithms are not standard notation but compliance with the notation need to be taken to avoid mistakes.

Several notations in the writing of algorithms:

1.Notasi I: declare steps algorithm with a string of descriptive phrases.

With the notation style of descriptive phrases, descriptions of each step can be explained by language gamblang.Misalnya, the process begins with a verb such as’ read ‘,’ count ‘,’ replace ‘and sebagainya.Sedangkan conditional statement expressed by’ if ….’ , ‘Then ….’.

This notation is good for a short algorithm, but for large problems this is not possible dipakai.Selain notation, the conversion of algorithms into a programming language notation tends to be relatively difficult.

2.Notasi II: using the flow chart (flow-chart).

Flowchart popular in the early era of programming with more flow komputer.Diagram describe the flow of instructions in the program visually shows the structure rather than program.Notasi algorithm is also suitable for small problems, not suitable for large problems because it would require pages and pages of paper to describe the flow program process.

3. Notation III: using pseudo-code

Pseudocode (pseudo pseudo or no actual meaning) is a notation that resembles a high-level programming language notation such as language C. The results show that programming languages generally have a notation that is almost similar to some instructions, such as notation if-then-else, while-do, repeat-Until, read, write and so forth. Based on these observations, it is defined that the notation algorithm that can explain his orders with a clear language without confusing the reader can be called with the notation algorithm using pseudo-code. Unlike a programming language that bothered by a semicolon and so on, special words, index, format, and others, then the pseudo-code will be more easier and profitable. The advantages of using pseudo-code notation is ease convert kebahasa programming, because there is a correspondence between each pseudo-code with this program.Korespondensi language notation can be realized with table translation of notation algorithm into a program language notations

________________________________________

Posting Rules Algorithm

The text contains a description of the algorithm steps masalah.Deskripsi settlement can be written notation of any nature, provided easy to read and understand. There is no standard notation in the text entry algorithms. Each person can make writing rules and algorithms sendiri.Namun, for notation algorithm can be easily translated into natural language notation, the notation should correspond with the notation that the algorithm programming languages in general.

Example command: Write the value of x and y

In the notation algorithm becomes: write (x, y)

In Turbo C language was written: printf (“% d% d”, x, y

);________________________________________

Type, Name, and Value

Type

In general, computer programs work by manipulating objects (data) in memory. Objects that will be programmed a variety of types, for instance type numeric, character strings, and records (recordings).

Data types can be grouped into 2, namely: basic types and type formations. Basic type is the type that can be used directly, while the type formations formed from the basic types or from other types of formations that have been defined.

A type referenced from namanya.Nilai-values covered by that type is stated in the realm (domain) value. Operations (and operators) that can be done against these types are also defined. In other words a type indicated by its name, the realm of values they contain, how to write the constants, and operations that can be done to him.

Basic Type

In a programming language which includes basic types are:

1. number of logic

2. integer

3. character or string

4. real numbers

Type formation

This type of formation is a type defined by the programmer (user define). Type formations composed by one or more basic types. There are two types of formations, namely:

1.Tipe foundation that is named with the name of a new type of example: BilanganBulat type: integer

BilanganBulat variable is an integer type is the same as type integer. Suppose we have a variable named X and type BilanganBulat, it means that the variable X is also an integer.

2.Rekaman (records).

Records prepared by one or more field.Tiap fields store data from certain basic types or from other types of formations that have been dideinisikan sebellumnya.Nama record itentukan by the programmer. Because stukturnya yang diusun above fields, the record also inamakan structured type (stuctured type).

Name

Each object is given to the wild have nama.Nama easily identifiable object, referenced, and are distinguished from objects lainya.Di in the algorithm name used as an identifier “something” and the programmer refers to “something” that through his name. Therefore, each name must be unique, there can be no two pieces of the same name.

In the algorithm “something” that is named can be:

1.Variabel

2.Konstanta

3.Tipe formation

4.Nama Function

5.Nama Procedure

An important thing to note is, the name should be interpretive, that reflects the intrinsic value or function dikandungnya.Pemrogram highly recommended to give an explanation of the name that is defined.

All names used in the algorithm should be defined or declared section declaration. The declaration is used as a place of reference to know the meaning of a word or terjemahannya.Tempat to explain the name and type of the name.

Value

The value is the amount of data that already didefinisikan.Nilai type can be either the content stored by variable name or constant name, value from the calculation, or the value sent by fungsi.Algoritma were essentially manipulate the value stored in the memory element. The value contained by the manipulated variables, among others, by the way: fill the other variables of the same type, used for calculations, or written to the output device.

Example algorithm: stirng print “Hello, how are you?” to the output device.

Version 1. String “Hello, how are you?” printed directly without using variables.

Algorithm:

Declaration

(None)

Description

write (“Hello, how are you?”)

2.String version of “Hello, how are you?” stored in a variable of type string.

Algorithm:

Declaration

utterance: a string

Description

<—— saying ‘Hello, how are you? ”

write (greeting)

3.String version of “Hello, how are you?” stored as constants

Algorithm:

Declaration

const greeting = ‘Hello, how are you? ”

Description

write (greeting)

The output generated by the algorithm version 1, 2, and 3 are:

Hello, how are ?________________________________________

SEQUENCE / runs

The algorithm is of runs (sequences) of one or more instructions, which means that:

1. Each instruction is done one by one.

2. Each instruction executed exactly once, no instructions are repeated.

3. Ordering instructions are executed the same processor with a sequence of instructions written on the algorithm.

4. End of instruction is the end of the algorithm.

Ordering instructions in the algorithm shows very penting.Urutan instruction sequence problem solving logic.

________________________________________

Repetition

One of the advantages compared to human computer is its ability to carry out an instruction repeated tirelessly and bosan.Pengulangan procedure or a loop (repetition or loop) can be done ejumlah times or until a condition is reached.

Repetition Structure

Generally consists of 2 parts:

1. Repetition condition, ie boolean expression that must be met to implement this pengulangan.Kondisi exist that explicitly by the programmer or managed by a computer seniri (implicit).

2. Agency repetition, which is part of the algorithm is repeated.

Structural repetition is usually accompanied by parts:

1. Initialization, ie actions done before the loop is the first time.

2. Termination, the actions performed after repetition is completed.

Initialization and termination does not always have to have (optional), but in many cases the initialization is generally required.

Repetition structure in general:

<inisialisasi>

early recurrence

loop body

end loop

<terminasi>

In the algorithm there are several kinds of repetition structure berbeda.Beberapa structure can be used for the same problem, but there is repetition notation is only suitable for certain problems saja.Pemilihan exact repetition structure depends on the matter to be diprogram.Banyak once notation repetition structures, such as:

For 1.Struktur

For the structure used to produce a repetition of n times already dispesifikasikan.Jumlah repetition of known or can be ascertained before the execution program.Bentuk generally there are 2 kinds of

a.Menaik (ascending)

for enumerators to nilai_akhir do <————- nilai_awal

action

endfor

b.Menurun (descending)

for enumerators <————- nilai_akhir do downto nilai_awal

action

endfor

2. While the structure

While the structure is the general form:

while the do

action

endwhile

Action (action of runs) will be carried out repeatedly during konii worth true.Jika condition is false then the loop will selesai.Agar initial conditions is true becomes false then there must be a value-altering conditions.

3. Repeat structure

Repeat structure is the general form:

repeat

action

Until condition

Repetition is based on the conditions inside the body boolean.Aksi loop is repeated until konisi true.Jika boolean value false then the loop will still continue to it necessary or action that changes the value modifier conditions. Repeat structure has the same meaning while, and in some problems these two structures complement each other.

To note is that the repetition must stop. Repetition who never stopped showing the wrong algorithm.

________________________________________

FUNCTION

Does it function?

Function is a program module which provides / return (return) a value of a particular type. Functions accessed by calling his name, the name of the function should contain a list of parameters can unik.Fungsi formal.Parameter on masukan.Jenis function is always a parameter in the function input parameter is an input used by the function is to generate value.

Structure similar to the structure function algorithm

– Header section containing the function name and function specification,

– The declaration

– Body functions

Notation algorithm to define the function are:

NamaFungsi function (input formal parameter list )—–> type results

(Specification of function, explaining what was done and the returned function)

Declaration

(All names used by the wild disini.Nama algorithm defined functions declared in the local declaration is only known and used in this function only)

Description:

(Body functions, contains the instructions to generate the value to be returned by the function)

return result (return value) function generated

Array

What is the array?

Array is a data structure that stores a set of elements of the same type. setpa elements directly accessible via the index.

Defining array

Array is a static data structure, that is, the number of array elements must be known before the program starts. Defines the number of array elements means ordering a number of places in memory.

Example of array declaration:

Declaration

L: array [1 .. 50] of integer

name: array [‘a’ .. ‘j’] of string

“The algorithm is a sequence of logical steps solving problems systematically and logically arranged.”

Logical word is the key word in the algorithm. The steps in the algorithm

must be logical and must be determined is false or true.

The algorithm is the heart of computer science or informatics. Many branches of computer science terminology referenced in the algorithm. However, do not assume the algorithm is always synonymous with computer science course. In real life there are many processes haripun expressed in an algorithm.

Ways to make a cake or a dish that is expressed in a recipe can also be referred to as algorithms. In every recipe there is always a sequence of step-lankah made cuisine. If the steps are not logical, can not produce the desired cuisine. Mothers who try a recipe will be read one by one the steps and then he did the process of making appropriate that he read. S

ecara general, the (object) who worked on the process called the processor (processor). Processing may take the form of human, computer, robot or other electronic alatalat. Processors perform a process to carry out or “execute” an algorithm that outlines the process. Implement the algorithm means doing the steps in the algorithm. Processors working on the process in accordance with the algorithm given to him. The cook makes a cake based on a recipe given to him, the pianist played a song by musical notes board.

Therefore, an algorithm must be expressed in a form that can be understood by the processor.

So the processor must:

1. Understand each step in Algorithm

2. Doing operations corresponding to these steps.

The Processing Algorithm Implementation Mechanism

Computer is just one processor. To be implemented by computer,

hasrus algorithms written in programming language notation so-called program.

So the program is prwujudan or technical implementation of algorithms, written in a particular programming language that can be implemented by computer.

Important feature of the algorithm

• The algorithm must stop after work on a limited number of steps.

• Each step must be defined correctly and not mean-two (ambiguity).

• The algorithm has zero or more entered.

• The algorithm has zero or more output.

• have an effective algorithm (each step should be simple so that it can be done within a reasonable time).

Penemu Konsep Algoritma
Asal-usul kata Algoritma

Istilah algoritma, mungkin bukan sesuatu yang asing bagi kita. Teman-teman ada yang tahu arti kata ‘algoritma’? Ditinjau dari asal-usul katanya, kata ‘Algoritma’ mempunyai sejarah yang agak aneh. Orang hanya menemukan kata Algorism yang berarti proses menghitung dengan angka Arab. Seseorang dikatakan ‘Algorist’ jika menghitung menggunakan angka Arab. Para ahli bahasa berusaha menemukan asal kata ini namun hasilnya kurang memuaskan. Akhirnya para ahli sejarah matematika menemukan asal kata tersebut yang berasal dari nama penulis buku Arab terkenal, yaitu Abu Abdullah Muhammad Ibnu Musa Al-Khuwarizmi dibaca orang barat menjadi Algorism.

Definisi Algoritma

Definisi Algoritma adalah “langkah-langkah logis penyelesaian masalah yang disusun secara sistematis dan logis”. Contoh sederhana adalah penyusunan sebuah resep makanan, yang biasanya terdapat langkah-langkah cara memasak masakan tersebut. Tapi, algoritma umumnya digunakan untuk membuat diagram alur (flowchart) dalam ilmu komputer / informatika.

Penemu konsep Algoritma dan Aljabar

Penemunya adalah seorang ahli matematika dari uzbekistan yang bernama Abu Abdullah Muhammad Ibn Musa al-Khwarizmi. Di literatur barat, beliau lebih terkenal dengan sebutan Algorism. Panggilan inilah yang kemudian dipakai untuk menyebut konsep algoritma yang ditemukannya. Abu Abdullah Muhammad Ibn Musa al-Khwarizmi (770-840) lahir di Khwarizm (Kheva), kota di selatan sungai Oxus (sekarang Uzbekistan) tahun 770 masehi. Kedua orangtuanya kemudian pindah ke sebuah tempat di selatan kota Baghdad (Irak), ketika ia masih kecil. Khwarizm dikenal sebagai orang yang memperkenalkan konsep algoritma dalam matematika, konsep yang diambil dari nama belakangnya.

Al khwarizmi juga adalah penemu dari beberapa cabang ilmu matematika yang dikenal sebagai astronom dan geografer. Ia adalah salah satu ilmuwan matematika terbesar yang pernah hidup, dan tulisan-tulisannya sangat berpengaruh pada jamannya. Teori aljabar juga adalah penemuan dan buah pikiran Al khwarizmi. Nama aljabar diambil dari bukunya yang terkenal dengan judul “Al Jabr Wa Al Muqabilah”. Ia mengembangkan tabel rincian trigonometri yang memuat fungsi sinus, kosinus dan kotangen serta konsep diferensiasi.

Pengaruhnya dalam perkembangan matematika, astronomi dan geografi tidak diragukan lagi dalam catatan sejarah. Pendekatan yang dipakainya menggunakan pendekatan sistematis dan logis. Dia memadukan pengetahuan dari Yunani dengan Hindu ditambah idenya sendiri dalam mengembangkan matematika. Khwarizm mengadopsi penggunaan angka nol, dalam ilmu aritmetik dan sistem desimal. Beberapa bukunya banyak diterjemahkan kedalam bahasa latin pada awal abad ke-12, oleh dua orang penerjemah terkemuka yaitu Adelard Bath dan Gerard Cremona. Risalah-risalah aritmetikanya, seperti Kitab al-Jam’a wal-Tafreeq bil Hisab al-Hindi, Algebra, Al-Maqala fi Hisab-al Jabr wa-al-Muqabilah, hanya dikenal dari translasi berbahasa latin. Buku-buku itu terus dipakai hingga abad ke-16 sebagai buku pegangan dasar oleh universitas-universitas di Eropa.

Buku geografinya berjudul Kitab Surat-al-Ard yang memuat peta-peta dunia pun telah diterjemahkan kedalam bahasa Inggris. Buah pikir Khwarizmi di bidang geografi juga sangat mengagumkan. Dia tidak hanya merevisi pandangan Ptolemeus dalam geografi tapi malah memperbaiki beberapa bagiannya. Tujuh puluh orang geografer pernah bekerja dibawah kepemimpinan Al khwarizmi ketika membuat peta dunia pertama di tahun 830. Ia dikisahkan pernah pula menjalin kerjasama dengan Khalifah Mamun Al-Rashid ketika menjalankan proyek untuk mengetahui volume dan lingkar bumi.

Sumber : IlmuKomputer.com

Definisi algoritma

Setelah kita mengetahui siapa yang menemukan Algoritma dan asal ususl kata algoritma itu sendiri, sekarang saatnya mengetahui definisi Algoritma itu sendiri, selamat membaca ya….,

“Algoritma adalah urutan langkah-langkah logis penyelesaian masalah yang disusun secara sistematis dan logis”. Kata Logis merupakan kata kunci dalam Algoritma. Langkah-langkah dalam Algoritma harus logis dan harus dapat ditentukan bernilai salah atau benar.

Pengantar

Semua sepakat bahwa komputer merupakan alat bantu untuk menyelesaikan masalah. Agar komputer dapat menyelesaikan masalah maka perlu dirumuskan terlebih dahulu langkah-langkah dalam suatu rangkaian instruksi. Sekumpulan instruksi yang merupakan penyelesaian masalah dinamakan “Program”.

Agar komputer dapat menjalankan program, maka harus ditulis dalam bahasa yang dapat dimengerti oleh komputer. Karena komputer adalah sebuah mesin maka program harus ditulis dalam bahasa yang khusus dibuat untuk berkomunikasi dengan komputer. Bahasa komputer yang digunakan dalam menulis program dinamakan bahasa pemrograman. Salah satu contoh bahasa pemrograman adalah Bahasa C.

Dalam menyelesaikan masalah dengan bantuan komputer, langkah pertama yang dilakukan adalah dengan membuat desain (rancangan). Desain menyajikan cara berfikir pemrogram dalam menyelesaikan masalah. Desain ini berisi urutan langkah-langkah pencapaian solusi yang ditulis dalam notasi-notasi deskriptif. Urutan langkah-langkah yang sistematis untuk menyelesaikan masalah dinamakan ALGORITMA.


Definisi Algoritma

ALGORITMA : urutan langkah-langkah logis penyelesaian masalah yang disusun secara sistematis.

Algoritma menurut Kamus Besar Bahasa Indonesia adalah Urutan logis pengambilan keputusan untuk pemecahan masalah .

Contoh Algoritma dalam kehidupan sehari-hari :

Proses Algoritma Langkah dalam Algoritma
Membuat Kue Resep Kue ambil  3buah telur, ambil kuning telur dan kocok
Membuat baju Pola Baju Potong kain sesuai pola
Isi Voucher HP Panduan tekan nomor 555


Notasi Algoritma

Notasi algoritma bukan notasi bahasa pemrograman,sehingga siapapun dapat membuat notasi algoritma yang berbeda.Hal yang penting mengenai notasi tersebut adalah mudah dibaca dan dimengerti.Meskipun notasi algoritma bukan notasi baku namun kepatuhan terhadap notasi perlu diperhatikan untuk menghindari kekeliruan.

Beberapa notasi dalam penulisan algoritma :

1.Notasi  I : menyatakan langkah-langkah algoritma dengan untaian kalimat deskriptif.

Dengan notasi bergaya kalimat deskriptif, deskripsi setiap langkah dapat dijelaskan dengan bahasa yang gamblang.Misalnya, proses diawali dengan kata kerja  seperti ‘baca’, ‘hitung’ , ‘ganti’ dan sebagainya.Sedangkan pernyataan kondisional dinyatakan dengan ‘jika….’ ,  ‘maka….’.

Notasi ini bagus untuk algoritma yang pendek ,namun untuk masalah yang besar notasi ini tidak mungkin dipakai.Selain itu,konversi dari notasi algoritma ke bahasa pemrograman cendrung relatif sukar.

2.Notasi  II: menggunakan diagram alir(flow-chart).

Diagram alir populer pada awal-awal era pemrograman dengan komputer.Diagram alir lebih menggambarkan aliran instruksi didalam program secara visual ketimbang memperlihatkan struktur program.Notasi algoritma ini juga cocok untuk masalah kecil, tidak cocok untuk masalah besar karena akan memerlukan berlembar halaman kertas untuk menggambarkan aliran proses program.

3. Notasi III: menggunakan pseudo-code

Pseudocode (pseudo artinya semu atau tidak sebenarnya) adalah notasi yang menyerupai notasi bahasa pemrograman tingkat tinggi seperti bahasa C.Hasil pengamatan memperlihatkan bahwa bahasa pemrograman umumnya mempunyai notasi yang hampir mirip untuk beberapa instruksi, seperti notasi if-then-else, while-do,repeat-until,read, write  dan sebagainya. Berdasarkan pengamatan tersebut, maka didefinisikan bahwa notasi algoritma yang dapat menjelaskan perintahnya dengan  bahasa yang jelas tanpa membingungkan pembaca bisa disebut dengan notasi algoritma  menggunakan pseudo-code.  Tidak seperti bahasa program yang direpotkan dengan tanda titik koma dan sebagainya, kata-kata khusus,indeks,format, dan lainnya, maka dengan pseudo-code ini akan lebih memudahkan dan menguntungkan. Keuntungan penggunaan notasi pseudo-code ini adalah kemudahan mengkonversinya kebahasa pemrograman, karena terdapat korespondensi antara setiap pseudo-code dengan notasi bahasa program.Korespondensi ini dapat diwujudkan dengan tabel translasi dari notasi algoritma ke notasi bahasa program


Aturan Penulisan Algoritma

Teks algoritma berisi deskripsi langkah-langkah penyelesaian masalah.Deskripsi tersebut dapat ditulis alam bentuk notasi apapun , asalkan mudah dibaca dan dimengerti. Tidak ada notasi yang baku dalam penulisan teks algoritma. Tiap orang dapat membuat aturan penulisan  dan algoritma sendiri.Namun, agar notasi algoritma dapat dengan mudah ditranslasi ke alam notasi bahasa pemrograman, maka sebaiknya notasi algoritma itu berkoresponden dengan notasi bahasa pemrograman secara umum.

Contoh perintah  :Tulis nilai x  dan  y

Dalam notasi algoritma menjadi : write (x,y)

Dalam Bahasa Turbo C ditulis : printf(“%d %d”,x,y);


Tipe, Nama, dan Nilai

Tipe

Pada umumnya program komputer bekerja dengan memanipulasi objek (data) di dalam memori. Objek yang akan diprogram bermacam-macam tipenya, misalnya tipe numerik,karakter,string, dan record(rekaman).

Tipe data  dapat dikelompokan menjadi 2, yaitu: tipe dasar dan tipe bentukan. Tipe dasar  adalah tipe yang langsung dapat dipakai, sedangkan tipe bentukan dibentuk dari tipe dasar atau dari tipe bentukan lain yang sudah didefinisikan.

Suatu tipe diacu dari namanya.Nilai-nilai yang dicakup oleh tipe tersebut dinyatakan didalam ranah (domain)nilai. Operasi-operasi (beserta operator) yang dapat dilakukan terhadap tipe tersebut  juga didefinisikan. Dengan kata lain suatu tipe dinyatakan dengan namanya,ranah nilai yang dikandungnya,cara menuliskan konstantanya, dan operasi yang dapat dilakukan padanya.

Tipe Dasar

Dalam bahasa pemrograman yang termasuk tipe dasar adalah :

1. bilangan logika

2. bilangan bulat

3. karakter atau string

4. bilangan riil

Tipe Bentukan

Tipe bentukan adalah tipe yang didefinisikan sendiri oleh pemrogram (user define). Tipe bentukan disusun oleh satu atau lebih tipe dasar. Ada dua macam tipe bentukan yaitu:

1.Tipe dasar yang diberi nama dengan nama tipe baru                                                                     contoh : tipe

BilanganBulat : integer

Variabel BilanganBulat adalah tipe bilangan bulat yang sama saja dengan tipe integer. Misalkan kita mempunyai sebuah variabel  yang bernama X dan bertipe BilanganBulat, maka artinya variabel X tersebut juga bertipe integer.

2.Rekaman (rekord).

Rekaman disusun oleh satu atau lebih field.Tiap field menyimpan data dari tipe dasar tertentu atau dari tipe bentukan lain yang sudah dideinisikan sebellumnya.Nama record itentukan oleh pemrogram. Karena stukturnya yang diusun atas field-field, maka rekaman inamakan juga tipe terstruktur(stuctured type).

Nama

Setiap objek dialam mempunyai nama.Nama diberikan agar objek tersebut mudah diidentifikasi, diacu, dan dibedakan dari objek lainya.Di dalam algoritma nama dipakai sebagai pengidentifikasi  “sesuatu” dan pemrogram mengacu “sesuatu” itu melalui namanya. Karena itu tiap nama haruslah unik, tidak boleh ada dua buah nama yang sama.

Di dalam algoritma “sesuatu” yang diberi nama dapat berupa :

1.Variabel

2.Konstanta

3.Tipe Bentukan

4.Nama Fungsi

5.Nama Prosedur

Suatu hal yang penting untuk diperhatikan adalah, nama sebaiknya interpretatif, yaitu mencerminkan nilai intrinsik atau fungsi yang dikandungnya.Pemrogram sangat dianjurkan untuk memberikan penjelasan terhadap nama yang didefinisikan.

Semua nama yang digunakan dalam algoritma harus didefinisikan atau dideklarasikan dibagian deklarasi .Bagian deklarasi dipakai sebagai tempat mengacu suatu kata untuk diketahui makna atau terjemahannya.Tempat untuk menjelaskan nama dan tipe dari nama tersebut.

Nilai

Nilai adalah besaran dari tipe data yang sudah didefinisikan.Nilai dapat berupa isi yang disimpan oleh nama variabel atau nama konstanta,nilai dari hasil perhitungan, atau nilai yang dikirim oleh fungsi.Algoritma pada hakikatnya adalah memanipulasi nilai yang disimpan didalam elemen memori. Nilai yang dikandung oleh variabel dimanipulasi antara lain dengan cara : mengisikannya ke variabel lain yang bertipe sama, dipakai untuk perhitungan, atau dituliskan ke piranti keluaran.

Contoh algorima : mencetak stirng “Halo, apa kabar?” ke piranti keluaran.

Versi 1. String “Halo, apa kabar?” langsung dicetak tanpa menggunakan variabel.

Algoritma :

Deklarasi

(tidak ada)

Deskripsi

write (“Halo,apa kabar?”)

Versi 2.String “Halo,apa kabar?” disimpan di dalam sebuah variabel bertipe string.

Algoritma :

Deklarasi

ucapan  :  string

Deskripsi

ucapan  <—— ‘Halo,apa kabar?’

write (ucapan)

Versi 3.String “Halo,apa kabar?” disimpan sebagai konstanta

Algoritma:

Deklarasi

const ucapan  = ‘Halo,apa kabar?’

Deskripsi

write (ucapan)

Keluaran yang dihasilkan oleh algoritma versi 1, 2, dan 3 adalah :

Halo, apa kabar?


URUTAN / RUNTUNAN

Algoritma merupakan runtunan(sequence) satu atau lebih instruksi,yang berarti bahwa :

1. Tiap instruksi dikerjakan satu persatu.

2. Tiap instruksi dilaksanakan tepat sekali, tidak ada instruksi yang diulang.

3. Urutan instruksi  yang dilaksanakan pemroses sama dengan urutan instruksi yang tertulis di algoritma.

4. Akhir instruksi merupakan akhir dari algoritma.

Urutan instruksi didalam algoritma sangat penting.Urutan instruksi menunjukan urutan logika penyelesaian masalah.


PENGULANGAN

Salah satu kelebihan komputer dibandingkan manusia adalah kemampuannya untuk melaksanakan suatu instruksi berulangkali tanpa mengenal lelah dan bosan.Pengulangan prose atau kalang(repetition atau loop) dapat dilakukan ejumlah kali atau sampai suatu kondisi tercapai.

Struktur Pengulangan

Secara umum terdiri atas 2 bagian:

1. Kondisi pengulangan, yaitu ekspresi boolean yang harus dipenuhi untuk melaksanakan pengulangan.Kondisi ini ada yang secara eksplisit oleh pemrogram atau dikelola seniri oleh komputer (implisit).

2. Badan pengulangan, yaitu bagian algoritma yang diulang.

Struktur pengulangan biasanya disertai dengan bagian:

1. Inisialisasi, yaitu aksi yang dilakukan sebelum pengulangan dilakukan pertama kali.

2. Terminasi, yaitu aksi yang dilakukan setelah pengulangan selesai dilaksanakan.

Inisialisasi dan terminasi tidak selalu harus ada(optional), namun pada berbagai kasus inisialisasi umumnya  diperlukan.

Struktur pengulangan secara umum :

<inisialisasi>

awal pengulangan

badan pengulangan

akhir pengulangan

<terminasi>

Di dalam algoritma terdapat beberapa macam struktur pengulangan yang berbeda.Beberapa struktur dapat dipakai untuk masalah yang sama,namun ada notasi pengulangan yang hanya cocok untuk masalah tertentu saja.Pemilihan struktur pengulangan yang tepat bergantung pada masalah yang akan diprogram.Banyak sekali notasi struktur pengulangan, seperti :

1.Struktur For

Struktur For  dipakai untuk menghasilkan pengulangan sebanyak n kali yang sudah dispesifikasikan.Jumlah pengulangan diketahui atau dapat dipastikan sebelum eksekusi program.Bentuk umumnya ada 2 macam

a.Menaik (ascending)

for pencacah <————- nilai_awal to nilai_akhir do

aksi

endfor

b.Menurun(descending)

for pencacah <————-nilai_akhir downto nilai_awal  do

aksi

endfor

2. Struktur While

Bentuk umum struktur While adalah :

while kondisi do

aksi

endwhile

Aksi (runtunan aksi) akan dilaksanakan berulangkali selama konii bernilai true.Jika kondisi bernilai false maka pengulangan akan selesai.Agar kondisi yang mula-mula bernilai true menjadi bernilai false maka harus ada suatu nilai pengubah kondisi.

3. Struktur Repeat

Bentuk umum struktur Repeat adalah :

repeat

aksi

until kondisi

Pengulangan ini mendasarkan pada kondisi boolean.Aksi didalam badan kalang diulang sampai konisi boolean bernilai true.Jika masih false maka pengulangan akan terus berlangsung untuk itu diperlukan atau aksi yang mengubah nilai pengubah kondisi. Struktur repeat memiliki makna yang sama dengan while, dan dalam beberapa masalah kedua struktur tersebut komplemen satu sama lain.

Yang harus diperhatikan adalah bahwa pengulangan harus berhenti. Pengulangan yang tidak pernah berhenti menunjukan algoritma yang salah.


FUNGSI

Apakah fungsi itu?

Fungsi adalah modul program yang memberikan/mengembalikan (return) sebuah nilai dari tipe tertentu. Fungsi diakses dengan memanggil namanya, nama fungsi harus unik.Fungsi dapat mengandung daftar parameter formal.Parameter pada fungsi selalu merupakan parameter masukan.Jenis parameter masukan pada fungsi merupakan masukan yang digunakan oleh fungsi tersebut untuk menghasilkan  nilai.

Struktur fungsi sama dengan struktur algoritma

– bagian header yang berisi nama fungsi dan spesifikasi fungsi,

– bagian  deklarasi

– badan fungsi

Notasi algoritma untuk mendefinisikan fungsi adalah:

function NamaFungsi(input daftar parameter formal)—–> tipe hasil

{ spesifikasi fungsi, menjelaskan apa yang dilakukan dan yang dikembalikan fungsi  }

Deklarasi

{ semua nama yang dipakai dialam algoritma fungsi dideklarasikan disini.Nama yang  didefinisikan di dalam deklarasi lokal hanya dikenal dan dipakai di dalam fungsi ini saja }

Deskripsi:

{ badan fungsi, berisi instruksi-instruksi untuk menghasilkan nilai yang akan dikembalikan oleh fungsi }

return hasil ( pengembalian nilai yang dihasilkan fungsi }

LARIK

Apakah Larik?

Larik adalah struktur data yang menyimpan sekumpulan elemen yang bertipe sama. setpa elemen diakses langsung melalui indeksnya.

Mendefinisikan Larik

Larik adalah struktur data yang statik, artinya, jumlah elemen larik harus sudah diketahui sebelum program dijalankan. Mendefinisikan banyaknya elemen larik berarti memesan sejumlah tempat di memori.

Contoh deklarasi larik:

Deklarasi

L       : array[1..50] of integer

nama    : array[‘a’..’j’] of string

“Algoritma adalah urutan langkah-langkah logis penyelesaian masalah yang disusun secara sistematis dan logis”.

Kata Logis merupakan kata kunci dalam Algoritma. Langkah-langkah dalam Algoritma
harus logis dan harus dapat ditentukan bernilai salah atau benar.

Algoritma adalah jantung ilmu komputer atau informatika. Banyak cabang ilmu computer yang diacu dalam terminologi algoritma. Namun, jangan beranggapan algoritma selalu identik dengan ilmu komputer saja. Dalam kehidupan sehari-haripun banyak terdapat proses yang dinyatakan dalam suatu algoritma.

Cara-cara membuat kue atau masakan yang dinyatakan dalam suatu resep juga dapat disebut sebagai algoritma. Pada setiap resep selalu ada urutan langkah-lankah membuat masakan. Bila langkah-langkahnya tidak logis, tidak dapat dihasilkan masakan yang diinginkan. Ibu-ibu yang mencoba suatu resep masakan akan membaca satu per satu langkah-langkah pembuatannya lalu ia mengerjakan proses sesuai yang ia baca. S

ecara umum, pihak (benda) yang mengerjakan proses disebut pemroses (processor). Pemroses tersebut dapat berupa manusia, komputer, robot atau alatalat elektronik lainnya. Pemroses melakukan suatu proses dengan melaksanakan atau “mengeksekusi” algoritma yang menjabarkan proses tersebut. Melaksanakan Algoritma berarti mengerjakan langkah-langkah di dalam Algoritma tersebut. Pemroses mengerjakan proses sesuai dengan algoritma yang diberikan kepadanya. Juru masak membuat kue berdasarkan resep yang diberikan kepadanya, pianis memainkan lagu berdasarkan papan not balok.

Karena itu suatu Algoritma harus dinyatakan dalam bentuk yang dapat dimengerti oleh pemroses.

Jadi suatu pemroses harus :
1. Mengerti setiap langkah dalam Algoritma
2. Mengerjakan operasi yang bersesuaian dengan langkah tersebut.
Mekanisme Pelaksanan Algoritma Oleh Pemroses

Komputer hanyalah salah satu pemroses. Agar dapat dilaksanakan oleh komputer,
algoritma hasrus ditulis dalam notasi bahasa pemrograman sehingga dinamakan program.

Jadi program adalah prwujudan atau implementasi teknis Algoritma yang ditulis dalam bahasa pemrogaman tertentu sehingga dapat dilaksanakan oleh komputer.

Ciri penting algoritma
• Algoritma harus berhenti setelah mengerjakan sejumlah langkah terbatas.
• Setiap langkah harus didefinisikan dengan tepat dan tidak berarti-dua (Ambiguitas).
• Algoritma memiliki nol atau lebih masukkan.
• Algoritma memiliki nol atau lebih keluaran.
• algoritma harus efektif (setiap langkah harus sederhana sehingga dapat dikerjakan dalam waktu yang masuk akal).

0 

11October2010

MACAM-MACAM BAHASA PEMROGRAMAN

Posted by wanto under: Uncategorized.

MACAM-macam BAHASA PEMROGRAMAN

Bagi anda yang bekerja dalam bidang web design pasti sudah tidak asing lagi dengan apa yang nama bahasa pemrograman.Bahasa pemrograman yang umum dikenal adalah php dan html.Tapi sebenarnya masih banyak bahasa pemrograman yang lain.

Berikut ini ada beberapa macam bahasa pemrograman yang perlu anda ketahui

1. Bahasa Pemrograman HTML
HyperText Markup Language (HTML) adalah sebuah bahasa markup yang digunakan untuk membuat sebuah halaman web dan menampilkan berbagai informasi di dalam sebuah browser Internet.
HTML saat ini merupakan standar Internet yang didefinisikan dan dikendalikan penggunaannya oleh World Wide Web Consortium (W3C).
HTML berupa kode-kode tag yang menginstruksikan browser untuk menghasilkan tampilan sesuai dengan yang diinginkan.
Sebuah file yang merupakan file HTML dapat dibuka dengan menggunakan browser web seperti Mozilla Firefox atau Microsoft Internet Explorer.

2. Bahasa Pemrograman PHP
PHP adalah bahasa pemrograman script yang paling banyak dipakai saat ini.
PHP pertama kali dibuat oleh Rasmus Lerdorf pada tahun 1995. Pada waktu itu PHP masih bernama FI (Form Interpreted), yang wujudnya berupa sekumpulan script yang digunakan untuk mengolah data form dari web.
PHP banyak dipakai untuk membuat situs web yang dinamis, walaupun tidak tertutup kemungkinan digunakan untuk pemakaian lain.
PHP biasanya berjalan pada sistem operasi linux (PHP juga bisa dijalankan dengan hosting windows).

3. Bahasa Pemrograman ASP
ASP adalah singkatan dari Active Server Pages yang merupakan salah satu bahasa pemograman web untuk menciptakan halaman web yang dinamis.
ASP merupakan salah satu produk teknologi yang disediakan oleh Microsoft.
ASP bekerja pada web server dan merupakan server side scripting.

4. Bahasa Pemrograman XML
Extensible Markup Language (XML) adalah bahasa markup serbaguna yang direkomendasikan W3C untuk mendeskripsikan berbagai macam data.
XML menggunakan markup tags seperti halnya HTML namun penggunaannya tidak terbatas pada tampilan halaman web saja.
XML merupakan suatu metode dalam membuat penanda/markup pada sebuah dokumen.

5. Bahasa Pemrograman WML
WML adalah kepanjangan dari Wireless Markup Language, yaitu bahasa pemrograman yang digunakan dalam aplikasi berbasis XML (eXtensible Markup Langauge).
WML ini adalah bahasa pemrograman yang digunakan dalam aplikasi wireless.
WML merupakan analogi dari HTML yang berjalan pada protocol nirkabel.

6. Bahasa Pemrograman PERL
Perl adalah bahasa pemrograman untuk mesin dengan sistem operasi Unix (SunOS, Linux, BSD, HP-UX), juga tersedia untuk sistem operasi seperti DOS, Windows, PowerPC, BeOS, VMS, EBCDIC, dan PocketPC.
PERL merupakan bahasa pemograman yang mirip bahasa pemograman C.

7. Bahasa Pemrograman CFM
Cfm dibuat menggunakan tag ColdFusion dengan software Adobe ColdFusion / BlueDragon / Coldfusion Studio.
Syntax coldfusion berbasis html.

8. Bahasa Pemrograman Javascript
Javascript adalah bahasa scripting yang handal yang berjalan pada sisi client.
JavaScript merupakan sebuah bahasa scripting yang dikembangkan oleh Netscape.
Untuk menjalankan script yang ditulis dengan JavaScript kita membutuhkan JavaScript-enabled browser yaitu browser yang mampu menjalankan JavaScript.

9. Bahasa Pemrograman CSS
Cascading Style Sheets (CSS) adalah suatu bahasa stylesheet yang digunakan untuk mengatur tampilan suatu dokumen yang ditulis dalam bahasa markup.
Penggunaan yang paling umum dari CSS adalah untuk memformat halaman web yang ditulis dengan HTML dan XHTML.
Walaupun demikian, bahasanya sendiri dapat dipergunakan untuk semua jenis dokumen XML termasuk SVG dan XUL.
Spesifikasi CSS diatur oleh World Wide Web Consortium (W3C)

Untuk mendesain sebuah web kita tidak melakukan hal tersebut begitu saja tanpa suatu yang membuatnya ada. Dalam membuat web memerlukan suatu kode-kode yang dapat membuat web menjadi lebih menarik untuk dilihat. Kode-kode itu dapat berupa kode HTML, Java Script, CSS, Java Applet, dan ActiveX Control.

HTML

HTML adalah suatu bahasa pemrograman yang sering digunakan untuk desain web. Biasanya memiliki format penyimpanan yaitu .html, .htm, atau .shtml. Pada kode HTML sering digunakan cara membuka dan menutup tag. Kerangka dasar dokumen HTML adalah sebagai berikut :
<HTML>
<HEAD><TITLE>Title</TITLE>
</HEAD>
<BODY>
Deskripsi
</BODY>
</HTML>

Java script

Java script adalah suatu bahasa pemrograman yang ada di dalam HTML. Fungsinya adalah untuk menambah kemampuan dokumen HTML. Java script diproses pada sisi klien, contoh program Java script adalah sebagai berikut
<script language=”JavaScript”>
<!–
document.write(”ASEP HERMAN SUYANTO<br>”);
document.write(”penulis buku”);
//–>
</script>

CSS

CSS juga digunakan untuk menambah kemampuan documen html agar tampil lebih menarik. CSS sering digunakan untuk membuat style tulisan dan layout agar tampaklebih menarik, CSS ini dapat digunakan secara berulang-ulang sehingga tidak perlu dibuat berkali-kali. Kerangka dasar CSS adalah sebagai berikut
<style type=”text/css”>
<!–
nama_tag (properti_1:nilai_1; … ;
properti_n:nilai_
–>
</style>

Java Applet

Java Applet adalah suatu program kecil dalam bahasa java yang dapat diambil seperti kita mengimport gambar. Applet memiliki suatu kemampuan yang lebih yaitu dapat bereaksi terhadap sebuah masukan dari pemakai dan berubah secara dinamis. Contoh Java Applet adalah sebagai berikut
import java.applet.*;
import java.awt.*;
Public class helloworld extends Applet{
Public void paint(Graphics g) {
g.drawString(”ASEP HERMAN SUYANTO” , 50, 25);
}
}

Penulisan pada document html :
<applet code=”helloworld.class”> …. </applet>

0 

29January2010

GURU

Posted by wanto under: Uncategorized.

Guru merupakan seseorang yang memiliki peranan penting bagi kehidupan di muka bumi ini. Tanpa seorang guru mustahil kita bisa mengetahui sesuatu. Guru adalah pelita dalam kegelapan, laksana setetes air yang mampu menghilangkan kehausan. Guru adalah patriot pahlawan bangsa tanpa tanda jasa.
Namun mengapa sekarang ini banyak guru yang tidak mampu menjadi guru yang sebenarnya. Banyak diantara mereka yang memandang dan menganggap guru hanya sebagai “profesi” saja. Bahkan tidak sedikit yang ingin menjadi guru hanya untuk tujuan komersial. Mereka tidak tahu tugas dari seorang guru yang sebenarnya. Mereka lupa bahwa guru memiliki tugas yang sangat berat dan mulia. Secara tidak langsung mereka yang memiliki pandangan seperti itu telah menodai citra seorang guru sebagai seseorang yang berjasa dan memiliki tugas mulia. Lantas bagaimana menumbuhkan kesadaran tersebut pada calon-calon guru sekarang ini???.

0 

My Calendar

December 2014
M T W T F S S
« Nov    
1234567
891011121314
15161718192021
22232425262728
293031  

Archives

Komentar dari Anda