• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

OO Techniques & Universal Best Practices

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Matthias,

What techniques for creating pro-quality OO code that can stand the test of time do you use in your book?  I would love to review them and apply the ones I am not aware of ...

What universal best practices for object design do you provide in your book?  I would love to elevate my coding style by mastering the universal best practices described in your book ...

Why are immutable objects more secure and reliable?  Do you use immutable objects in your book?

Thanks,
Gibran
 
Marshal
Posts: 74376
334
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gibran Castillo wrote:. . . Do you use immutable objects in your book? . . .

I would hope they do.

Immutable objects can safely be interned and shared, without any need for copying or using the clone() method. So, it might appear expensive to create multiple objects, but they can be more economical on space because duplicates are not necessary. Similarly, there is no need to take defensive copies.
Another advantage of immutable objects is that they are implicitly t‍hread‑safe.
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Gibran Castillo wrote:. . . Do you use immutable objects in your book? . . .

I would hope they do.


It looks like they cover the subject:

https://livebook.manning.com/book/object-design-style-guide/chapter-1/44
 
Campbell Ritchie
Marshal
Posts: 74376
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Follow that to ยง4.4 and you can see how an object can sneakily change its state if it isn't written properly.
 
Author
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some useful answers have been provided here already. Yes, immutability is a central concept. The underlying design concept is to make objects predictable by making them recognizable; making it very clear what to expect from them. E.g. how you can use them, what they will do when you call them (give you a piece of information, or produce some kind of side-effect), etc.
 
Gibran Castillo
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would love to be awarded a copy of your book to apply your best practices and principles for coding.  I'll become a much better developer.
 
reply
    Bookmark Topic Watch Topic
  • New Topic