tag:blogger.com,1999:blog-2807403883562053852.post5427785883335700952..comments2024-03-27T08:40:31.785-06:00Comments on Clayton Cramer.: Copying In Object-Oriented Languages: Be Careful What You Ask ForClayton Cramerhttp://www.blogger.com/profile/03258083387204776812noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-2807403883562053852.post-90181801661698907932014-04-26T12:37:49.807-06:002014-04-26T12:37:49.807-06:00"If your language treats user defined types d..."If your language treats user defined types differently than fundamental types (e.g. allows them to only live on the heap, and not the stack), it's not truly object-oriented. It's only object-oriented-esque. "<br /><br />Nonsense. Where the object resides is an implementation artifact. Whether the language passes a reference (pointer) or the actual object on the stack is irrelevant.StormCchaserhttps://www.blogger.com/profile/02998174514362089471noreply@blogger.comtag:blogger.com,1999:blog-2807403883562053852.post-48817349734027593042014-04-26T10:12:20.272-06:002014-04-26T10:12:20.272-06:00Garbage collection never solves the problem of reu...Garbage collection never solves the problem of reusing a block and storing a pointer to it.Clayton Cramerhttps://www.blogger.com/profile/03258083387204776812noreply@blogger.comtag:blogger.com,1999:blog-2807403883562053852.post-39332305641003745042014-04-25T23:12:22.757-06:002014-04-25T23:12:22.757-06:00But I thought these garbage-collected languages we...But I thought these garbage-collected languages were supposed to solve all of our problems with memory management! <br /><br />If your language treats user defined types differently than fundamental types (e.g. allows them to only live on the heap, and not the stack), it's not truly object-oriented. It's only object-oriented-esque. <br /><br />I hate garbage-collected languages. The make proper use of RAII impossible, and they are predicated on the idea that you can't possibly manage the lifetime of resources, so just drop them on the floor and don't worry about cleaning them up. Like that ever works.Rob Khttps://www.blogger.com/profile/15604826633798229422noreply@blogger.comtag:blogger.com,1999:blog-2807403883562053852.post-45901472686425814592014-04-25T20:35:57.504-06:002014-04-25T20:35:57.504-06:00StormChaser: you are right. I was working from me...StormChaser: you are right. I was working from memory. loadData was passed the cnoteVO.<br /><br />Unknown: Yes, there was no operational unit testing when I arrived on this project. And what little there had been was done completely wrong.Clayton Cramerhttps://www.blogger.com/profile/03258083387204776812noreply@blogger.comtag:blogger.com,1999:blog-2807403883562053852.post-6941745908820582592014-04-25T18:20:58.404-06:002014-04-25T18:20:58.404-06:00I must be missing something...
cnoteVO = loadData...I must be missing something...<br /><br />cnoteVO = loadData();<br /> <br />resultList.add(cnoteVO);<br /><br />Unless loadData is returning the same object reference on each call, cnoteVO should have a different reference, to a different object, each time you do the two statements above.<br /><br />Could it be that cnoteVO = loadData() was actually cnoteVO.loadData() (dot instead of equals, in case the comment system messes it up)?StormCchaserhttps://www.blogger.com/profile/02998174514362089471noreply@blogger.comtag:blogger.com,1999:blog-2807403883562053852.post-19320731911283076192014-04-25T17:31:22.031-06:002014-04-25T17:31:22.031-06:00Sounds like somebody skipped some unit testing in ...Sounds like somebody skipped some unit testing in the past...Anonymousnoreply@blogger.com