Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Programming in Java

Similar presentations


Presentation on theme: "Advanced Programming in Java"— Presentation transcript:

1 Advanced Programming in Java
Introduction to OOP Mehdi Einali

2 agenda Object Oriented Programming History of Programming languages
Characteristics of objects Interface Encapsulation

3 Object oriented programming

4 Abstraction Simplification of complex system via interface(Modeling)
Machine language Assembly: an abstraction of the machine language Many languages are abstraction of assembly language Fortran, Basic, C But they still require you to think in terms of the structure of the computer Rather than the structure of the problem

5 Different Contexts Problem Space Solution Space
the place where the problem exists such as a business Solution Space the place where you’re implementing that solution such as a computer The effort required to perform this mapping

6 Library Problem Suppose you want to write a library program
What are the elements of your program? We think about methods and variables…

7 Object Oriented Approach
OO approach goes a step further Lets the programmer represent problem space elements This representation is general enough The programmer is not constrained to any particular type of problem. The elements in the problem space and their representations in the solution space are referred to as “objects”

8 Why OOP?

9 OOP The program is allowed to adapt itself to the lingo of the problem
by adding new types of objects when you read the code, you’re reading words that also express the problem. This is a more flexible and powerful language abstraction

10 Reuse Book Journal Teacher Student Course Grant Paper Library System
Education System Research System

11 Change SW system could not change with requirements
Maintenance is more expensive than development Avoid cascading changes Increase cohesion / balance coupling Object Orientation

12 Advantage of OOP Abstraction Seamless in modeling Reuse
Best fit to problem domain Reuse Good for Change Extendibility Maintainability Modifiability Testability

13 Evaluation of programming languages to OOP

14 generation 1 First-generation languages (1954–1958) FORTRAN I Mathematical expressions ALGOL 58 Mathematical expressions Flowmatic Mathematical expressions IPL V Mathematical expressions This first generation of high-order programming languages therefore represented a step closer to the problem space and a step further away from the underlying machine

15 Generation 2 Second-generation languages (1959–1961)
FORTRAN II Subroutines, separate compilation ALGOL 60 Block structure, data types COBOL Data description, file handling Lisp List processing, pointers, garbage collection Emphasis was on algorithmic abstractions Machines were becoming more and more powerful then more kinds of problems could be automated, especially for business applications read these personnel records first, sort them next, and then print this report A step closer to the problem space and further away from the underlying machine

16 generation 3 Third-generation languages (1962–1970)
PL/1 FORTRAN + ALGOL + COBOL ALGOL 68 Rigorous successor to ALGOL 60 Pascal Simple successor to ALGOL 60 Simula Classes, data abstraction Advent of transistors and then integrated circuit technology, the cost of computer hardware had dropped dramatically Larger problems could now be solved, but these demanded the manipulation of more kinds of data Support data abstraction describe the meaning of related kinds of data (their type)

17 Genertion gap The generation gap (1970–1980) Many different languages were invented, but few endured. However, the following are worth noting: C Efficient; small executable FORTRAN 77 ANSI standardization Creation of literally a couple of thousand different programming languages and dialects Few of these languages survived

18 oop Object-orientation boom (1980–1990, but few languages survive)
Smalltalk 80 Pure object-oriented language C++ Derived from C and Simula Ada83 Strong typing; heavy Pascal influence Eiffel Derived from Ada and Simula

19 Frameworks Emergence of frameworks (1990–today)
Visual Basic Eased development of the graphical user interface (GUI) for Windows applications Java Successor to Oak; designed for portability Python Object-oriented scripting language J2EE Java-based framework for enterprise computing .NET Microsoft’s object-based framework Visual C# Java competitor for the Microsoft .NET Framework Visual Basic .NET Visual Basic for the Microsoft .NET Framework

20 Topology of 1st and early 2nd gen
Basic physical building block of all applications is the subprogram (or the paragraph - COBOL) Flat physical structure, consisting only of global data and subprograms An error in one part of a program can have a devastating ripple effect across the rest of the system

21 Late 2nd and Early 3rd Gen The first software abstraction, now called the ‘procedural’ abstraction Variety of parameter-passing mechanisms Nesting subprogram, theories about control structures, scope and visibility of structures Structured design methods Greater control over algorithmic abstractions Still fails to address the problems of programming-in-the-large and data design.

22 Late Third-Generation
Larger programming projects meant larger development teams, and thus the need to develop different parts of the same program independently Separately compiled module Need for semantic consistency among module interfaces Most of these languages had dismal support for data abstraction and strong typing, such errors could be detected only during execution of the program.

23 Object based and object oriented
Procedural abstraction is not enough Data abstraction is important to mastering complexity Data-driven design methods emerged, which provided a disciplined approach to the problems of doing data abstraction in algorithmically oriented languages Theories regarding the concept of a type appeared, which eventually found their realization in languages such as Pascal If procedures and functions are verbs and pieces of data are nouns, a procedure-oriented program is organized around verbs while an object-oriented program is organized around nouns

24 Beyond programming languages
Enterprise Application Integration(EAI) Service Oriented architecture(SOA)

25 OOP vs. Procedural Approach
Elements of OOP Objects Message passing between objects Elements of procedural programming Functions Variables Function invocation The way of thinking Thinking about objects and relations Thinking about functions and computer structure

26 Object characteristics

27 OOP Characteristics Alan Kay summarized five basic characteristics of Smalltalk Everything is an object A program is a bunch of objects telling each other what to do by sending messages Each object has its own memory made up of other objects Every object has a type All objects of a particular type can receive the same messages

28 Booch’s description of an Object
An object has state, behavior and identity Booch added identity to the description An object (may) have internal data which gives it state An object (may) have methods to produce behavior And each object can be uniquely distinguished from every other object Each object has a unique address in memory

29 interface

30 Interface Each object can satisfy only certain requests
The requests you can make of an object are defined by its interface The type is what determines the interface

31 Representation of a light bulb

32 Person in an Education System

33 New names in OOP Function  Method, Service Variable  Property, State

34 encapsulation

35 Encapsulation Commercial products are encapsulated
Remote control TV Cell phone They are Black Boxes Hidden Implementations Public interface

36 encapsulate

37 Why Encapsulation? Simplified use Open implementation  bad use
Even for the producer Open implementation  bad use Hiding the implementation reduces bugs It is more beautiful!

38 Object Encapsulation Encapsulation of a problem-space concept into a class of objects Define interface Hide the implementation Black box The client may see the implementation But can not use it directly This is better even for the producer (programmer)

39 Access Control Access to some parts of the class is restricted
Public and Private area of the class The client of a class can use only public area Public area = class interface Public methods Public variables

40 Example: Rectangle Lets encapsulate a rectangle What is a rectangle?
An object Which has length and width (properties) Lets you specify its length and width Can calculate its area and perimeter

41 Class Declaration public class Rectangle { private int width, length;
public void setWidth(int w) { width = w; } public void setLength(int l) { length = l; public int calculateArea(){ return width*length; public int calculatePerimeter(){ return (width+length)*2; Class Declaration Private area: hidden implementation Public area : the interface

42 How to Use Rectangle? Rectangle rect = new Rectangle();
rect.setWidth(2); rect.setLength(7); System.out.println(rect.calculateArea()); System.out.println(rect.calculatePerimeter()); Object creation or instantiation

43 Grady Booch Booch Method Three Amigos(1994-95)
Ivar Jacobson Object Modeling Technique(OMT) Rumbaugh Process Objectory Unified Modeling Language(UML) Unified Process(UP) Object Oriented Analysis and Design-3rd edtion(2007) گریدی بوچ (به انگلیسی: Grady Booch) (متولد ۲۷ فوریه ۱۹۵۵)یک مهندس نرم‌افزار آمریکایی است که بیشتر به خاطر همکاری‌اش بر روی زبان مدل‌سازی یکپارچه به همراه ایوار جاکوبسون و جیمز رامبورگ معروف است. وی همچنین در عرصهٔ بین‌المللی به خاطر کارهای نوآورانه‌اش در معماری نرم‌افزار، مهندسی نرم‌افزار و محیط توسعه مشارکتی چهره‌ای شناخته شده می‌باشد. زندگی‌نامه وی در سال ۱۹۷۷ یک مدرک کارشناسی از آکادمی نیروی هوایی ایالات متحده آمریکا و در سال ۱۹۷۹ یک مدرک کارشناسی ارشد در رشتهٔ برق ازدانشگاه کالیفرنیا، سانتا باربارا دریافت نمود.[۱] بوچ سال‌ها به عنوان سرپرست محققان، از ابتدای تأسیس در سال ۱۹۸۱، در شرکت نرم‌افزار گویا کار می‌کرد و بعد از آنکه این شرکت توسط کمپانی آی‌بی‌ام در سال ۲۰۰۳ خریداری شد، تا سال ۲۰۰۸ در آن ماند. سپس با عنوان سرپرست محققان در بخش تحقیقات نرم‌افزاری آی‌بی‌ام همکاری کرده و چندین ویراستاری را برای بنجامین کامینگ انجام داد. در سال ۱۹۹۵ عنوان پیرو در انجمن ماشین‌های حسابگر  ACM به وی القا شد.[۲] وی همچنین به محض ورودش به آی‌بی‌ام نیز عنوان پیرو را دریافت نموده بود که تا ۲۰۰۸ در این سمت باقی ماند. او سال ۲۰۱۰ نیز به عنوان پیرو در مؤسسه مهندسان برق و الکترونیک دست یافت.[۳] کار بوچ زندگی کاری خود را صرف ارتقای هنر و علم توسعه نرم‌افزاری نموده است. در دههٔ ۱۹۸۰، یکی از معروف‌ترین کتاب‌های برنامه‌نویسی آدا را تألیف نمود. وی بیشتر به خاطر نقشش در توسعهٔ زبان مدل‌سازی یکپارچه در کنار ایوار جاکوبسون و جیمز رامبورگ شهرت دارد. آی‌بی‌ام ۱۱۳۰ بوچ اولین برنامه‌نویسی خود را برای آی‌بی‌ام ۱۱۳۰ ارئه داد.[۴] ... درای فروشگاه آی‌بی‌ام محلمون رو با مشت باز کردم و منتظر موندم تا فروشنده یه نگاه ترحم‌انگیز بهم انداخت. بعد از این که یه مدت با هم صحبت کردیم یه [دفترچه] فورترن بهم داد. مطمئنم وقتی داشت این‌کارو می‌کرد پیش خودش فکر می‌کرد «دیگه هیچوقت این بچه رو نمی‌بینم.». هفتهٔ بعد من برگشتم به فروشگاه و گفتم «این خیلی باحاله! همه‌اش رو خونده‌ام و یه برنامهٔ کوچولو هم نوشتم. کجا می‌تونم یه کامیپوتر پیدا کنم؟». یارو، برای ذوق و شوق من، یه زمان برنامه‌نویسی با آی‌بی‌ام ۱۱۳۰ آخر هفته اونم آخر شب پیدا کرد. این اولین خاطرهٔ من از برنامه‌نویسی بود، و باید از اون فروشندهٔ ناشناس برای شروع کردن شغلم تشکر کنم. مرسی آی‌بی‌ام. روش بوچ نمودار کلاس بوچ یک روش توسعهٔ نرم‌افزاری به نام روش بوچ ایجاد کرد که در کتاب طراحی و آنالیز شی‌گرا خود معرفی شد. او برای ساده کردن کدها، اضافه نمودن کلاس‌ها را توصیه نمود. روش بوچ روشی است که در مهندسی نرم‌افزار استفاده می‌شود. این روش یک زبان مدل‌سازی شی و اسلوب‌شناسی است که به وفور در طراحی و آنالیز شی‌گرا استفاده شده است. این روش توسط گریدی بوچ در شرکت نرم‌افزار گویا ایجاد شد. جنبه‌های نمادی روش بوچ امروزه توسط زبان مدل‌سازی یکپارچه(یو ام‌ال) جایگزین شده است، که عناصر گرافیکی از روش بوچ را به همراه عناصرتکنیک مدل‌سازی شی (او ام تی) و مهندسی نرم‌افزار شی‌گرا (او او اس ای) در خود دارد. ابعاد روش‌شناختی روش بوچ به چندین اسلوب‌شناسی و فرایند تقسیم شده است، مانند فرایند یکپارچه رشنال (آر یو پی). الگوی طراحی بوچ همچنین در الگوی طراحی دستی داشت. برای مثال، وی مقدمه‌ای بر کتاب الگوهای طراحی نوشت. تحقیقات آی‌بی‌ام - آلمادن وی هم اکنون در تحقیقات آی‌بی‌ام - آلمادن سرپرست تحقیقات در بخش مهندسی نرم‌افزار است، جایی که کار بر روی کتاب دستی معماری نرم‌افزار را ادامه داده و چندین پروژهٔ دیگر مربوط به مهندسی نرم‌افزار را رهبری می‌کند. کتاب‌ها گریدی کتاب‌ها و مقالات زیادی را به چاپ رسانیده است. بخشی از آن به قرار زیر می‌باشد: ۱۹۸۳، مهندسی نرم‌افزار با آدا.[۵] ۱۹۹۵، راه حل‌های شی: پروژهٔ شی گرا.[۶] ۱۹۹۹، فرایند توسعه نرم‌افزار متحد. به همراه ایوار جاکوبسون و جیمز رامبورگ.[۷] ۲۰۰۰، دوره‌های آموزشی کامل یو ام‌ال. به همراه ایوار جاکوبسون و جیمز رامبورگ.[۸] ۲۰۰۴، راهنمای مرجع زبان مدل سازی متحد، چاپ دوم. به همراه ایوار جاکوبسون و جیمز رامبورگ.[۹] ۲۰۰۵، راهنمای کاربر زبان مدل سازی متحد، چاپ دوم. به همراه ایوار جاکوبسون و جیمز رامبورگ.[۱۰] ۲۰۰۷، آنالیز و طراحی شی گرا به همراه کاربردها.[۱۱]

44 end


Download ppt "Advanced Programming in Java"

Similar presentations


Ads by Google