Tuesday, March 16, 2021

Advanced Software Engineering Software Reuse

 


Advanced Software Engineering

Software ReuseCS 530 - 

Reference: Sommerville, Software Engineering, 10 ed., Chapter 15

 

The big picture

In most engineering disciplines, systems are designed by composing existing components that have been used in other systems. Software engineering has been more focused on original development but it is now recognized that to achieve better software, more quickly and at lower cost, we need a design process that is based on systematic software reuse. There has been a major switch to reuse-based development over the past 10 years.

Scale of software reuse:

  • System reuse: Complete systems, which may include several application programs.
  • Application reuse: An application may be reused either by incorporating it without change into other or by developing application families.
  • Component reuse: Components of an application from sub-systems to single objects may be reused.
  • Object and function reuse: Small-scale software components that implement a single well-defined object or function may be reused.

Benefits of software reuse:

  • Accelerated development: Bringing a system to market as early as possible is often more important than overall development costs. Reusing software can speed up system production because both development and validation time may be reduced.
  • Effective use of specialists: Instead of doing the same work over and over again, application specialists can develop reusable software that encapsulates their knowledge.
  • Increased dependability: Reused software, which has been tried and tested in working systems, should be more dependable than new software. Its design and implementation faults should have been found and fixed.
  • Lower development costs: Development costs are proportional to the size of the software being developed. Reusing software means that fewer lines of code have to be written.
  • Reduced process risk: The cost of existing software is already known, whereas the costs of development are always a matter of judgment. This is an important factor for project management because it reduces the margin of error in project cost estimation. This is particularly true when relatively large software components such as subsystems are reused.
  • Standards compliance: Some standards, such as user interface standards, can be implemented as a set of reusable components. For example, if menus in a user interface are implemented using reusable components, all applications present the same menu formats to users. The use of standard user interfaces improves dependability because users make fewer mistakes when presented with a familiar interface.

Problems with software reuse:

  • Creating, maintaining, and using a component library: Populating a reusable component library and ensuring the software developers can use this library can be expensive. Development processes have to be adapted to ensure that the library is used.
  • Finding, understanding, and adapting reusable components: Software components have to be discovered in a library, understood and, sometimes, adapted to work in a new environment. Engineers must be reasonably confident of finding a component in the library before they include a component search as part of their normal development process.
  • Increased maintenance costs: If the source code of a reused software system or component is not available then maintenance costs may be higher because the reused elements of the system may become increasingly incompatible with system changes.
  • Lack of tool support: Some software tools do not support development with reuse. It may be difficult or impossible to integrate these tools with a component library system. The software process assumed by these tools may not take reuse into account. This is particularly true for tools that support embedded systems engineering, less so for object-oriented development tools.
  • Not-invented-here syndrome: Some software engineers prefer to rewrite components because they believe they can improve on them. This is partly to do with trust and partly to do with the fact that writing original software is seen as more challenging than reusing other people's software.

The reuse landscape

Although reuse is often simply thought of as the reuse of system components, there are many different approaches to reuse that may be used. Reuse is possible at a range of levels from simple functions to complete application systems. The reuse landscape covers the range of possible reuse techniques.

Key factors for reuse planning:

  • The development schedule for the software.
  • The expected software lifetime.
  • The background, skills and experience of the development team.
  • The criticality of the software and its non-functional requirements.
  • The application domain.
  • The execution platform for the software.

Application frameworks

Frameworks are moderately large entities that can be reused. They are somewhere between system and component reuse. Frameworks are a sub-system design made up of a collection of abstract and concrete classes and the interfaces between them. The sub-system is implemented by adding components to fill in parts of the design and by instantiating the abstract classes in the framework.

Application frameworks are moderately large entities that can be reused. They are somewhere between system and component reuse. Frameworks are a sub-system design made up of a collection of abstract and concrete classes and the interfaces between them. The sub-system is implemented by adding components to fill in parts of the design and by instantiating the abstract classes in the framework.

Web application frameworks (WAF) support the construction of dynamic websites as a front-end for web applications. WAFs are now available for all of the commonly used web programming languages e.g. Java, Python, Ruby, etc. Interaction model is based on the Model-View-Controller composite design pattern. An MVC framework supports the presentation of data in different ways and allows interaction with each of these presentations. When the data is modified through one of the presentations, the system model is changed and the controllers associated with each view update their presentation.

WAF features:

  • Security: WAFs may include classes to help implement user authentication (login) and access.
  • Dynamic web pages: Classes are provided to help you define web page templates and to populate these dynamically from the system database.
  • Database support: The framework may provide classes that provide an abstract interface to different databases.
  • Session management: Classes to create and manage sessions (a number of interactions with the system by a user) are usually part of a WAF.
  • User interaction: Most web frameworks now provide AJAX support, which allows more interactive web pages to be created.

Frameworks are generic and are extended to create a more specific application or sub-system. They provide a skeleton architecture for the system. Extending the framework involves Adding concrete classes that inherit operations from abstract classes in the framework; Adding methods that are called in response to events that are recognized by the framework. Problem with frameworks is their complexity which means that it takes a long time to use them effectively.

Software product lines

Software product lines or application families are applications with generic functionality that can be adapted and configured for use in a specific context. A software product line is a set of applications with a common architecture and shared components, with each application specialized to reflect different requirements. Examples: a mobile operating system that works on different hardware models, a software line for a family of printers with varying features. Adaptation of a software line may involve:

  • Component and system configuration;
  • Adding new components to the system;
  • Selecting from a library of existing components;
  • Modifying components to meet new requirements.

The base application of a software product line includes:

  • Core components that provide infrastructure support. These are not usually modified when developing a new instance of the product line.
  • Configurable components that may be modified and configured to specialize them to a new application. Sometimes, it is possible to reconfigure these components without changing their code by using a built-in component configuration language.
  • Specialized, domain-specific components some or all of which may be replaced when a new instance of a product line is created.

Application frameworks vs product lines:

  • Application frameworks rely on object-oriented features such as polymorphism to implement extensions. Product lines need not be object-oriented (e.g. embedded software for a mobile phone)
  • Application frameworks focus on providing technical rather than domain-specific support. Product lines embed domain and platform information.
  • Product lines often control applications for equipment.
  • Software product lines are made up of a family of applications, usually owned by the same organization.

Product line architectures must be structured in such a way to separate different sub-systems and to allow them to be modified. The architecture should also separate entities and their descriptions and the higher levels in the system access entities through descriptions rather than directly.

Various types of specialization of a software product line may be developed:

  • Different versions of the application are developed for different platforms.
  • Different versions of the application are created to handle different operating environments e.g. different types of communication equipment.
  • Different versions of the application are created for customers with different functional requirements.
  • Different versions of the application are created to support different business processes.

Software product lines are designed to be reconfigurable. This configuration may occur at different stages in the development process:

  • Design time configuration: The organization that is developing the software modifies a common product line core by developing, selecting or adapting components to create a new system for a customer.
  • Deployment time configuration: A generic system is designed for configuration by a customer or consultants working with the customer. Knowledge of the customer's specific requirements and the system's operating environment is embedded in configuration data that are used by the generic system.

Application system reuse

An application system product is a software system that can be adapted for different customers without changing the source code of the system. Application systems have generic features and so can be used/reused in different environments. Application system products are adapted by using built-in configuration mechanisms that allow the functionality of the system to be tailored to specific customer needs.

Benefits of application system reuse:

  • As with other types of reuse, more rapid deployment of a reliable system may be possible.
  • It is possible to see what functionality is provided by the applications and so it is easier to judge whether or not they are likely to be suitable.
  • Some development risks are avoided by using existing software. However, this approach has its own risks, as I discuss below.
  • Businesses can focus on their core activity without having to devote a lot of resources to IT systems development.
  • As operating platforms evolve, technology updates may be simplified as these are the responsibility of the COTS product vendor rather than the customer.

Problems of application system reuse:

  • Requirements usually have to be adapted to reflect the functionality and mode of operation of the COTS product.
  • The COTS product may be based on assumptions that are practically impossible to change.
  • Choosing the right COTS system for an enterprise can be a difficult process, especially as many COTS products are not well documented.
  • There may be a lack of local expertise to support systems development.
  • The COTS product vendor controls system support and evolution.

Configurable application systems are generic application systems that may be designed to support a particular business type, business activity or, sometimes, a complete business enterprise. For example, an application system may be produced for dentists that handles appointments, dental records, patient recall, etc. Domain-specific systems, such as systems to support a business function (e.g. document management) provide functionality that is likely to be required by a range of potential users.

An Enterprise Resource Planning (ERP) system is a generic system that supports common business processes such as ordering and invoicing, manufacturing, etc. These are very widely used in large companies - they represent probably the most common form of software reuse. The generic core is adapted by including modules and by incorporating knowledge of business processes and rules. A number of modules to support different business functions. A defined set of business processes, associated with each module, which relate to activities in that module. A common database that maintains information about all related business functions. A set of business rules that apply to all data in the database.

Key elements of an ERP system architecture:

  • A number of modules to support different business functions.
  • A defined set of business processes, associated with each module, which relate to activities in that module.
  • A common database that maintains information about all related business functions.
  • A set of business rules that apply to all data in the database.

An ERP system configuration usually involves:

  • Selecting the required functionality from the system.
  • Establishing a data model that defines how the organization's data will be structured in the system database.
  • Defining business rules that apply to that data.
  • Defining the expected interactions with external systems.
  • Designing the input forms and the output reports generated by the system.
  • Designing new business processes that conform to the underlying process model supported by the system.
  • Setting parameters that define how the system is deployed on its underlying platform.

Integrated application systems

Integrated application systems are applications that include two or more application system products and/or legacy application systems. You may use this approach when there is no single application system that meets all of your needs or when you wish to integrate a new application system with systems that you already use. To develop integrated application systems, you have to make a number of design choices:

  • Which individual application systems offer the most appropriate functionality? Typically, there will be several application system products available, which can be combined in different ways.
  • How will data be exchanged? Different products normally use unique data structures and formats. You have to write adaptors that convert from one representation to another.
  • What features of a product will actually be used? Individual application systems may include more functionality than you need and functionality may be duplicated across different products.

Application system integration can be simplified if a service-oriented approach is used. A service-oriented approach means allowing access to the application system's functionality through a standard service interface, with a service for each discrete unit of functionality. Some applications may offer a service interface but, sometimes, this service interface has to be implemented by the system integrator. You have to program a wrapper that hides the application and provides externally visible services.

Application system integration problems:

  • Lack of control over functionality and performance: application systems may be less effective than they appear
  • Problems with application system inter-operability: different application systems may make different assumptions that means integration is difficult
  • No control over system evolution: application system vendors not system users control evolution
  • Support from system vendors: application system vendors may not offer support over the lifetime of the product

Saturday, March 13, 2021

How To Connect SQL Database In ASP.NET Using C# And Insert And View The Data Using Visual Studio 2015

How To Connect SQL Database In ASP.NET Using C# And Insert And View The Data Using Visual Studio 2015




Introduction
This article explains how to connect the SQL database into ASP.net using C# language and how to insert and view the data, using Visual Studio 2015 Update 3.

Requirements
Visual Studio 2015 Update 3ASP.NET 4.5.2SQL Server
If you want to connect to the SQL database into ASP.NET, using C#, it should follow the steps given below.
Step 1
Now, Open Visual Studio 2015 Update 3, go to the File >> New >> Project or use the shortcut key "Ctrl+Shift +N".
Step 2
Here, select Visual C# >> Web >> ASP.NET Web Application. Finally, click "OK" button.
Step 3
Here, you can select the template for your ASP.NET Application. We are choosing "Empty" here. Now, click OK button.
Step 4
Now, open the project and look for the Solution Explorer.  Here, open the default .aspx. If you want a Webform, you can add the page (Web Form). Add+New item (Ctrl+Shift+A). Now, we can create a login page, using ASP.NET code. You need to follow the drag and drop method. Here, we already created the login page.
Step 5      
Now, open the project. If you want a SQL Server database, you can add the page (SQL Server database). Add+New item (Ctrl+Shift+A).Here, you can select Visual C# and choose SQL Server database. Afterwards, click "OK" button.
 Here, open the new Window and click YES button. 
 Now, add this to the database in our project.
 Step 6
Now, we can go to the Server Explorer and add your database. You can click the Tables and afterwards, click Add New Table.
 Now, open the new table and you can fill the data, which is like (studentname, password) and afterwards, you click the Update .
 Here, click database in update and subsequently click update the database.
 Here, the database is updated.
Here, the database and data are added.
Now, we can click  on the right click and click Show Table Data. 
 Now, the data is stored. 
 Step 7 
Now, you can add SQL Data Source. Drag and drop method. Here, click Configure Data Source
 Now, we can choose your database and click NEXT button. 
Now, you can select the ConnectionString and Click NEXT button
Now, we can choose Specify columns from a table or view and afterwards, click Next button.
Now, click Test Query.
Here, add the data and click Finish button.
 Step 8Now, you can go to CS(C# code) page and you will write the C# code. 

https://www.c-sharpcorner.com/article/how-to-connect-sql-database-in-asp-net-using-c-sharp-and-insert-and-view-the-data-usi/



Thursday, March 11, 2021

BFS and DFS

 

Breath-first search (BFS) is an algorithm used for tree traversal on graphs or tree data structures. BFS can be easily implemented using recursion and data structures like dictionaries and lists.

The Algorithm

Pick any node, visit the adjacent unvisited vertex, mark it as visited, display it, and insert it in a queue.
If there are no remaining adjacent vertices left, remove the first vertex from the queue.
Repeat step 1 and step 2 until the queue is empty or the desired node is found.

Depth-first search (DFS), is an algorithm for tree traversal on graph or tree data structures. It can be implemented easily using recursion and data structures like dictionaries and sets.











The Algorithm

  1. Pick any node. If it is unvisited, mark it as visited and recur on all its adjacent nodes.
  2. Repeat until all the nodes are visited, or the node to be searched is found.

Here you will learn about difference between BFS and DFS algorithm or BFS vs. DFS.

Breadth First Search (BFS) and Depth First Search (DFS) are two popular algorithms to search an element in Graph or to find whether a node can be reachable from root node in Graph or not. And these are popular traversing methods also.

When we apply these algorithms on a Graph, we can see following types of nodes.

  1. Non-Visited nodes: These nodes not yet visited.
  2. Visited nodes: These nodes are visited.
  3. Explored nodes: A node is said to be explored when it was visited and all nodes which are connected (adjacent) to that node also visited.

Difference between BFS and DFS

S. No.Breadth First Search (BFS)Depth First Search (DFS)
1.BFS visit nodes level by level in Graph.DFS visit nodes of graph depth wise. It visits nodes until reach a leaf or a node which doesn’t have non-visited nodes.
2.A node is fully explored before any other can begin.Exploration of a node is suspended as soon as another unexplored is found.
3.Uses Queue data structure to store Un-explored nodes.Uses Stack data structure to store Un-explored nodes.
4.BFS is slower and require more memory.DFS is faster and require less memory.
5.Some Applications:

  • Finding all connected components in a graph.
  • Finding the shortest path between two nodes.
  • Finding all nodes within one connected component.
  • Testing a graph for bipartiteness.
Some Applications:

  • Topological Sorting.
  • Finding connected components.
  • Solving puzzles such as maze.
  • Finding strongly connected components.
  • Finding articulation points (cut vertices) of the graph.

Example

Considering A as starting vertex.

Difference between BFS and DFS








java 



Monday, March 8, 2021

مرجع للرسم بالحاسب Computer Graphics


موقع مرجع للرسم بالحاسب 



Introduction

  1. Applications of Computer Graphics
  2. Computer Graphics and Image Processing
    The fields of computer graphics and image procesing are blending together more each year.
  3. Computer Graphics -- create pictures and images, synthesize them on the basis of some description, or model in a computer
  4. Image Processing -- improve or alter images that were created elsewhere
     

  5. Art, Entertainment, and publishing
    movie production, animation, special effects

    browsing on the World Wide Web
    slide, book, and magazine design

  6. Video Games
    latest computer graphics technologies are rapidly incorporated into latest video games

     
    Warcraft Halo 3
  7. Monitoring a Process



  8. Displaying Simulations
    e.g. virtual reality


  9. Computer-aided Design
    e.g. Computer-aided Architectural Design, Electrical Circuit Design

  10. Scientific Analysis and Visualization
    presenting scientific information in the right way let you gain new insights into the investigating process

  11. Eduction Animation

  12. Digital shape sampling and processing (DSSP)
    DSSP describes the ability to use scanning hardware and processing software to digitally capture physical objects and automatically create accurate 3D models with associated structural properties for design, engineering, inspection and custom manufacturing. What digital signal processing (DSP) is to audio, DSSP is to 3D geometry.

    A Perceptron laser scanner scanned the original fan blade, and generated a point cloud with around 2.2 million points that was brought into DSSP software.

    DSSP software was used to automatically generate a NURBS surface model, which could be imported into Pro/ENGINEER software.

    see http://www.geomagic.com/en

  13. Video Compression
      MPEG-4 Visual specifies support for animated face and body models within the Simple Face Animation and simple FBA ( Face and Body A nimation )

      a face model described by Facial Definition Parameters ( FDPs ) and animated using Facial Animation Parameters ( FAPs ).
      body is described by body animation parameters ( BAP )

      See also http://coven.lancs.ac.uk/mpeg4/


  14. What is OpenGL?
  15. Application programming interface ( API )
    a collection of routines that the programmer can call, along with a model of how the routines work together to produce graphics
    250 distinct commands ( about 200 core, 50 utility )  

  16. Device-independent graphics programming
    • produce nearly identical outputs in various hardware platforms
    • no user-input commands in core
    • no high-level commands for 3-D objects, one must build model from primitives -- points, lines, and polygons
    • OpenGL Utility Library ( GLU ) provides many modeling features,

  17. Basics of OpenGL Code
  18. Rendering -- the process by which a computer creates images from models.
  19. Models or objects are constructed from geometric primitives such as points, lines, polylines, polygons which are defined by one or more vertices.
  20. Functions calls between glBegin() and glEnd()
  21. Example -- drawing 3 points
    glBegin( GL_POINTS );
    glVertex2i( 100, 40 );
    glVertex2i( 120, 50 );
    glEnd();
    glVertex2i( 140, 80 );
    glVertex2i(...)
    gl
    gl
    library  
    Vertex
    basic
    command  
    2
    number of
    arguments  
    i
    type of
    arguments  

  22. Data Types:
    Suffix   Data TypeCorresponding  
    C type
    OpenGL Type  
    Deinfition
    b8-bit Integersigned charGLbyte
    s16-bit IntegershortGLshort
    i32-bit Integerint or longGLint, GLsizei
    f32-bit Floating-pointfloatGLfloat, GLclampf
    d64-bit IntegerdoubleGLdouble, GLclampd
    ub8-bit Unsigned Integerunsigned charGLubyte, GLboolean
    us16-bit Unsigned Integersigned shortGLushort
    ui32-bit Unsigned Integer   unsigned int or
    unsigned long
    GLuint, GLenum, GLbitfield
      glVertex2i ( 7, 11 );
      glVertex2f ( 7.0, 11.0 );
      are the same

  23. Number of Arguments: 2, 3, 4

  24. Formats:
    • 'v' indicates vector format
    • absence of 'v' indicates scalar format
    • Example:
      glColor3f( 1.0, 0.0, 0.0 );

      GLfloat color_array[] = {1.0, 0.0, 0.0};
      glColor3fv( color_array );

  25. The Event Loop
    • OpenGL programs often run in an event loop.
    • After initialization, the program falls into an infinite loop accepting and handling events, such as displaying, mouse movement, window reshaping ..

  26. OpenGL as a State Machine
    • OpenGL can be viewed as a state machine.
    • state variables: color, line width, line stipple pattern, shading method, object positions ...
    • On-Off state variables
      can be set to GL_FALSE ( off ) or GL_TRUE ( on )
      glEnable ( .. ),       glDisable( .. )
      GL_LINE_SMOOTH -- if enabled draw lines with correct filtering, otherwise draw lines with aliasing
    • Mode state variables
      require command specific to the state variable in order to change it
      e.g. glShadeModel ( GL_SMOOTH ) -- smooth shading
          glShadeModel ( GL_FLAT ) -- flat shading ( default )
    • Value state variables
      require command specific to the state variable in order to change it
      e.g. glColor3f( 0.5, 0.5, 0.5 )

    • Query current state
      At any point, the programmer can query the system for any variable's current value. Typically, one of the four following commands is used glGetBooleanv(), glGetDoublev(), glGetFloatv(), or glGetIntegerv()
    • Save current state in stack
      A collection of state variables can be saved on an attribute stack.
      glPushAttrib()
      glPopAttrib()

  27. Demo Programs
    • Simple Drawing
      //draw.cpp : demo program for drawing 3 dots, two lines, ploylines, rectangles
      #include <GL/glut.h>
      
      //initialization
      void init( void )
      {
        glClearColor( 1.0, 1.0, 1.0, 0.0 );	//get white background color
        glColor3f( 0.0f, 0.0f, 0.0f );	//set drawing color
        glPointSize( 4.0 );			//a dot is 4x4
        glMatrixMode( GL_PROJECTION );	//subsequent calls affect projection matrices
        glLoadIdentity();			//replace current matrix with identity matrix
        gluOrtho2D( 0.0, 500.0, 0.0, 500.0 );
      }
      
      void display( void )
      {
        glClear( GL_COLOR_BUFFER_BIT );	//clear screen
        glBegin( GL_POINTS );			//draw points
          glVertex2i( 100, 50 );		//draw a point
          glVertex2i( 100, 150 );		//draw a point
          glVertex2i( 200, 200 );		//draw a point
        glEnd();
        glBegin( GL_LINES );			//draw lines
          glVertex2i( 20, 20 );		//horizontal line
          glVertex2i( 400, 20 );
          glVertex2i( 20, 10 );		//vertical line
          glVertex2i( 20, 400 );
        glEnd();
        glBegin( GL_LINE_STRIP );		//draw polyline
          glVertex2i( 200, 100 );
          glVertex2i( 300, 100 );
          glVertex2i( 450, 200 );
          glVertex2i( 200, 100 );
        glEnd();
        glColor3f( 0.6, 0.6, 0.6 );		//bright grey
        glRecti( 400, 400, 450, 480 );
        glColor3f( 1.0, 0.0, 0.0 );		//red
        glRecti( 350, 350, 380, 390 );
      
        glFlush();				//send all output to screen
      }
      ------------------------------------------------------------------------------
      
      //draw_main.cpp: main loop of drawing program
      
      #include <GL/glut.h>
      #include <math.h>
      #include <stdlib.h>
      #include <stdio.h>
      
      //initialization
      void init(void);
      //does the drawing 
      void display(void);
      
      /*  Main Loop
       *  Open window with initial window size, title bar, 
       *  RGBA display mode, depth buffer.
       */
      int main(int argc, char** argv)
      {
        glutInit(&argc, argv);	//initialize toolkit
        glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB );	//set display mode: single bufferring, RGBA model
        glutInitWindowSize(500, 500);		//set window size on screen
        glutInitWindowPosition( 100, 150 ); 	//set window position on screen
        glutCreateWindow(argv[0]);		//open screen window
        init();
        glutDisplayFunc (display);		//points to display function
        glutMainLoop();			//go into perpetual loop
        return 0;
      }


      -------------------------------
      How to Install Dev-C++ and the GLUT Libraries for Compiling OpenGL Programs with ANSI C