Bahasa-bahasa Pemrograman (Lanjutan) Pertemuan 26

advertisement
Matakuliah
Tahun
Versi
: T0604-Pengantar Teknologi Informasi
: 2008
: 2.0/0.0
Pertemuan 26
Bahasa-bahasa Pemrograman
(Lanjutan)
Sumber:
Chapter 10. System Analysis &
Programming: S/W Development,
Programming, & Languages, p.497
Williams, B.K, Stacy C. Sawyer (2007).
Using Information Technology: A
Practical Introduction to Computers &
Communications. Seventh Edition,
McGraw-Hill, New York. ISBN-13: 978-007-110768-6
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• menjelaskan cara kerja pemrograman
berorientasi obyek dan pemrograman
visual, serta apa yg dikerjakan bahasa
markup dan bahasa scripting (C2)
2
Outline Materi
• Object-Oriented & Visual Programming
• Markup & Scripting Languages
3
Object-Oriented & Visual
Programming
• In Object oriented Programming (OOP) data and
processing instructions are combined into an
object that can be reused
– Object
• Self-contained module consisting of reusable code
– Message
• The instruction received by the object indicating it is time to
perform an action
– Method
• The processing instructions within the object to perform the
specified action
10-4
Object-Oriented & Visual
Programming
• Black Box
– Objects are like a black box in that the
actions and the objects are specified, but
the methods used are internal to the object
– This means the programmer that uses an object does not
need to know how the program inside the object does what it
does
– For example, Microsoft Excel is like an object
• Most of us use Excel without understanding what the programmers
at Microsoft did to make Excel work
• If we had to know that, it would take a lot longer to learn how to use
Excel!
• Programmers who use objects can write programs a lot faster,
because objects save so much work
10-5
Object-Oriented & Visual
Programming
• 3 basic concepts of OOP
– Encapsulation
• One object contains (encapsulates) both
– Data
– Relevant processing instructions
– Inheritance
• One object can be used as the foundation for other objects
• Objects can be arranged in hierarchies – classes and
subclasses
• Objects can inherit actions and attributes from each other
– Polymorphism
• Allows a single definition to be used with different data types
and different functions
• Means a message produces different results depending on
the object it is sent to
10-6
Object-Oriented & Visual
Programming
Example of
Inheritance
Hierarchy with
Specialization
Actions
performed by
a door
Patio doors
Have a slider
slide open
slide closed
Notice we only list the
actions & attributes when
they differ from those of
class
Doors
Have a Handle
open
close
Front doors
Have locks
10-7
The “Door”
class
Subclasses of
doors inherit
from the door
class, but also
have their own
unique actions
and attributes
Car doors
Have locks
Have windows
Object-Oriented & Visual
Programming
• Visual Basic is an example of visual
programming
– Using a mouse, the programmer drags and drops
objects on screen
– The objects are arranged to make up the graphical
user interface for the program being written
– By double-clicking on those objects, the programmer
can get into a coding window and write the programs
to control the actions and behaviors of those objects
– This makes it fast and easy to build prototype user
interfaces and get end-user approval before doing a
lot of programming
If you have Visual Basic installed on your school’s computers, this would be a
great time to try it out.
10-8
Markup & Scripting
Languages
• A markup language is a kind of coding or “tags”
inserted into text that embeds details about the
structure and appearance of the text.
• Open up a text editor such as Notepad or
Wordpad, and enter the following text:
<body bgcolor = "yellow">
<h2> <p>My name is </h2>
<b><i><font color=“red”>your name</font></i></b></p>
And I <b><h1>love</h1></b> this class!!!
</body>
• Then save the file on your desktop. Name it sample.htm
• Now open your internet browser and view it by clicking “file open”
and navigating to your desktop
10-9
Markup & Scripting Languages
• So how did this
• Turn into this?
My name is
your name
And I
love
this class!!!
<body bgcolor = "yellow">
<h2> <p>My name is </h2>
<b><i><font color=“red”>your name</font></i></b></p>
And I <b><h1>love</h1></b> this class!!! </body>
The <body bgcolor = “”> tag defines the page color
The <h2> tag means a heading of size 2
The <h1> tag means a heading of size 1
The <i> tag means to italicize the text
The <b> tag means to bold the text
The <p> tag means to start a new paragraph
• By HTML
tags
And the / inside a tag means to end that format
There are a LOT of other HTML tags
10-10
Markup & Scripting Languages
• HTML
– Hypertext markup language
– Used to create web pages
– Also lets you insert a hypertext link in a web page
• VRML
– Virtual Reality Modeling for Markup Language is used
to create three-dimensional web pages including
interactive animation
– Requires special VRML browser to view those pages
10-11
Markup & Scripting Languages
• XML
– eXtensible Markup Language is a metalanguage
written in SGML that allows one to facilitate easy
document interchange on the internet
– XML lets you create your own tags
– XML statements define data content
• JavaScript
– Not the same language as Java
– An object-oriented scripting language that adds
interactive functions to web pages
10-12
Markup & Scripting
Languages
• ActiveX
– Developed by Microsoft as an alternative to
Java for creating interactivity on web pages
– A set of controls or components that enable
programs or content of almost any type to be
embedded in a web page
– Often used by crackers to propagate viruses
and/or trojans
– Before you allow an ActiveX component to
download from your browser to your PC,
make sure you trust that website!
10-13
Markup & Scripting
Languages
• Perl
– A general-purpose programming language
developed for text manipulation.
– Developed in 1987 by Larry Wall
– Now used for web development, network
programming, system administration, GUI
development, other tasks
– Widely used for web server programs to
perform automatic tasks such as updating
user accounts and newsgroup postings
10-14
Kesimpulan
15
Download