• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OO class design

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys!

I have one more question about OO design. In my previous post "Class relations mass" I got great assistance from Pete Stein. Thank You Pete, once more for that. Here I have similar problem, and I don't know how to apply entirely suggested logic. I will appreciate help on this.

Now I have class View, where GUI is implemented.
I want to do caesar encryption, and a few more.
I was thinking to create Caesar class, Playfair, ..., Encryption class,
and View. Is this a good thinking, or do I need only Encryption class
and put all cipher implementations in that one ?
This is the Encryption class, but I am not sure how to define encryption, to
say so ? Could You, please, help me somehow ?



Thank You!
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all with MVC archiectecture, i suggest the following:



As an Optimization you might want to make Encryption's methods static ..


Next as you say you might change the encryption scheme later,

To this I suggest two approaches,

Approach 1 : Encryption contains type encryption Login.




Approach 2: Decorator-based Pattern

will post this idea soon.....
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Approach 2 : Decorator-based Pattern



code can be written as :


This is not purely the decorator pattern though
 
Nicol Green
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You very much for your help, Salvin!

Maybe I like a bit more second approach.
I will go with it!

This is not purely the decorator pattern though



Sorry, this is new concept for me. I google it, but haven't find much.
Could You, please, give me a short explanation of it ? After that I suppose
I will see why this is not a "purely decorator pattern".Thanks!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:As an Optimization you might want to make Encryption's methods static.


Whereas I would suggest you don't, since static methods can make testing more difficult, and any "optimization" you get is minimal at best.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic