Студопедия

КАТЕГОРИИ:


Архитектура-(3434)Астрономия-(809)Биология-(7483)Биотехнологии-(1457)Военное дело-(14632)Высокие технологии-(1363)География-(913)Геология-(1438)Государство-(451)Демография-(1065)Дом-(47672)Журналистика и СМИ-(912)Изобретательство-(14524)Иностранные языки-(4268)Информатика-(17799)Искусство-(1338)История-(13644)Компьютеры-(11121)Косметика-(55)Кулинария-(373)Культура-(8427)Лингвистика-(374)Литература-(1642)Маркетинг-(23702)Математика-(16968)Машиностроение-(1700)Медицина-(12668)Менеджмент-(24684)Механика-(15423)Науковедение-(506)Образование-(11852)Охрана труда-(3308)Педагогика-(5571)Полиграфия-(1312)Политика-(7869)Право-(5454)Приборостроение-(1369)Программирование-(2801)Производство-(97182)Промышленность-(8706)Психология-(18388)Религия-(3217)Связь-(10668)Сельское хозяйство-(299)Социология-(6455)Спорт-(42831)Строительство-(4793)Торговля-(5050)Транспорт-(2929)Туризм-(1568)Физика-(3942)Философия-(17015)Финансы-(26596)Химия-(22929)Экология-(12095)Экономика-(9961)Электроника-(8441)Электротехника-(4623)Энергетика-(12629)Юриспруденция-(1492)Ядерная техника-(1748)

Structured and object-oriented programming




 

Structured programming is the process of dividing the program into smaller units or modules, which allows clearer expression of the problem and simpler organization. A structured programming language facilitates the process. A structured approach can help to formalize design activities and decisions so that teams of developers can work together on software-development projects. Three interrelated concepts form the basis of a structured approach to programming: top-down design, modularization,, and the standardized control structures.

Top-down design is a popular technique for structured design. First, it consists of specifying the solution to a problem in general terms and, then, breaking the solution down into finer and finer de­tails. Top-down design is similar to creat­ing an outline and later filling it in. It is often contrasted to bottom-up design. Top-down design refers to starting with the whole and working toward the parts, whereas bottom-up design refers to starting with the parts and trying to build a whole, and it is generally used when coding a program.

A tool that is often used in top-down design is a structure chart, sometimes called a hierarchy chart, which is a diagram that shows the components of a program and the inter­connection between components. The developer analyzes the problem by start­ing at the top or the most general func­tion and carefully works down to the lower-level functions. The developer need not look at any details of the pro­cesses involved. The task is to determine what needs to be done, isolate the pro­cessing steps, and break the program into a set of interrelated modules. The resulting diagram of modules becomes a useful visual method for checking the design logic.

The concept of modularization helps a software developer to divide a complex program into smaller subprograms. A module is a set of instructions that can be tested and verified independent of its use in a larger program. In other words, it can be coded, debugged, and tested without having to write an entire pro­gram. It is much easier to write a small module, test and verify it, and then com­bine it with other modules to form a program than it is to write and test an entire large program from beginning to end.

How do independent modules work as part of a larger program? Just as pro­grams accept input, process it, and pro­duce output, modules perform similar functions. Modules communicate to one another by passing data back and forth. Inputs specify the information needed for the module to do its task. The output is the result of the processing done by the module. In this way, a module be­comes a well-defined processing task that can be developed and then tested separately. Modern programming languages sup­port modularization directly through features called units, packages, func­tions, procedures, and even modules. Large-software development projects are so complex that modularization is a necessity.

Another basic premises of structured programming is that all the programs can be written using three basic control structures, which are statements in the program that controls the order in which the instructions are executed. The basic control structures are sequence, selection, and looping – the process of repeating the execution of a set of instructions. A fourth control structure, called the case-control structure, is often included in structured discussions. These control structures are designed to help maintain the modular program structure.

An algorithm is a step-by-step set of instructions for solving a specific prob­lem. In the context of developing software, algorithms are sets of instructions for computational prob­lems. There are problems for which no known algorithms exist, such as getting a computer to play a perfect game of chess. There are also problems for which an algorithm exists, but the computer time needed to solve it grows exponentially with the size of the problem. Such problems are called intractable.

There are also problems for which both an algorithm and a reasonable time-solution exist. For example, using a technique called a binary search, deter­mine how many comparisons it would take in the worst case to find a name in a one-million-name telephone directory. (In the worst case of a sequential search, one million comparisons would be re­quired.) The answer is 20. Also, as the telephone directory grows exponentially larger, the number of comparisons required, does not increase at a similar rate. A one-billion-name telephone di­rectory would, in the worst case, require only 30 comparisons. Many algorithms exist for sorting, searching, statistical calculating, and other mathematical procedures. If you need to sort some data quickly, for ex­ample, you can look up a published algorithm for fast sorting, copy it, and incorporate it into your program. These public algorithms are an excellent source problem-solving information, and if fit the problem, they can easily be used by the developer.

In addition to structured programming, another approach for dealing with the complexity of software is called object-oriented programming, which is gaining favour among software developers.

Object-oriented programming is a technique in which the developer breaks the problem into modules called objects that contain both data and in­structions and can perform specific tasks. The developer then organizes the pro­gram around the collection of objects. It is characterized by the following con­cepts.

· Autonomy. The ability to deal with software entities (objects) as units that interact only in defined, controllable ways.

· Similarity. The ability to describe a software entity in terms of its differ­ences from another entity. In other words, a new object can inherit characteristics from an old one.

Classification. The ability to repre­sent an arbitrary number of data items that all have the same behaviour and the same characteristics with a single software entity, called a class. The class serves as a template from which specific objects are created. A collec­tion of classes associated with a particular environment is called a library.

Classes describe what objects can ex­ist, the characteristics of those objects, and what kinds of procedures can be performed with the objects. Classifica­tion and similarity allow new system ele­ments to be defined by leveraging the specifications of existing classes. For ex­ample, if we wanted to show our invoice on a display screen as well as print it, we could add a new “display invoice” object that inherits the general characteristics of invoices from an invoice class. A soft­ware developer would create the display invoice object by programming the dif­ferences between the print-invoice ob­ject and the display-invoice object. In the process, previously defined characteris­tics are used when appropriate.

Objects and their classes provide an­other technique for understanding and defining a problem phase in the process of designing a program. Perhaps what is more important, the object model is very accommodating to engineering a solu­tion. In most cases, the object model can be used directly as a blueprint when creating an object-oriented program.

 

2.4 Give English equivalents of the following words and word-combinations.

 

Взаємозв’язок між компонентами, функції нижчого рівня, візуальний метод, таким чином, підтримувати модулярізацію, виконувати подібні функції, застосовувати специфікацію, успадкувати загальні характеристики особливе операційне середовище, засіб,довільна кількість даних, шаблон, поведінка, специфічний об’єкт, інший підхід, покроковий, двійковий пошук, подібність.

 

2.5 Translate the following word-combinations into English so that you could form compound nouns.

Розробка програмного забезпечення, вимоги користувача, список вимог, засоби розробки, довідник даних, словник бази даних, генератор звітів, рівень користувача, повідомлення про помилку, документація програми, інструкція для користувача, розробники програмного забезпечення, генератор програм.

 

2.6 Translate the following sentences into English.

 

1.Алгоритм вказує, які операції оброблення даних і в якій послідовності необхідно виконати,щоб одержати розв’язок задачі.

2. Застосовуючи обєктно-орієнтоване програмування, розробник розбиває проблему на модулі, які називаються об’єктами.

3.Обєкт є автономним модулем, який містить в собі дані і команди.

4.Прихильники обєктно-орієнтованого програмування вважають, що воно прискорює процес створення програми та знижує витрати на її розробку.

5. Однією з головних переваг модулярізації є те, що модулі можна перевіряти по ходу розробки проекту.

 

2.10 Fill in the blanks with the words from the box.

 

hierarchy chart object-oriented programming an object model an object a library  

 

1. … is a diagram that shows the components of the program and the interconnections between them.

2. … is gaining favour among software developers.

3. A collection of classes associated with a particular environment is called ….

4.… is very accommodating to engineering a solution.

5.… is a self –contained module that contains data and instructions.

 

2.7. Explain the following terms in your own words.

 

Binary search bottom-up design debug library hierarchy chart structured programming

 

2.8 Answer the questions.

 

1. What is the difference between structured and object-oriented programming?

2. What tool is often used in top-down design?

3. Explain the concept of modularization.

4. What is one of the major advantages of modularization?

5. Explain the concept of an algorithm. Give an example of intractable problems.

6.In what cases do you use a technique called a binary search?

7. What are the three basic control structures of structured programming and what is their function?

8. What do classes describe?

9. What is one of the major advantages of modularization?

 




Поделиться с друзьями:


Дата добавления: 2015-01-03; Просмотров: 330; Нарушение авторских прав?; Мы поможем в написании вашей работы!


Нам важно ваше мнение! Был ли полезен опубликованный материал? Да | Нет



studopedia.su - Студопедия (2013 - 2024) год. Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав! Последнее добавление




Генерация страницы за: 0.027 сек.