<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Aug 10, 2018 at 5:43 PM Junchao Zhang <<a href="mailto:jczhang@mcs.anl.gov">jczhang@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"> I met several bugs that remind me to raise this question. In PETSc, object of type A can arbitrarily access object of type B's data. But designer of B may later change the meaning of its data (and of course, update B's interfaces, which are usually local to few files). The designer may think the job is done, but actually it is not.  He/she has to grep the code to know where its data members are accessed (that is relatively easy to get) and what is the contract, for example, is an array assumed to be sorted (that is hard to know).  With C++, one can use private to minimize data exposure.</div></blockquote><div><br></div><div>This just has to be coding discipline. People should not be accessing private members.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div dir="ltr" class="m_822683992819083916gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div>