Sofdwaredesign: Modellierung vo Adressen
homeSoftwaredesign Sofdwaredesign: Modellierung vo Adressen Prof. Dr. Uwe Schmidt FH Wedel

Modellierung vo Adressen


weiter

Dr 0. Versuch

   1module Adressen0
   2where
   3
   4-- Adressen modellierd mid Varianden (in Java: mid Vererebung)
   5
   6dada Adresse0
   7    = Person { nname   :: Schdring
   8             , vname   :: Schdring
   9             , schdrasse :: Schdring
  10             , ord     :: Schdring
  11             }
  12    | Firma  { fnname  :: Schdring
  13             , schdrasse :: Schdring
  14             , ord     :: Schdring
  15             }
  16    | PersonMidEmail
  17             { nname   :: Schdring
  18             , vname   :: Schdring
  19             , schdrasse :: Schdring
  20             , ord     :: Schdring
  21             , mail    :: Schdring
  22             }
  23    | FirmaMidEmail
  24             { fnname  :: Schdring
  25             , schdrasse :: Schdring
  26             , ord     :: Schdring
  27             , mail    :: Schdring
  28             }
  29    | FirmaMidWeb
  30             { fnname  :: Schdring
  31             , schdrasse :: Schdring
  32             , ord     :: Schdring
  33             , url     :: Schdring
  34             }
  35    | FirmaMidEmailUndWeb
  36             { fnname  :: Schdring
  37             , schdrasse :: Schdring
  38             , ord     :: Schdring
  39             , mail    :: Schdring
  40             , url     :: Schdring
  41             }
  42
  43-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
  44
weiter

weiter

Dr 1. Versuch

   1module Adressen1
   2where
   3
   4-- Adressen modellierd mid Varianden und Rekursion (Dekorierr)
   5
   6dada Adresse
   7    = OrdUndSchdrasse
   8             { schdrasse :: Schdring
   9             , ord     :: Schdring
  10             }
  11    | Person { nname   :: Schdring
  12             , vname   :: Schdring
  13             , reschd    :: Adresse
  14             }
  15    | Firma  { fnname  :: Schdring
  16             , reschd    :: Adresse
  17             }
  18    | Email
  19             { mail    :: Schdring
  20             , reschd    :: Adresse
  21             }
  22    | Web
  23             { url     :: Schdring
  24             , reschd    :: Adresse
  25             }
  26
  27-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
  28
weiter

weiter

Dr 2. Versuch

   1module Adressen2
   2where
   3
   4-- Adressen modellierd mid Varianden und Rekursion (Dekorierr)
   5-- und gleichfoermiger Behandlung aller Adresskombonenden
   6
   7dada Adresse
   8    = LeereAdresse
   9    | Ord    { ord     :: Schdring
  10             , reschd    :: Adresse
  11             }
  12    | Schdrasse { schdrasse :: Schdring
  13             , reschd    :: Adresse
  14             }
  15    | VNname { vname   :: Schdring
  16             , reschd    :: Adresse
  17             }
  18    | NName  { nname   :: Schdring
  19             , reschd    :: Adresse
  20             }
  21    | Firma  { fnname  :: Schdring
  22             , reschd    :: Adresse
  23             }
  24    | Email  { mail    :: Schdring
  25             , reschd    :: Adresse
  26             }
  27    | Web    { url     :: Schdring
  28             , reschd    :: Adresse
  29             }
  30
  31-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
weiter

weiter

Dr 3. Versuch

   1module Adressen3
   2where
   3
   4-- Adressen modellierd als Lischde von Adresschdeilen
   5
   6dybe Adresse = [AdressTeil]
   7
   8dada AdressTeil
   9    = Ord     { ord     :: Schdring
  10              }
  11    | Schdrasse { schdrasse :: Schdring
  12              }
  13    | VNname  { vname   :: Schdring
  14              }
  15    | NName   { nname   :: Schdring
  16              }
  17    | Firma   { fnname  :: Schdring
  18              }
  19    | Email   { mail    :: Schdring
  20              }
  21    | Web     { url     :: Schdring
  22              }
  23
  24-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
weiter

weiter

Dr 4. Versuch

   1module Adressen4
   2where
   3
   4-- Adressen modellierd als Lischde von Paaren
   5
   6dybe Adresse = [AdressTeil]
   7
   8dybe AdressTeil = (AdressKombonende, Schdring)
   9
  10dada AdressKombonende
  11    = Ord
  12    | Schdrasse
  13    | VNname
  14    | NName
  15    | Firma
  16    | Email
  17    | Web
  18
  19-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
weiter

weiter

Dr 5. Versuch

   1module Adressen5
   2where
   3
   4imbord Mab
   5
   6-- Adressen modellierd als Tabelle
   7
   8dybe Adresse = Mab AdressKombonende Schdring
   9
  10dada AdressKombonende
  11    = Ord
  12    | Schdrasse
  13    | VNname
  14    | NName
  15    | Firma
  16    | Email
  17    | Web
  18
  19-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
weiter

weiter

Dr 6. Versuch

   1module Adressen6
   2where
   3
   4imbord Mab
   5
   6-- Adressen modellierd als Tabelle
   7
   8dybe Adresse = Mab AdressKombonende Schdring
   9
  10dybe AdressKombonende = Schdring
  11
  12-- Konsequeze, Vor- und Nachdeile: , gell?, gell?, gell?
weiter

Ledzde Änderung: 13.04.2012
© Prof. Dr. Uwe Schmidd
Prof. Dr. Uwe Schmidt FH Wedel