Review 210.Ppt

Embed Size (px)

Citation preview

  • 8/6/2019 Review 210.Ppt

    1/25

    CSci 210 -- Advanced Software Paradigms Exam Review

    A. Bellaachia

    Department of Computer Science

    School of Engineering and Applied Science

    The George Washington University

    Washington, DC 20052

  • 8/6/2019 Review 210.Ppt

    2/25

    Csci 210 -- A. Bellaachia

    2

    Introduction

    Software Development Process Language and Computer Architecture Language paradigms Language Evaluation Criteria:

    ReadabilityExamples: Data type, data structures, and control statements

    Writability Reliability

    Type checkingException handlingAliasing

    Maintainability Cost

  • 8/6/2019 Review 210.Ppt

    3/25

    Csci 210 -- A. Bellaachia

    3

    Software Paradigms Five Software Paradigms

    AP: Algorithmic Paradigm AP assumes problem is well structured application = program to map input to output finite number of steps, no errors

    ASE: Analysis-Synthesis-Evaluation like Waterfall Model assumes problem is well structured It uses problem decomposition

    FD: Formal Design FD assumes problem is well structured It is a refinement of ASE, but uses abstractionproblem becomes a mathematical proposition

    AI: Artificial Intelligence It is explicitly founded on the concepts ofsearch, knowledge and heuristics It does not assume problem is well structured

    TED: Theory of Evolutionary Design It uses the fast that software design is an evolutionary process It does not assume problem is well structured

    Nothing is fixed, everything can evolve

  • 8/6/2019 Review 210.Ppt

    4/25

    Csci 210 -- A. Bellaachia

    4

    Software Architecture Paradigms

    Architectural ElementsProcessing elementsConnecting elementsData ElementsConfiguration file

  • 8/6/2019 Review 210.Ppt

    5/25

    Csci 210 -- A. Bellaachia

    5

    Software Architecture Paradigms (Cont.) Architectural Styles (major ones)

    Dataflow Systems Pipelines

    Each layer is client for layer below it output of one stage = input to next Example: Compilers

    Call & Return Systems Layered

    Each layer is client for layer below it advantages: incremental, extendable N-tier / Client-Server layers can be developed independently Examples: Operating Systems, Web-based applications

    Independent-Process Communicating Processes:

    Using CSP to describe different process topologies Repository

    Blackboard central repository for shared info 3 components knowledge source, controller, repository (blackboard) Example: no one single answer fingerprints

    Architecture Evaluation: Good Structure Cohesion Coupling

  • 8/6/2019 Review 210.Ppt

    6/25

    Csci 210 -- A. Bellaachia

    6

    DSSA

    Requirement analysis and software architecture of a domain ofapplications.

    Examples: Wed browsers, Web servers, Word processors, etc. There are three main elements of a DSSA:

    Domain ModelComplete description of the domainAchieved by experts in the domain, users, developers who have experience

    in the domain, etc.

    Reference RequirementsStable (or Fix)Variable (or optional)Requirements can also be broken into:

    Functional, Non-functional, Design, ImplementationList a reference of each requirement of the domain.

    Reference ArchitectureMake sure to state the right architecture style for the domain.List a reference of each architectural element.

  • 8/6/2019 Review 210.Ppt

    7/25

    Csci 210 -- A. Bellaachia

    7

    Components

    Why use components? Major elements of a component: Specification

    One or more implementations Component Model:

    Each of these component models addresses the following issues: How a component makes its services available to others? How component are named? How new components and their services are discovered at runtime.

    A packaging approach: Example: 2EE application is packaged as an Enterprise ARchive (EAR) file, a

    standard Java JAR file with an .ear extension.

    A deployment approach: J2EE uses deployment descriptors that are defined as in XML files named ejb-

    jar.xml.

    Component Architecture Blackbox vs. Whitebox Components vs. Objects Components in industry verses in-house solutions Component disadvantages

  • 8/6/2019 Review 210.Ppt

    8/25

    Csci 210 -- A. Bellaachia

    8

    Design Patterns

    Definitions What is a Pattern? Categories of Patterns Pattern Characteristics Essential Elements of a Design Pattern Examples of design patterns:

    SingletonAdapterStrategy

    Design Pattern Selection How to Use a Design Pattern? Idioms

  • 8/6/2019 Review 210.Ppt

    9/25

    Csci 210 -- A. Bellaachia

    9

    Frameworks

    DefinitionsFrameworksClassificationFrameworks EvaluationExamples

  • 8/6/2019 Review 210.Ppt

    10/25

    Csci 210 -- A. Bellaachia

    10

    Basic of Programming Languages

    Built-in Types and Primitive Types Data Aggregates and Type Constructors Constructors User-defined Types and Abstract Data Types Strong Typing & Type Checking Type Compatibility Type Conversion Type and Subtypes Generic Types Monomorphic versus Polymorphic The Type Structure of Representative languages Implementation Models Implementation of Structured Types

  • 8/6/2019 Review 210.Ppt

    11/25

    Csci 210 -- A. Bellaachia

    11

    Object-Oriented Programming

    Object-oriented characteristics: Object Definition and instance creation Encapsulation

    Inheritance Polymorphism: Polymorphism (Greek for many

    forms) means that the same operation can bedefined for many different classes, and each can beimplemented in their different way.

    Binding in OOP: Static vs. Dynamics

    Implementation of OO constructs

  • 8/6/2019 Review 210.Ppt

    12/25

    Csci 210 -- A. Bellaachia

    12

    Functional Programming

    Functional programming characteristics Functions in FP: composition, Apply-to-all, etc. Performance

  • 8/6/2019 Review 210.Ppt

    13/25

    Csci 210 -- A. Bellaachia

    13

    Logic Programming

    Logic programming characteristics:based on relations. Horn clause

    User query processing: Resolution Unification

    Performance

  • 8/6/2019 Review 210.Ppt

    14/25

    Csci 210 -- A. Bellaachia

    14

    Concurrency

    Concurrency requirements Problems with concurrency: Deadlock Starvation Etc.

    Process Interactions Syntax for parallel processes Independent processes Competing processes (Critical sections) Communicating processes (May need to communicate)

    Low-level Concurrency Primitives Process creation and control: Event: Event-wait(e) and Event-signal(e) Messages: Remote Procedure Calls (RPCs)

    Synchronization Semaphores, Monitors, etc.

    Concurrency in Java.

  • 8/6/2019 Review 210.Ppt

    15/25

    Csci 210 -- A. Bellaachia

    15

    Sample Question

    Problem :In this problem, we would like to define a DSSA for web serverapplications such as Apache and Internet Information Server (IIS).The major operations of a web server include the following:

    A resource handler to determine the type of operation requested by a browser. Interpretation of a request protocol such as the HTTP protocol. An operation, called Access Control, to enforce access rule employed by the

    server.

    A request analysis operation to translate the location of the resource (URL)from a network location to a local file name.

    A web server has also the ability to gather information (log) about all therequests and their results.

    Provide a complete DSSA for this type of applications.

  • 8/6/2019 Review 210.Ppt

    16/25

    Csci 210 -- A. Bellaachia

    16

    Sample Question

    Problem:State the major software paradigms that can be

    examined during the steps of the software life

    cycle of an application and explain why.

  • 8/6/2019 Review 210.Ppt

    17/25

    Csci 210 -- A. Bellaachia

    17

    Sample Question

    Problem:Component-based software development greatly

    depends on an efficient component integration

    strategy. You have been hired by a company and

    you are asked to develop a component-based

    system.

    (a) What are the issues that you need to

    address in your design?

  • 8/6/2019 Review 210.Ppt

    18/25

    Csci 210 -- A. Bellaachia

    18

    Sample Question

    Problem:Give an architectural description in CSP for the

    following architecture:

    M0

    F3 F4

    M3

    F1 F2 O1

    M2 M5

    M4M1

  • 8/6/2019 Review 210.Ppt

    19/25

    Csci 210 -- A. Bellaachia

    19

    Sample Question

    Problem:(a) Describe why you would use design patterns

    in your application.

    (b) Give an example of a design pattern and show

    how you would use it for a specific application.

    State clearly your application.

  • 8/6/2019 Review 210.Ppt

    20/25

    Csci 210 -- A. Bellaachia

    20

    Sample Questions: Different Paradigms

    What the major design decisions you need to consider for: Object-oriented programming

    Requirements of OOPPolymorphismClass Instance Record (CIR)

    FPRequirements of FPBe familiar with Scheme: be able to understand scheme code

    LP:Requirements of LPResolution algorithmUnificationQuery processing

    ConcurrencyRequirements of concurrency.

  • 8/6/2019 Review 210.Ppt

    21/25

    Csci 210 -- A. Bellaachia

    21

    Sample Question Problem:

    class A {

    public:

    int a;

    virtual void what(){ }

    virtual void who() { }

    };

    class B{

    public:int b

    virtual void what{ }

    };

    class C: public A, public B {

    public:

    int c;

    virtual void what(){ }virtual void who() { }

    virtual void dud() { }

    };

    Draw the Class Instance Record (CIR) of each class.

  • 8/6/2019 Review 210.Ppt

    22/25

    Csci 210 -- A. Bellaachia

    22

    Sample Question

    Problem:One of the programming language paradigms we havecovered is logic programming.

    1. Describe this paradigm and compare it to

    a programming language paradigm of yourchoice.

    2. Give detailed description of the different

    parts of a logic program.

    3. One of the drawbacks of logic programming is

    low performance. How would your enhance theefficiency of a logic programming compiler?

  • 8/6/2019 Review 210.Ppt

    23/25

    Csci 210 -- A. Bellaachia

    23

    Sample Question

    Problem:You are asked to extend a procedural language to

    become an object-oriented (OO) language.

    (1) State the OO features that you need to

    add to your procedural language

    (2) Explain how you would implement

    each of the features in (1)

  • 8/6/2019 Review 210.Ppt

    24/25

    Csci 210 -- A. Bellaachia

    24

    Sample Question

    Problem:Consider the following logic program: mother (mary, sue). mother (mary, bill). mother (sue, nancy). mother (sue, jeff). mother (jane, ron). father (john, sue). father (john, bill). father (bob, nancy). father (bob, jeff). Father(bill,ron). Parent(A,B) :- father(A,B). Parent (A,B) :- mother(A,B). Grandparent(C,D) :- parent(C,E), parent(E,D).

    Show the trace of the processing of the following queries:?- grandparent(Who, ron).

    Add a sibling relationship to the above program and answer the following question:

    ?- sibling(sue, X).

  • 8/6/2019 Review 210.Ppt

    25/25

    Csci 210 -- A. Bellaachia

    25

    G o o d L u c k