PHP Classes
elePHPant
Icontem

enhancements

Recommend this page to a friend!

      TxtCrypt  >  All threads  >  enhancements  >  (Un) Subscribe thread alerts  
Subject:enhancements
Summary:enhancements like separating classes for encript and hide, UML
Messages:5
Author:fru
Date:2005-04-06 02:32:23
Update:2005-04-08 18:11:28
 

 


  1. enhancements   Reply   Report abuse  
fru - 2005-04-06 02:32:24
these are my suggestions:
1. make /share with us your class design in UML (or similar) diagrams
2. separate your class in two:
a) encrypt class (maybe abstract class, or "bridge" or "wrapper") [1]
b) hide class (maybe abstract class, "bridge" or "wrapper")

[1] GOF:
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
Design Patterns - elements for reusable object-oriented software.

phppatterns.com/

the idea: (use "courier new" font to see e.g. copy-paste to a text editor)

*----------*
|encrypt |
*----------*
|encrypt() |
|decrypt() |
|get_text()|
|set_text()|
|a_func() |
*----.-----*
/_\
| (generalization)
|
*---------------*
|concreteEncrypt|
*---------------*
|encrypt() |
|decrypt() |
|get_text() |
|set_text() |
|a_func() |
*---------------*

similar to hide (hider, concreteHider) and operations

why:
this approach isolates the service and concrete implementation

you can use any encryption method class that fits with your
abstract interface (mine is only an example) you just defined
in "encrypt" (that's the methods)

in "hide" and "concreteHide" you can use a TextHider
a MSWordHider, an GIF hider, werever you want

and... only one thing else... use "compressor" and "concreteCompressor"
if you want to isolate the compression process to its implementation

(maybe a gzCompressor, a bz2Compressor, a rarComrpessor, a MyCompressor)

and let community enhance your class in this way ¿what do you think?

  2. Re: enhancements   Reply   Report abuse  
Chao-Chyuan Shih - 2005-04-07 13:43:40 - In reply to message 1 from fru
That's a very good idea, fru. I'm glad to have the community enhance my class in any useful ways. Just let me know if I could help in anything.

Chao-Chyuan Shih

  3. Re: enhancements   Reply   Report abuse  
fru - 2005-04-07 20:32:04 - In reply to message 2 from Chao-Chyuan Shih
there is a good idea if you create UML diagrams

and define the interfaces there (public methods)
using abstract classes (classes with no implementation)

and (as an example or concrete implementation way)
inherit these classes using your algorithms

abstractCrypt <|--- concreteCrypt (your algorithm encapsulated in a class)

abstractCompressor <|--- concreteCompressor (your compression algorithm)

abstractHider <|--- concreteHider (your hider in txt files)

and publish abstract* methods using UML

maybe an abstract_TxtCrypt (class) that owns the abstract classes and uses
them all together

when I had time (maybe the weekend) I'll send u some UML (gif) diagrams

  4. Re: enhancements   Reply   Report abuse  
Chao-Chyuan Shih - 2005-04-08 14:11:38 - In reply to message 3 from fru
Sounds good. Please do send me your UML diagrams. As a matter of fact, I am pretty new to the PHP program myself, less than 7 months so far. But I have beeing programming in C/C++ for over 15 years. CAD programming used to be the only thing I did in the past 15 years. Just recently I quit my job and start up my own business. Still not quite sure what I should do :)

Anyway, let's work on this TxtCrypt project and make it useful!!!

  5. Re: enhancements   Reply   Report abuse  
fru - 2005-04-08 18:11:28 - In reply to message 4 from Chao-Chyuan Shih
ok ... just wait for the weekend

note: I use de UML to model and design not for code generation

see: www.uml.org