Você está na página 1de 23

Practical Marks: 50 Time : 3hrs.

COMPUTER APPLICATIONS IN MANAGEMENT PAPER CODE: MBA-106 COURSE OBJECTIVE: Through this course it is intended to familiarize the students with the computer hardware and software Applications for data/file management and exchange through net Unit-I Computer Organization: Introduction, components, classification, capabilities characteristics & Limitations. Operating System; Storage devices: Application of Computer in Business, Computer Languages. Unit-II Use of MS-Office: Basics of MS-Word. MS-Excel and MS-Power Point; Applications in documentation preparation and making reports; preparation of questionnaires, presentations, tables and graphs. Unit-III Internet : Internetworking, Concepts, Internet Protocol Addresses, WWW Pages & Browsing, Security, Internet Applications, Analog & Digital Signals, Bandwidth, Network Topology, Packet Transmission, Long Distance communication, Network Applications. E-mail. Unit-IV Introduction to database: Concept, Characteristics, Objectives, Advantage & limitations, entity, attribute, schema, subschema. Lab : Operating Systems Commands, Internet Surfing, MS Office, MS Word, MS Excel, MS Power point, Tally (latest version) Suggested Readings: 1. Leon & Leon, Introduction to Computers, Vikas Publishing House, New Delhi. 2. June Jamrich Parsons, Computer Concepts 7th Edition, Thomson Learning, Bombay. 3. Comer 4e, Computer networks and Internet, Pearson Education 4. White, Data Communications & Computer Network , Thomson Learning, Bombay. Note: Instruction for External Examiner: The examiner will set 8 questions (2 questions from each unit). The students will be required to attempt any five questions (selecting at least one question from each unit). All questions will carry equal marks.

Computer:

Technically, a computer is a programmable machine. That takes Input through Input devices operates, and manipulate the data and give the desired output through output devices. This means it can execute a programmed list of instructions and respond to new instructions that it is given. Today, however, the term is most often used to refer to the desktop and laptop computers that most people use. When referring to a desktop model, the term "computer.

A programmable machine. The two principal characteristics of a computer are: It responds to a specific set of instructions in a well-defined manner.

It can execute a prerecorded list of instructions (a program).

Modern computers are electronic and digital. The actual machinery -- wires, transistors, and circuits -- is called hardware; the instructions and data are called software. All general-purpose computers require the following hardware components: memory : Enables a computer to store, at least temporarily, data and programs. mass storage device : Allows a computer to permanently retain large amounts of data. Common mass storage devices include disk drives and tape drives. input device : Usually a keyboard and mouse, the input device is the conduit through which data and instructions enter a computer. output device : A display screen, printer, or other device that lets you see what the computer has accomplished. central processing unit (CPU): The heart of the computer, this is the component that actually executes instructions.

In addition to these components, many others make it possible for the basic components to work together efficiently. For example, every computer requires a bus that transmits data from one part of the computer to another. Computers can be generally classified by size and power as follows, though there is considerable overlap: personal computer : A small, single-user computer based on a microprocessor. In addition to the microprocessor, a personal computer has a keyboard for entering data, a monitor for displaying information, and a storage device for saving data. workstation : A powerful, single-user computer. A workstation is like a personal computer, but it has a more powerful microprocessor and a higher-quality monitor. minicomputer : A multi-user computer capable of supporting from 10 to hundreds of users simultaneously. mainframe : A powerful multi-user computer capable of supporting many hundreds or thousands of users simultaneously. supercomputer : An extremely fast computer that can perform hundreds of millions of instructions per second.

Introduction to Computer Organization: Computer Architecture To understand digital signal processing systems, we must understand a little about how computers compute. The modern definition of a computer is an electronic device that performs calculations on data, presenting the results to humans or other computers in a variety of (hopefully useful) ways. Organization of a Simple Computer

Figure 1: Generic computer hardware organization. The generic computer contains input devices (keyboard, mouse, A/D (analog-to-digital) converter, etc.), a computational unit, and output devices (monitors, printers, D/A converters). The computational unit is the computer's heart, and usually consists of a central processing unit (CPU), a memory, and an input/output (I/O) interface. What I/O devices might be present on a given computer vary greatly. A simple computer operates fundamentally in discrete time. Computers are clocked devices, in which computational steps occur periodically according to ticks of a clock. This description belies clock speed: When you say "I have a 1 GHz computer," you mean that your computer takes 1 nanosecond to perform each step. That is incredibly fast! A "step" does not, unfortunately, necessarily mean a computation like an addition;

Related Topics

Computer Components System Components

What Are the Four Components of Computer Processing?


CPU
Computer scientists typically call the CPU the "brain" of the computer because this is where programs are executed. A program is a set of instructions that tells the computer how to accomplish a specific task, such as sending a file to the printer, opening a browser window, or playing music or video.
o

The CPU is further broken up into three smaller components: the arithmetic unit handles all the simple mathematical computations; the control units interpret the instructions in a computer program; and the instruction decoding unit converts computer programming instructions into machine code. Machine code is the basic language understood by all the components in a computer.

Memory
Once the CPU converts a specific set of computer program instructions into machine code, it stores that machine code in primary storage or memory. The machine code will be treated as either data or instructions. The CPU fetches data and instructions from memory, uses an instruction to manipulate the data, and then sends the result and the next set of instructions back to memory.
o

Input Units
Input units are all the devices you use to feed information to the computer, such as a keyboard, a hard drive or a networking card. These devices, in essence, bring data from the "outside world" into your computer, in much the same way that your eyes and ears bring information to your brain. Each input device has its own hardware controller that connects to the CPU and primary memory, and it has a set of instructions that tells the CPU how to use it.
o

Output Units
Output units are the devices your computer uses to relay information to the user, such as a printer, monitors and speakers. For example, everything you see on your computer monitor starts as machine code in memory. The CPU takes that
o

machine code and converts it into a format required by your monitor's hardware. Your monitor's hardware then converts that information into different light intensities so that you see words or pictures.

2.3 BASIC COMPUTER OPERATIONS A computer as shown in Fig. 2.1 performs basically five major operations or functions irrespective of their size and make. These are 1) it accepts data or instructions by way of input, 2) it stores data, 3) it can process data as required by the user, 4) it gives results in the form of output, and 5) it controls all operations inside a computer. We discuss below each of these operations. 1. Input: This is the process of entering data and programs in to the computer system. You should know that computer is an electronic machine like any other machine which takes as inputs raw data and performs some processing giving out processed data. Therefore, the input unit takes data from us to the computer in an organized manner for processing.

Fig. 2.1 Basic computer Operations 2. Storage: The process of saving data and instructions permanently is known as storage. Data has to be fed into the system before the actual processing starts. It is because the processing speed of Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same speed. Therefore the data is first stored in the storage unit for faster access and processing. This storage unit or the primary storage of the computer system is designed to do the above functionality. It provides space for storing data and instructions. The storage unit performs the following major functions:

All data and instructions are stored here before and after processing. Intermediate results of processing are also stored here.

3. Processing: The task of performing operations like arithmetic and logical operations is called processing. The Central Processing Unit (CPU) takes data and instructions from the storage unit and makes all sorts of calculations based on the instructions given and the type of data provided. It is then sent back to the storage unit. 4. Output: This is the process of producing results from the data for getting useful information. Similarly the output produced by the computer after processing must also be kept somewhere inside the computer before being given to you in human readable form. Again the output is also stored inside the computer for further processing. 5. Control: The manner how instructions are executed and the above operations are performed. Controlling of all operations like input, processing and output are performed by control unit. It takes care of step by step processing of all operations in side the computer. 2.4 FUNCTIONAL UNITS In order to carry out the operations mentioned in the previous section the computer allocates the task between its various functional units. The computer system is divided into three separate units for its operation. They are 1) arithmetic logical unit, 2) control unit, and 3) central processing unit. 2.4.1 Arithmetic Logical Unit (ALU) After you enter data through the input device it is stored in the primary storage unit. The actual processing of the data and instruction are performed by Arithmetic Logical Unit. The major operations performed by the ALU are addition, subtraction, multiplication, division, logic and comparison. Data is transferred to ALU from storage unit when required. After processing the output is returned back to storage unit for further processing or getting stored. 2.4.2 Control Unit (CU) The next component of computer is the Control Unit, which acts like the supervisor seeing that things are done in proper fashion. The control unit determines the sequence in which computer programs and instructions are executed. Things like processing of programs stored in the main memory, interpretation of the instructions and issuing of signals for other units of the computer to execute them. It also acts as a switch board operator when several users access the computer simultaneously. Thereby it coordinates the activities of computers peripheral equipment as they perform the input and output. Therefore it is the manager of all operations mentioned in the previous section. 2.4.3 Central Processing Unit (CPU)

The ALU and the CU of a computer system are jointly known as the central processing unit. You may call CPU as the brain of any computer system. It is just like brain that takes all major decisions, makes all sorts of calculations and directs different parts of the computer functions by activating and controlling the operations.

HARDWARE SOFTWARE Fig. 2.2: Computer Architecture Personal Computer Configuration Now let us identify the physical components that make the computer work. These are 1. Central Processing Unit (CPU) 2. Computer Memory (RAM and ROM) 3. Data bus 4. Ports 5. Motherboard 6. Hard disk 7. Output Devices 8. Input Devices All these components are inter-connected for the personal computer to work.

LESSON 2 COMPUTER ORGANISATION 2.1 INTRODUCTION In the previous lesson we discussed about the evolution of computer. In this lesson we will provide you with an overview of the basic design of a computer. You will know how different parts of a computer are organized and how various operations are performed between different parts to do a specific task. As you know from the previous lesson the internal architecture of computer may differ from system to system, but the basic organization remains the same for all computer systems. 2.2 OBJECTIVES At the end of the lesson you will be able to:

understand basic organization of computer system understand the meaning of Arithmetic Logical Unit, Control Unit and Central Processing Unit differentiate between bit , byte and a word define computer memory differentiate between primary memory and secondary memory differentiate between primary storage and secondary storage units

Differentiate between input devices and output devices

Operating System: An operating system is software, consisting of programs and data, that runs on computers, manages computer hardware resources, and provides common services for execution of various application software. The operating system is the most important type of system software in a computer system. Without an operating system, a user cannot run an application program on their computer, unless the application program is self booting. An operating system is a program designed to run other programs on a computer. A computers operating system is its most important program. It is considered the backbone of a computer, managing both software and hardware resources. Operating systems are responsible for everything from the control and allocation of memory to

recognizing input from external devices and transmitting output to computer displays. They also manage files on computer hard drives and control peripherals, like printers and scanners. The operating system of a large computer system has even more work to do. Such operating systems monitor different programs and users, making sure everything runs smoothly, without interference, despite the fact that numerous devices and programs are used simultaneously. An operating system also has a vital role to play in security. Its job includes preventing unauthorized users from accessing the computer system. There are multiuser, multiprocessing, multitasking, multithreading, and real-time operating systems. A multiuser operating system enables multiple users to run programs simultaneously. This type of operating system may be used for just a few people or hundreds of them. In fact, there are some operating systems that are used to allow thousands of people to run programs at the same time Computer Storage Devices storage device is necessary for recording data. One of the most important tasks performed by computers is storing data. Different types of devices are used to store data. The data stored is stores in digital forms. There are three types of data storage, namely primary data storage, secondary storage devices and tertiary storage devices. The classification of computer storage devices is made based on the task performed by the device. The primary storage device is commonly called random access memory, while the secondary storage device is the hard disk. The tertiary storage devices are removable mass storage devices. While the amount of data stored on the primary is less and is volatile in nature, while the secondary storage device have better storage space and also is non volatile in nature. Lets see the data storage types.

Primary Computer Storage Devices The primary storage devices for computers are actually a part of the computer's memory. We have previously used the terms like RAM and ROM, but may not have know what they are exactly. They are the Random Access Memory (RAM) and Read Only Memory (ROM). Random Access Memory The Random Access Memory is used for storing information temporarily. When the computer is switched off, the information on the RAM is wiped off. The access rate of RAM is much higher. They are more expensive than the other types of primary storage devices. Read Only Memory It is used to permanently store data. Data can be stored on ROM, either when the computer is been manufactured or by the computer user. However, the disadvantage of this type of memory is that the data stored on ROM cannot be changed. The access rate necessary to get to the memory is much lesser as compared to the access rate of the RAM. Unlike the RAMs, ROMs are not expensive. Secondary Computer Storage Devices Most of the storage devices we are acquainted with come under this category. They are not a part of the processor. People make use of these devices, so that the storage capacity of the computer can be increased. Like the ROM, the secondary computer storage are also non volatile. The information stored on the these devices is retained, even if the computer has been switched off. Hard Drives The hard drives are one of the most important of the secondary types

of computer data storage devices, the hard drive types. Data is stored on the hard drives in the digital format on the hard drives. In the initial days of the computers, hard disks were like removable mass storage devices. However, with time they started coming as a part of the central processing unit of the computer. However, now there are external hard drives available as well. Floppy Discs This is a magnetic storage device, which is set in square plastic shell. They are available in different sizes, like 8 inches, 5 inches and 3 inches. In the initial days floppy discs were very popular, however, with the advancements they got over shadowed by the other computer storage devices. Compact Discs Previously compact discs (abbreviated as CD) were used only for recording and storing audio files. Subsequently along with audio, video and other data is also stored on them. These discs can store data for long time. The data is stored on the CDs in optical format. Backup can be stored on the CDs. Digital Versatile Disc The format of storing data in the digital versatile discs (DVD) is similar to that of a compact disc. The difference lies in the storage capacity. There is six times more storage space in the DVDs as compared to the CDs. Like the CDs, DVDs are also used as backup device. Flash Memory With a lot of research came the flash memory. This storage devices for a computer is similar to the read only memory. However, there is a big difference between the flash memory and the ROM. Data from the flash memory can be erased in a matter of few seconds from the flash drives, which is not the case with the ROMs. At the same time, the data can be changed as per the requirement Awhile back, we covered the different types of hardware used with computers. You know, basic hardware and the extra hardware you can buy separately, etc. (You can read here for that article). So, I thought it would be nice to cover the different kinds of computer storage devices that are available as well. And thats exactly what Im going to do today!

Knowing what kinds of storage devices are available can keep you from using up too much space on your computers hard drive. They can also help keep your computers hard drive from crashing, along with keeping it running at top speed. The most common storage devices are:

Floppy Disks Zip Disks CD + RW CD + R DVD + RW DVD + R

Floppy Disk They are plastic square disks, usually with a silver or black sliding piece going across the top. These disks come in a variety of colors and they hold about 144 million bytes. (Bytes are characters, symbols and letters). Zip Disk They look like a floppy disk, but they are a little thicker. This disk also comes in a variety of colors and holds about 200 MB of data. CD + RW Disc (Compact Disc Rewriteable) This disc looks like a regular CD. The only difference is that you can write on this disc and erase it as many times as you want. It works just like a floppy disk or a zip disk. A CD + RW disc holds about 650 MB. CD + R Disc (Compact Disc Recordable) This one is a CD that you can record on. Its mostly used to record audio and once its been written on, you cannot rewrite or erase anything off of it. This compact disc comes in different sizes, but they are usually silver in color. (Some CDs are black in color and they actually dont get as many scratches on them as the silver ones do. They are also a lot less fragile). A DVD R Disc (Digital Video Recordable) These discs hold the space of about 4.7 GB and are used to record movies on.

The more uncommon storage devices are:


Removable Hard Drive Internet Hard Drive Flash PC Cards Smart Cards Storage Tapes Memory Sticks Smart Media

Removable Hard Drive This is a disk drive in which a plastic or metal case surrounds the hard drive. It can be inserted and removed just like a floppy disk. It holds about 2 GB of data. Internet Hard Drive This one is a service on the Internet that provides storage space to computer users. This service offers about 25 MB of space, but it could be more, depending on the service type. Flash Drive This a storage device that comes in many colors and has a stick shape to it. They are very small in size, but they can hold anywhere between 256 MB and 3 GB of material on them.

PC Card This is a thin credit card size device that fits into a PC card slot, usually on a notebook computer. This card simply adds storage to most notebooks. Smart Cards These are the size of an ATM card. When inserted into a smart card reader, they can read and update data for you. Storage Tape This one is a magnetically coated ribbon of plastic, capable of storing large amounts of data at a very low cost. Usually, storage tapes are a little bigger than audio tapes. Older computers used tape and tape drives, but even today, some people still back their systems up with storage tape. These tapes hold between 20 GB to about 110 GB of data. An external tape drive can be purchased separately as well, but those are even harder to find. Miniature Mobile Storage Media This is used mostly with handheld computers and digital cameras. Memory Stick This is a rectangular shaped disk that is used mostly with digital cameras and notebook computers. They hold approximately 128 MB as well. Micro Drive This is a square disk that has 1 GB of space and is used with digital cameras and handheld computers. Smart Media Disc This is a square disk that has 2 MB to about 128 MB of space on it. Its used with digital cameras, handheld computers and photo printers. There you go! These are just some of the storage devices that are available today. So, the next time you want to save something that takes up a large amount of space on your hard drive, think twice about it and consider using one of these storage devices instead. One of these devices could save you a lot of space on your hard drive and keep your system running at its best

Application of computer in business Computers have become a requirement in the business industry. Computers easily
complete duties that are tedious and timely for humans.

Computer Business Applications

The Office Administrations Computer Business Applications department successfully provides students with an introduction to computers and computer literacy, and prepares students for gainful employment in any type of business, professional, educational, and industrial business setting. Emphasis is placed on learning state-ofthe-art computer business applications and fundamental business skills so that students have a working knowledge of the most frequently used computer business application programs common in todays business offices. Business applications include Microsoft Windows operating system; Microsoft Access, Excel, Outlook, PowerPoint, and Word; and financial applications such as QuickBooks Pro. Computer keyboarding, proofreading, business procedures and filing and records management skills are also emphasized. All of the courses are transferable to a California State University. The primary focus of the Computer Business Applications department is to provide students the knowledge and skills to not only achieve certification at the college level, but at the national and international certification level as well. To this end, the department offers students the option of majoring in Computer Business Applications with its certification of achievement so that students can apply the units towards their Associate of Arts degree. In addition, the department utilizes Microsoft Certified Application Specialist Approved Courseware so that students can take and achieve national certification at the Core

and Expert levels upon completion of the required CBA courses. Golden West College is a member of the Microsoft IT Academy and the department uses the curriculum to further reinforce those skills for students to acquire the Microsoft Certified Application Specialist (MCAS) certification. The Computer Business Applications program offers certification for the Certified Business Professional bringing recognition to Golden West College as one of a few international testing sites in the State of California that offer the International Association of Administrative Professional Certified Professional Secretary and the Certified Administrative Professional Exams. The business uses of computers are extensive. Although many of the computer duties are not irreplaceable, business has become dependent on their accuracy and timeliness. Accounting Business success is dependent upon accuracy. Many businesses use accounting software and ledgering systems to ensure the accuracy of their financial status.
o

Customer Interaction Computers now assist human call centers with answering customer questions, taking payments and providing general assistance. The automated voice systems are available with unrestricted hours and are always friendly.
o

Scheduling Scheduling is of great importance to many businesses, especially businesses involved in manufacturing and deliveries. Scheduling systems allow businesses to ensure they are meeting their goals while being effecient.
o

Communication Communication is most important in business. Computers provide businesses with a wide array of communication methods that include, but are not limited to, email, chat, web conferencing and VOIP.
o

Websites and Advertising The combination of websites, advertising and marketing provide a swift means to vast business globalization. Websites make the company quickly available to everyone.
o

Limitation: Computer has done this and that. Actually this is not the computer which has done this but the user. Despite its various features, a computer does have the following limitations: a. No Self Intelligence Today, a computer is able to do a work which is impossible for man. Computers are used to do risky and dangerous work and where sharp actually is needed. But it does not have any intelligence of its own. It works according to the instruction only. b. No Decision-Making power Computer cannot take any decision of its own. It does only those tasks which are already instructed to it. c. No learning power Computer has no learning power. Once you give instructions to a computer how to perform a task, the very task is cannot perform if you do not give it any instructions for the next time. For example, when you are taught how to solve a problem and it same type of problem is given to you to solve, then you can do it because you have learned how to solve the problem.
Programmed by human: Though computer is programmed to work efficiently, fast and accurately but it is programmed by human beings to do so. Without a program, computer is nothing. A program is a set of instructions. Computer only follows these instructions. If the instructions are not accurate the working of computer will not accurate. Thinking: The computer can not think itself. The concept of artificial intelligence shows that the computer can think. But still this concept is dependent on set of instructions provided by the human beings.

Self Care: A Computer can not care itself like a human. A computer is dependent still to human beings for this purpose. Retrieval of memory: A computer can retrieve data very fast but this technique is linear. A human being's mind does not follow this rule. A human mind can think randomly which a computer machine can not. Feelings: One of the main limits in the computer is of feeling. A computer can not feel about some like a human. A computer can not meet human in respect of relations. Human can feel, think and caring but a computer machine itself can not. A computer can not take place of human because computer is always dependent of human.

Computer Languages
Computer Languages I intend to try to give you some answers to the following questions:

why don't we just use English (or Chinese or whatever)? why don't we just use assembly language? how many computer languages are there? why do we use more than one computer language? what are the important differences between computer languages?

Why don't we just use English? Natural languages, such as English, are ambiguous, fuzzily structured and have large (and changing) vocabularies. Computers have no common sense, so computer languages must be very precise - they have relatively few, exactly defined, rules for composition of programs, and strictly controlled vocabularies in which unknown words must be defined before they can be used. It is a major goal of research in Artificial Intelligence to find out how to make computers understand natural languages, and the more we learn, the harder it seems to be! Why don't we just use Assembly Language?

Sometimes we have to use assembly language (Low-Level Language, LLL) because there just isn't any other sensible way of telling the computer what it must do. However, most programming is done in High-Level Languages (HLLs), so what benefits does this bring? The most important answer is productivity - it is usually easier, or more costeffective, to use a HLL. Some of the reasons for this are:

easy to write: useful concepts & facilities, relevant to application easy to read: computer, your future self, others - for reuse, maintenance, enhancement etc. portability: other compiler/toolset suppliers, users, computers - standards error detection & reporting

How many Computer Languages are there? late 1940s first electronic computers & LLLs 1950s first HLLs for computers 1969 about 120 HLLs, about 15 in widespread use 1977 about 80 HLLs in active (non-trivial) use Today more than 2000 HLLs

Why do we use more than one Computer Language?


Different kinds of languages emphasise different things about the problem, and so are better at describing different aspects of the solution, or even different kinds of problems and solutions. Computer Science is ever-changing, so there is continual evolution of the concepts we need to use and the notations for describing these concepts. For example, Operational languages express how something is achieved, and make the reader work out what is being achieved. Declarative languages express what must be achieved, and make the system work out how to achieve it. The earliest languages had few restrictions, so they were very powerful, but turned out to be very dangerous to use. After a while, people developed languages that were much safer to use, but there were complaints about their lack of power. Nowadays, we are starting to see languages that are both safe and powerful, but the process has a long way to go yet. What are the important differences between Computer Languages? Saying the same thing in different ways - Syntactic differences infix

a = b + c

prefix postfix

(set a, (add b, c)) b c + a =

"english"

ADD b TO c GIVING a

distributed PAR to_a ! b + c to_a ? a visual

Saying different things - Semantic differences Imperative Paradigm The very earliest languages had to be based on something, and that was probably simple instructions give to humans without much vocabulary or common sense i.e. children. The basic ideas are about describing state (e.g. the current state, or a desired next state, of a particular set of things), the actions that modify the state, and the sequence of the actions. In a computation, state is represented by the values of registers (PC etc.) and memory (variables etc.). e.g. making tea: declare kettle, teapot, water, tea_leaves; kettle= water; boil (kettle); teapot= tea_leaves; teapot= teapot + kettle; However, although this is intuitive for simple problems, it became clear that this did not scale well - i.e. it becomes disproportionately hard to use as problem size increases. To determine whether a program will work correctly, we must examine e.g. all possible combinations of actions on all of the state. To reduce the number of possible combinations, we can control: which actions are permitted on different parts of the state - type checking whereabouts in the program particular actions can be used or parts of the state accessed scope Increasing awareness of scope and type checking carried language design in two directions. The main stream of language design included these ideas in most programming languages, and gave rise to new programming paradigms which maximised

the control over state (objects), or minimised the use of state (functional, logic). However, as the problem became better understood, it became clear that in some situations it could be an advantage to avoid scopes and types altogether (scripting). Object Oriented Paradigm This is similar to Imperative but with maximum use of types & scopes - keep state in objects, each type of object (class) having its own set of actions (methods). Furthermore, the state in an object can often only be accessed or modified via its associated methods. Functional paradigm Functional languages emphasise the transformations of values (so the notation usually makes it easy to describe & examine values): let boiling_water = boil (put_in (kettle, [water])) in put_in (teapot, [tea_leaves, boiling_water]) end In particular, values don't have state, so they can be substituted freely: put_in (teapot, [tea_leaves, boil (put_in (kettle, [water]))]) Logic paradigm Define a problem by describing its facts and properties, and then solve it by giving the system a goal to prove using those facts and properties. make(Con,tea):-water_proof(Con),heat_resistant(Con), contains(Con,tea_leaves),contains(Con,boiling_water). source(tea_caddy,tea_leaves). source(tap,water). source(Con,boiling_water):canboil(Con),contains(Con,water). contains(Con,Item):-source(Con,Item). contains(Con,Item):-source(Con2,Item),move(Item,Con,Con2). canboil(kettle). water_proof(teapot). heat_resistant(teapot). move(Item,Con,Con2). If we ask ``can we make tea in a teapot'' by typing make(teapot, tea). the system answers yes, or if we ask ``what can we make tea in'' by typing make (X, tea). we get X = teapot We can even get the system to tell us how to make tea: move(Item,Con,Con2):- write('move '), write(Item), write(' from '), write(Con2), write(' to '), write(Con), nl. canboil(kettle):- write('boil kettle'), nl. and make(teapot, tea). will output: move tea_leaves from tea_caddy to teapot

move water from tap to kettle boil kettle move boiling_water from kettle to teapot Parallel paradigm Another difficulty with Imperative programming was the concept of sequence - there are many circumstances where the exact order of some actions does not matter, as long as they are all done before we progress to the next step. In parallel languages, if actions don't interact, work on them in any order (non-determinism), or even simultaneously (multi-processing). CHAN OF ANY to_pot, to_kettle, kettle_to_pot, to_cup: declare boiling_water: PAR declare water: SEQ -- kettle to_kettle ? water boil ( ) kettle_to_pot ! boiling_water declare tea_leaves: SEQ -- teapot PAR to_pot ? tea_leaves kettle_to_pot ? boiling_water to_cup ! tea Scripting Paradigm So far, we have been thinking about languages suitable for solving very large problems, where the resulting programs are tens of thousands or more lines long, written and maintained by more than one person. However, not all problems require industrialstrength solutions, and different requirements have given rise to different kinds of languages. The situations where they are applicable are:

building applications by ``gluing together'' existing components controlling applications that have a programmable interface writing programs where ease of development is more important than anything else (such as run-time efficiency, or maintainability)

The resulting languages are greatly simplified from the programmers point of view, so that ``scripting languages make programmers of us all''. A major design pressure is to minimise the amount that users have to write, and therefore that they can get wrong. In particular, they minimise the use of declarations, and thus the use of types or scopes they often only have one type, the string (so numbers are held as a series of digit characters). This reduces the usefulness of compilation, and means that more work must be done at run-time, so these languages are often interpreted (and thus run much more

slowly). They are often used to write simple little programs that are unlikely to ever be run again. The earliest such languages were precursors to what we now know as CLIs or shells. Many of the thousands of existing programming languages are scripting languages designed to control specific applications. Widely-used scripting languages include AWK, Bash, JavaScript, Perl, Python, Rexx, and Tcl. Some of the ideas behind scripting languages are also relevant to more main-stream languages, such as Visual Basic. There is a big danger lurking in all of this - the very simplicity of scripting languages makes them easy to overuse, and there is a new generation of users busy reinventing the mistakes of the previous generations, writing programs that no-one understands or can maintain

Você também pode gostar