Object Oriented Programming
Systems
An Overview
Object Oriented Analysis And
Design
•Software development process consists of analysis,
design, and implementation phases
...
Why OOPS ?
• To modularize software development , just like any other
engineering discipline
•To make software projects mo...
Programming Techniques
Unstructured Programming
Structured Programming
Modular Programming
Object-Oriented Programming
Modeling
Use Cases
A use case lists a sequence of actions that yields a result that is
of value to an actor
Abstract Data Type
OOPS
• A class specifies objects with the same behavior
•An instance of a class is an object that belongs to the given
cla...
An OO Program
A circle is a point and a radius
Class and Object concept
An object is characterized by its state, behavior, and identity
• The collection of all informati...
An object of circle is a kind of
point
If Logo is circle and triangle
Has-A relationship
Relationships between Classes
Three relationships are common among classes :
•Dependency (“uses”)
•Aggregation (“has”)
•In...
Dependency
• A class depends on another class if it manipulates objects of the
other class in any way.
•If a class can car...
Aggregation
•A class aggregates another if its objects contain objects of
the other class
•Aggregation is often informally...
Inheritance
A class inherits from another if it incorporates the
behavior of the other class
Inheritance
Inheritance
Inheritance tree
ASP.NET component
using System;
using System.Web.UI;
namespace MSPress.ServerControls
{
public class SimpleControl : Contr...
Re-using the component
<%@ Page language="C#" %>
<%@ Register TagPrefix="msp" NameSpace="MSPress.ServerControls"
Assembly=...
CRC Cards
A CRC card is an index card that describes a class, its high-
level responsibilities , and its collaborators
Polymorphism
Sample Program – Part 1
using System;
public class Control
{
public Control (string data) {Data = data; }
protected string...
Sample Program – Part 2
interface IValidate
{
bool Validate();
}
class SSN : Control, IValidate
{// Class starts here
cons...
Sample Program – Part 3
public SSN(string val) : base (val) {}
public bool Validate()
{
Console.WriteLine("[SSN.Validate] ...
Sample Program – Part 4
protected bool CorrectFormat()
{bool correctFormat = true;
for (int i = 0; (correctFormat && i < d...
Sample Program – Part 5
protected bool IsDelimiterPosition(int i)
{
return (i==3 | i==6);
}
protected bool IsNumberPositio...
Sample Program – Part 6
class InterfacesApp
{ //Main class starts here
public static void Main(string[] args)
{
string dat...
Sample Program – Part 7
Console.WriteLine("[Main] Calling SSN.Validate");
bool success = val.Validate();
Console.WriteLine...
COM
Messages
.NET
.NET has 5 intrinsic types :
•Class
•Interface
•Struct
•Enum
•Delegate
A simple example of .NET
delegate – Part 1
' Our delegate type can point to any method
' taking two integers and returning...
A simple example of .NET
delegate – Part 2
'This class defines the methods that will be 'pointed to' by the delegate.
Publ...
A simple example of .NET
delegate – Part 3
Module Program
Sub Main()
Console.WriteLine("****** Simple Delegate Example****...
The Move from Two-Tier to N-
Tier Architecture
Stored Procedures for Business
Logic
Two Tier can be messy
Introducing middle tier
The ‘abilities’
Maintainability
Usability
Reliability
Scalability
Security
Integrity
Testability
Performance
Summary
Object Oriented systems are a way of engineering software
applications to achieve more consistency and
maintainabi...
Upcoming SlideShare
Loading in...5
×

Object oriented programming systems

632

Published on

Useful for Microsoft.NET training induction programs

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
632
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Object oriented programming systems

  1. 1. Object Oriented Programming Systems An Overview
  2. 2. Object Oriented Analysis And Design •Software development process consists of analysis, design, and implementation phases •The goal of the analysis phase is a complete description of what the software product should do •The goal of object-oriented design is the identification of classes, their responsibilities, and the relationships among them •The goal of the implementation phase is the programming, testing, and deployment of the software product
  3. 3. Why OOPS ? • To modularize software development , just like any other engineering discipline •To make software projects more manageable and predictable •For better maintainability, since software maintenance costs were more than the development costs. •For more reuse of code and to prevent the ‘reinvention of the wheel’ every time
  4. 4. Programming Techniques Unstructured Programming
  5. 5. Structured Programming
  6. 6. Modular Programming
  7. 7. Object-Oriented Programming
  8. 8. Modeling
  9. 9. Use Cases A use case lists a sequence of actions that yields a result that is of value to an actor
  10. 10. Abstract Data Type
  11. 11. OOPS • A class specifies objects with the same behavior •An instance of a class is an object that belongs to the given class •Class names should be nouns in the singular form •To discover responsibilities , look for verbs in the problem description. •A responsibility must belong to exactly one class
  12. 12. An OO Program
  13. 13. A circle is a point and a radius
  14. 14. Class and Object concept An object is characterized by its state, behavior, and identity • The collection of all information held by an object is its state •The behavior of an object is defined by the operations or methods that an object supports •The unique reference (or name) of an object is its identity
  15. 15. An object of circle is a kind of point
  16. 16. If Logo is circle and triangle
  17. 17. Has-A relationship
  18. 18. Relationships between Classes Three relationships are common among classes : •Dependency (“uses”) •Aggregation (“has”) •Inheritance (“is”)
  19. 19. Dependency • A class depends on another class if it manipulates objects of the other class in any way. •If a class can carry out all its tasks without being aware that the other class even exists, then it doesn’t use that class. •For example, if there is a Message class which uses the System.Print class, then the Message class is dependant , or coupled with the System.Print class
  20. 20. Aggregation •A class aggregates another if its objects contain objects of the other class •Aggregation is often informally described as the ‘has-a’ relationship
  21. 21. Inheritance A class inherits from another if it incorporates the behavior of the other class
  22. 22. Inheritance
  23. 23. Inheritance
  24. 24. Inheritance tree
  25. 25. ASP.NET component using System; using System.Web.UI; namespace MSPress.ServerControls { public class SimpleControl : Control { protected override void Render(HtmlTextWriter writer) { writer.Write("I don't do anything useful. "); writer.Write("but at least i'm a control...."); } } }
  26. 26. Re-using the component <%@ Page language="C#" %> <%@ Register TagPrefix="msp" NameSpace="MSPress.ServerControls" Assembly="SimpleControl.cs" %> <HTML> <body> <br> Here is the output from our first custom control <br> <msp:SimpleControl id="simple1" runat="server" /> <br> </body>
  27. 27. CRC Cards A CRC card is an index card that describes a class, its high- level responsibilities , and its collaborators
  28. 28. Polymorphism
  29. 29. Sample Program – Part 1 using System; public class Control { public Control (string data) {Data = data; } protected string data; public string Data { get { return data ; } set { data = value; } } }
  30. 30. Sample Program – Part 2 interface IValidate { bool Validate(); } class SSN : Control, IValidate {// Class starts here const char DELIMITER = '-';
  31. 31. Sample Program – Part 3 public SSN(string val) : base (val) {} public bool Validate() { Console.WriteLine("[SSN.Validate] : Validating '{0}'", data); return (11 == data.Length) && (CorrectFormat()); }
  32. 32. Sample Program – Part 4 protected bool CorrectFormat() {bool correctFormat = true; for (int i = 0; (correctFormat && i < data.Length); i++) { correctFormat =((IsDelimiterPosition(i) && data[i] == DELIMITER)|| (IsNumberPosition(i)&& char.IsNumber(data[i]))); } return correctFormat; }
  33. 33. Sample Program – Part 5 protected bool IsDelimiterPosition(int i) { return (i==3 | i==6); } protected bool IsNumberPosition (int i) { return (i !=3 && i != 6); } } //class SSN : Control, IValidate ends here
  34. 34. Sample Program – Part 6 class InterfacesApp { //Main class starts here public static void Main(string[] args) { string data = ""; if (0 < args.GetLength(0)) data = args[0]; SSN ssn = new SSN(data); IValidate val = (IValidate)ssn;
  35. 35. Sample Program – Part 7 Console.WriteLine("[Main] Calling SSN.Validate"); bool success = val.Validate(); Console.WriteLine("[Main] The validation of " + "SSN '{0}' was {1}successful", ssn.Data, (true == success ? "" : "NOT ")); } } //Main class ends here
  36. 36. COM
  37. 37. Messages
  38. 38. .NET .NET has 5 intrinsic types : •Class •Interface •Struct •Enum •Delegate
  39. 39. A simple example of .NET delegate – Part 1 ' Our delegate type can point to any method ' taking two integers and returning an integer. Public Delegate Function BinaryOp(ByVal x As Integer, ByVal y As Integer) As Integer
  40. 40. A simple example of .NET delegate – Part 2 'This class defines the methods that will be 'pointed to' by the delegate. Public Class SimpleMath Public Shared Function Add(ByVal x As Integer, ByVal y As Integer) As Integer Return x + y End Function Public Shared Function Subtract(ByVal x As Integer, ByVal y As Integer) As Integer Return x - y End Function End Class
  41. 41. A simple example of .NET delegate – Part 3 Module Program Sub Main() Console.WriteLine("****** Simple Delegate Example*******") 'Make a delegate object and add method to invocation 'list using the AddressOf keyword. Dim b As BinaryOp = New BinaryOp(AddressOf SimpleMath.Add) 'Invoke the method 'pointed to' Console.WriteLine("10 + 10 is {0}", b(10, 10)) Console.ReadLine() End Sub End Module
  42. 42. The Move from Two-Tier to N- Tier Architecture
  43. 43. Stored Procedures for Business Logic
  44. 44. Two Tier can be messy
  45. 45. Introducing middle tier
  46. 46. The ‘abilities’ Maintainability Usability Reliability Scalability Security Integrity Testability Performance
  47. 47. Summary Object Oriented systems are a way of engineering software applications to achieve more consistency and maintainability .
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×