• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

OO Techniques & Universal Best Practices

 
Ranch Hand
Posts: 48
  • 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: 79707
381
  • 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: 7125
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: 79707
381
  • 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: 48
  • 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.
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic