CCS102 Computer Programming 1 Course Material PDF

Document Details

Pamantasan ng Cabuyao

Janus Raymond C. Tan

Tags

computer programming programming languages computer science software development

Summary

This document is a course material for Computer Programming 1, outlining fundamental concepts in computer programming, different programming languages, and the Software Development Life Cycle (SDLC).

Full Transcript

PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 1 PRELIM PERIOD COMPUTER PROGRAMMING 1 Janus Raymond C. Tan Course Instructor PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 2 Introduction to...

PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 1 PRELIM PERIOD COMPUTER PROGRAMMING 1 Janus Raymond C. Tan Course Instructor PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 2 Introduction to Computer Programming 1 Concepts LEARNING OUTCOMES At the end of the lesson, the students should be able to: Define the fundamentals of Computer Programming concepts Identify the different programming languages and their application Describe the SDLC RESOURCES NEEDED For this lesson, you would need the following resources: Laptop or Personal Computer Any Java IDE (Eclipse IDE, NetBeans IDE etc.) PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 3 MODULE CONTENTS What is a computer 4 and Computer Program? What is Computer 8 Programming? Programming Language 9 and its types Low Level versus 12 High Level Programming Language 12 Digital Data 14 Software Concepts Software Development 17 Life Cycle (SDLC) 21 References PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 4 INTRODUCTION When people say that computers “run” our lives, they are only barely exaggerating. Pretty much every aspect of our day-to-day lives utilizes computers in a major way. Shopping is computerized. Banking is computerized. Communications, entertainment, industry, productivity… name any economic activity in the developed world, and computers are the workhorses keeping it running. And what keeps the computers running? Programming! No computer does anything without code telling it what to do, and how to do it. Every time a grocery store needs a new inventory system, or an HR department needs a new way to track employee benefits, that’s work done by a programmer. Nor is this trend slowing down. No, it’s only accelerating. Use of robots and “artificial intelligence” is growing at an exponential rate. More and more operations are now relying on computers and robots, of some sort, to keep themselves moving and growing. Those robots and AIs, also, cannot do anything without human programmers teaching them what to do. Knowing how to program isn’t simply a way to become “a programmer.” All manner of employers and industries need people capable of understanding computers and their functions. Having a background in programming is a huge boon to any employee looking for a job – it’s a big added bonus for their employer. Plus, of course, there’s the issue of job safety. People across many fields fear being displaced by robots doing their job. But not the programmers. They’ll always be needed. What is a Computer and Computer Program? What is a computer? A computer is a programmable electronic device that accepts raw data as input and processes it with a set of instructions (a program) to produce the result as output. It renders output just after performing mathematical and logical operations and can save the output for future use. It can process PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 5 numerical as well as non-numerical calculations. The term "computer" is derived from the Latin word "computare" which means to calculate. A computer is designed to execute applications and provides a variety of solutions through integrated hardware and software components. It works with the help of programs and represents the decimal numbers through a string of binary digits. It also has a memory that stores the data, programs, and result of processing. The components of a computer such as machinery that includes wires, transistors, circuits, hard disk are called hardware. Whereas, the programs and data are called software. It is believed that the Analytical Engine was the first computer which was invented by Charles Babbage in 1837. It used punch cards as read-only memory. Charles Babbage is also known as the father of the computer. Additionally, a computer is defined as, an electronic device capable of performing complex computations in a short time a fast electronic calculating machine that accepts input information, processes it according to a list of internally stored instructions called a program, and produces the resultant output information What is a Computer Program? Before getting into computer programming, let us first understand computer programs and what they do. A computer program is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. The two important terms that we have used in the above definition are: 1. Sequence of instructions 2. Computer Programming Language To understand these terms, consider a situation when someone asks you about how to go to a nearby KFC. What exactly do you do to tell him the way to go to KFC? PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 6 You will use Human Language to tell the way to go to KFC, something as follows: First go straight, after half kilometer, take left from the red light and then drive around one kilometer and you will find KFC at the right. Here, you have used English Language to give several steps to be taken to reach KFC. If they are followed in the following sequence, then you will reach KFC: 1. Go straight 2. Drive half kilometer 3. Take left 4. Drive around one kilometer 5. Search for KFC at your right side Now, try to map the situation with a computer program. The above sequence of instructions is actually a Human Program written in English Language, which instructs on how to reach KFC from a given starting point. This same sequence could have been given in Spanish, Hindi, Arabic, or any other human language, provided the person seeking direction knows any of these languages. Now, let's go back and try to understand a computer program, which is a sequence of instructions written in a Computer Language to perform a specified task by the computer. Following is a simple program written in Java Programming Language: System.out.print("Hello, World!"); The above computer program instructs the computer to print "Hello, World!" on the computer screen. A computer program is also called a computer software, which can range from two lines to millions of lines of instructions. Computer program instructions are also called program source code and computer programming is also called program coding. A computer without a computer program is just a dump box; it is programs that make computers active. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 7 As we have developed so many languages to communicate among ourselves, computer scientists have developed several computer-programming languages to provide instructions to the computer (i.e., to write computer programs). In simple definition, a computer program is, a set of instructions telling a computer what to do an algorithm written in a language that a computer can understand the implementation (or concrete realization) of an algorithm in a language particular to the computing environment available to its author. Uses of Computer Programs Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc. Listed below are a few applications of computer programs: MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are examples of computer programs. Computer programs are being used to develop graphics and special effects in movie making. Computer programs are being used to perform Ultrasounds, X-Rays, and other medical examinations. Computer programs are being used in our mobile phones for SMS, Chat, and voice communication. What is Computer Programming? If you understood what a computer program is, then we will say: the act of writing computer programs is called computer programming. As we mentioned earlier, there are hundreds of programming languages, which can be used to write computer programs and following are a few of them: Java C PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 8 C++ Python PHP Perl Ruby Computer programming is the act of writing computer programs, which are a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. Computer programming is the craft of implementing one or more interrelated abstract algorithms using a particular programming language to produce a concrete computer program. What is a Programming Language? As we know, to communicate with a person, we need a specific language, similarly to communicate with computers, programmers also need a language is called Programming language. Before learning the programming language, let's understand what is language? What is Language? Language is a mode of communication that is used to share ideas, opinions with each other. For example, if we want to teach someone, we need a language that is understandable by both communicators. What is a Programming Language? A programming language is a computer language that is used by programmers (developers) to communicate with computers. It is a set of instructions written in any specific language (C, C++, Java, Python) to perform a specific task. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 9 A programming language is mainly used to develop desktop applications, websites, and mobile applications. Low-level versus High-level Programming Language Programming Language and its types 1) Low-level programming language is machine-dependent (0s and 1s) programming language. The processor runs low- level programs directly without the need of a compiler or interpreter, so the programs written in low- level language can be run very fast. Low-level language is further divided into two parts: a) Machine Language Machine language is a type of low-level programming language. It is also called as machine code or object code. Machine language is easier to read because it is normally displayed in binary or hexadecimal form (base 16) form. It does not require a translator to convert the programs because computers directly understand the machine language programs. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 10 The advantage of machine language is that it helps the programmer to execute the programs faster than the high-level programming language. Sample machine language program to add 5 and 3 (using the Intel 486 processor instruction set): 10111000 00000101 00000000 10111011 00000011 00000000 00010001 11011000 b) Assembly Language Assembly language (ASM) is also a type of low-level programming language that is designed for specific processors. It represents the set of instructions in a symbolic and human- understandable form. It uses an assembler to convert the assembly language to machine language. Assembly language is a programming language that uses “abbreviations” or mnemonics in place of binary patterns in order to make the task of programming easier. Mnemonics are designed to be easy to remember and are a significant improvement over binary digit. An assembly language program has to be converted to machine language before a computer can execute it. An assembler is a special program that translates assembly language mnemonics into machine language. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 11 The advantage of assembly language is that it requires less memory and less execution time to execute a program. Sample assembly language program to add 5 and 3 (using the Intel 486 instruction set): MOV AX, 05 MOV BX, 03 ADD AX, BX 2) High-level programming language (HLL) is designed for developing user- friendly software programs and websites. This programming language requires a compiler or interpreter to translate the program into machine language (execute the program). High-level programming language uses English-like commands or instructions. High-level languages are the easiest to use and contains many complicated or advanced instructions. A high-level language has to be converted to machine language before a computer can execute it A compiler is a special program that translates high- level language instructions into machine language. The main advantage of a high-level language is that it is easy to read, write, and maintain. High-level programming language includes Python, Java, JavaScript, PHP, C#, C++, Objective C, Cobol, Perl, Pascal, LISP, FORTRAN, and Swift programming language. Sample Java program to add 5 and 3: int num1 = 5; int num2 = 3; int sum = num1 + num2; PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 12 Low Level vs. High Level Languages Both low level and high level has its own share of advantages and disadvantages. High-level languages are easier to understand and use while low-level languages are difficult. Low-level languages are more efficient (programs written in low-level languages are better in terms of speed and hardware utilization) than high-level languages. Digital Data How can a computer represent numbers using bits? “0” and “1” are also known as bits or binary digits The computer uses the binary number system which uses only two digits: 0 and 1. A series of 0’s and 1’s results in a particular number much in the same way we use the decimal number system: Decimal (Base 10) Binary Base 2 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 13 How then can a computer represent words and letters using bits? Bits can also be used to represent character data. In this case, computers make use of 0 and 1 as a replacement to dashes and dots. Types of codes 1) ASCII American Standard Code for Information Interchange requires only seven bits for each character 2) EBCDIC Extended Binary Coded Decimal Interchange Code an alternative 8-bit code used by older IBM mainframe computers 3) UNICODE uses 8-, 16-, or 32-bits providing codes for 65,000 characters (represent the alphabets of multiple languages) and becoming popular 4) Extended ASCII code makes use of a series of 0’s and 1’s to represent 256 characters (including letters for uppercase and lowercase, numbers, and symbols). PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 14 Extended ASCII Code Table Software Concepts A Software is a set of programs, which is designed to perform a well- defined function. A program is a sequence of instructions written to solve a particular problem. There are two types of software, System Software Application Software PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 15 System Software The system software is a collection of programs designed to operate, control, and extend the processing capabilities of the computer itself. System software is generally prepared by the computer manufacturers. These software products comprise of programs written in low-level languages, which interact with the hardware at a very basic level. System software serves as the interface between the hardware and the end users. Some examples of system software are Operating System, Compilers, Interpreter, Assemblers, etc. Here is a list of some of the most prominent features of a system software: Close to the system Fast in speed Difficult to design Difficult to understand Less interactive Smaller in size Difficult to manipulate Generally written in low-level language Application Software Application software products are designed to satisfy a particular need of a particular environment. All software applications prepared in the computer lab can come under the category of Application software. Application software may consist of a single program, such as Microsoft's notepad for writing and editing a simple text. It may also consist of a collection of programs, often called a software package, which work together to accomplish a task, such as a spreadsheet package. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 16 Examples of Application software is the following: Payroll Software Student Record Software Inventory Management Software Income Tax Software Railways Reservation Software Microsoft Office Suite Software Microsoft Word Microsoft Excel Microsoft PowerPoint Features of application software are as follows: Close to the user Easy to design More interactive Slow in speed Generally written in high-level language Easy to understand Easy to manipulate and use Bigger in size and requires large storage space Data vs. Software Before, the term “software” is always associated to all non-hardware components of a computer. However, modern definitions made it clear that all documents, spreadsheets and even downloaded materials from the net are now classified as data. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 17 Source code - code written by the programmer Object code - machine language representation of the source code Linker - creates the executable code and combines program object code, object code from library routines and any other required system code into one addressable machine language file Software Development Life Cycle Software Development Life Cycle (SDLC) is a process used by the software industry to design, develop and test high quality softwares. The SDLC aims to produce a high-quality software that meets or exceeds customer expectations, reaches completion within times and cost estimates. SDLC is the acronym of Software Development Life Cycle. It is also called as Software Development Process. SDLC is a framework defining tasks performed at each step in the software development process. ISO/IEC 12207 is an international standard for software life-cycle processes. It aims to be the standard that defines all the tasks required for developing and maintaining software. What is SDLC? SDLC is a process followed for a software project, within a software organization. It consists of a detailed plan describing how to develop, PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 18 maintain, replace and alter or enhance specific software. The life cycle defines a methodology for improving the quality of software and the overall development process. The following figure is a graphical representation of the various stages of a typical SDLC. A typical Software Development Life Cycle consists of the following stages: Stage 1: Planning and Requirement Analysis Requirement analysis is the most important and fundamental stage in SDLC. It is performed by the senior members of the team with inputs from the customer, the sales department, market surveys and domain experts in the industry. This information is then used to plan the basic project approach and to conduct product feasibility study in the economical, operational and technical areas. Planning for the quality assurance requirements and identification of the risks associated with the project is also done in the planning stage. The outcome of the technical feasibility study is to define the various PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 19 technical approaches that can be followed to implement the project successfully with minimum risks. Stage 2: Defining Requirements Once the requirement analysis is done the next step is to clearly define and document the product requirements and get them approved from the customer or the market analysts. This is done through an SRS (Software Requirement Specification) document which consists of all the product requirements to be designed and developed during the project life cycle. Stage 3: Designing the Product Architecture SRS is the reference for product architects to come out with the best architecture for the product to be developed. Based on the requirements specified in SRS, usually more than one design approach for the product architecture is proposed and documented in a DDS - Design Document Specification. This DDS is reviewed by all the important stakeholders and based on various parameters as risk assessment, product robustness, design modularity, budget and time constraints, the best design approach is selected for the product. A design approach clearly defines all the architectural modules of the product along with its communication and data flow representation with the external and third-party modules (if any). The internal design of all the modules of the proposed architecture should be clearly defined with the minutest of the details in DDS. Stage 4: Building or Developing the Product In this stage of SDLC the actual development starts and the product is built. The programming code is generated as per DDS during this stage. If the design is performed in a detailed and organized manner, code generation can be accomplished without much hassle. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 20 Developers must follow the coding guidelines defined by their organization and programming tools like compilers, interpreters, debuggers, etc. are used to generate the code. Different high level programming languages such as C, C++, Pascal, Java and PHP are used for coding. The programming language is chosen with respect to the type of software being developed. Stage 5: Testing the Product This stage is usually a subset of all the stages as in the modern SDLC models, the testing activities are mostly involved in all the stages of SDLC. However, this stage refers to the testing only stage of the product where product defects are reported, tracked, fixed and retested, until the product reaches the quality standards defined in the SRS. Stage 6: Deployment in the Market and Maintenance Once the product is tested and ready to be deployed it is released formally in the appropriate market. Sometimes product deployment happens in stages as per the business strategy of that organization. The product may first be released in a limited segment and tested in the real business environment (UAT- User acceptance testing). Then based on the feedback, the product may be released as it is or with suggested enhancements in the targeting market segment. After the product is released in the market, its maintenance is done for the existing customer base. SDLC Models There are various software development life cycle models defined and designed which are followed during the software development process. These models are also referred as Software Development Process Models". Each process model follows a Series of steps unique to its type to ensure success in the process of software development. PAMANTASAN NG CABUYAO |COMPUTER PROGRAMMING 1 21 Following are the most important and popular SDLC models followed in the industry: Waterfall Model - suggests that prior to proceeding to next phase, the current phase should be finished first. Modified Waterfall Model - allows overlap between phases Iterative Model - allows phases to repeat, if necessary Other related methodologies are Spiral Model, V-Model, Big Bang Model, Agile Model, RAD Model, Rapid Application Development and Prototyping Models. REFERENCES Kids, R. P. 4. (2021, April 21). Understanding the importance of programming to the modern world. Real Programming 4 Kids. https://realprogramming.com/understanding- the-importance-of-programming-to-the-modern-world/ What is Computer | Types and Advantages - javatpoint. (n.d.). www.javatpoint.com. https://www.javatpoint.com/what-is-computer Computer Programming - Overview. (n.d.). https://www.tutorialspoint.com/computer_programming/computer_programming_over view.htm Computer Programming tutorial. (n.d.). https://www.tutorialspoint.com/computer_programming/index.htm Programming Language | What is Programming Language - Javatpoint. (n.d.). www.javatpoint.com. https://www.javatpoint.com/programming-language Computer - software. (n.d.). https://www.tutorialspoint.com/computer_fundamentals/computer_software.htm SDLC - overview. (n.d.). https://www.tutorialspoint.com/sdlc/sdlc_overview.htm

Use Quizgecko on...
Browser
Browser