Re: Long Time No See - from Bartek Muszynski

anthony berglas <[email protected]> Fri, 3 Feb 2012 10:36:51 +1000
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <CA+_PZMdMaM3VzOn-rQ15iZjoGF83pTRY9d9ZDA8sLpfRRS3LXA@mail.gmail.com>
--14dae9ccd4c0a0321604b80484de
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hello Bartek,

Good to hear from you.

Your approach, as I understand it, seems roughly correct.  Having the DB
Table as the union of fields rather than splitting them over multiple
tables is generally the best option.  Discriminator should probably default
to a string, so nice for reporting tools.  Obviously all subtypes would
need the same key -- not sure what is the best way to handle common fields
in a super class as currently SFieldMetas have a SRecordMeta.  So that
could become quite messy.

However, standing back, I really do wonder whether this really adds a lot
of value to offset the substantial added complexity.  One of the important
issues is to decide what not to implement.  There is a lot of detail in
doing something like this, eg. how does it affect Queries (Including
queries across the subtypes)?  (One issue is that in a database, subtypes
can change -- the student can become a lecturer -- but in Java they are
fixed.)

I think that a read mostly cache could add more real value.  But it is also
tricky to get right.  I also wonder if we could utilize something like
EH-Cache, but have not thought about it much. But I would probably prefer
to improve the existing querying of disconnected SDataSets.

I do hope that you submit improvements to the main repository.  But they
have to be sound, with test cases, and not break other peoples code.

There is a list of little things that need to be done, which should
probably be tackled first.

I have forwarded this to the list.  What do others think the priorities are=
?

Regards,

Anthony

On Wed, Feb 1, 2012 at 10:33 AM, Bartek Muszynski
<[email protected]>wrote:

>  Hi Anthony,****
>
> ** **
>
> Do you remember me? I helped implement join() functionality in SimpleORM
> about 7 or 8 years ago!****
>
> ** **
>
> Wow, I like the changes I=92ve seen since then. And yet, it still simple =
and
> elegant!****
>
> ** **
>
> After working at Epic Data, I ran my own business for about 6 years, wher=
e
> I used SimpleORM which I ported to C#. It worked great.****
>
> ** **
>
> Now, I just started a new job and plan to use SimpleORM once again. I=92v=
e
> taken a snapshot of the source, and I plan to implement the following
> features:****
>
> ** **
>
> **1.       **Ability to store classes which are part of an inheritance
> hierarchy. I plan to implement this, roughly, as follows:****
>
> **a.       **The DB table would contain the union of all fields of all
> classes in a hierarchy****
>
> **b.      **It would also contain a special =91Discriminator=92 field (of
> datatype =91int=92) which indicates which class should be instantiated***=
*
>
> **c.       **Add overloaded constructor to SRecordMeta which, rather than
> just taking a Class object, takes a Map of discriminator values to Classe=
s)
> ****
>
> **d.      **Postpone the call to SRecordMeta.newRecordInstance() until
> the actual DB access has been made, so that the discriminator is read and
> the proper class can be created****
>
> **e.      **Since right now you use an otherwise empty SRecordInstance to
> hold and pass the key (or even a NullKey value), this would have to be
> changed to just create and pass the key value fields, rather than the
> object.****
>
> ** **
>
> **2.       **Ability to have a detached DataSet where an SSessionJDBC
> looks into to resolve records before going to the DB. This is the idea of=
 a
> =93Read Mostly=94 cache that you hinted at in earlier code, though I thin=
k
> never implemented. This is useful because in a typical DB application the=
re
> is a large set of tables with very static data, and tons of DB accesses c=
an
> be saved by caching this data between transactions. Please let me know if
> the current version of SimpleORM can do this already.****
>
> ** **
>
> Questions:****
>
> **=D8  **Are you interested in putting any of these features into the
> official SimpleORM? ****
>
> **=D8  **Did you ever make any money of SimpleORM? I=92m curious for two
> reasons: ****
>
> **o   **It=92s such a great tool, and you deserve it****
>
> **o   **I=92m considering launching my own Open Source project (related t=
o
> test automation) and am curious about others=92 experience in this area.*=
***
>
> ** **
>
> Bye for now.****
>
> I hope to hear from you soon, and all the best!****
>
> ** **
>
> Bartek J****
>
> ** **
>
> PS. After I make the above changes in Java, I plan to port the new versio=
n
> to C# again.****
>
> ** **
>
> ** **
>
> *Bartek Muszynski*
>
> *Senior Software Architect*
>
> *Aurora Control Technologies Inc.
> +1 778-241-5000*****
>
> *www.auroracontrol.com*****
>
> *
> **[image: Description:
> cid:[email protected]]*****
>
> ** **
>



--=20

Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that that is the best way to collect firewood.

--14dae9ccd4c0a0321604b80484de
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable





<head>

<style type=3D"text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title=20
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none;=20
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html>
<head>
<style type=3D"text/css">
<!--
#ygrp-mkp {
  border: 1px solid #d8d8d8;
  font-family: Arial;
  margin: 10px 0;
  padding: 0 10px;
}

#ygrp-mkp hr {
  border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
  color: #628c2a;
  font-size: 85%;
  font-weight: 700;
  line-height: 122%;
  margin: 10px 0;
}

#ygrp-mkp #ads {
  margin-bottom: 10px;
}

#ygrp-mkp .ad {
  padding: 0 0;
}

#ygrp-mkp .ad p {
  margin: 0;
}

#ygrp-mkp .ad a {
  color: #0000ff;
  text-decoration: none;
}
-->
</style>
</head>
<body>





Hello Bartek,<div><br></div><div>Good to hear from you. =A0</div><div><br><=
/div><div>Your approach, as I understand it, seems roughly correct. =A0Havi=
ng the DB Table as the union of fields rather than splitting them over mult=
iple tables is generally the best option. =A0Discriminator should probably =
default to a string, so nice for reporting tools. =A0Obviously all subtypes=
 would need the same key -- not sure what is the best way to handle common =
fields in a super class as currently SFieldMetas have a SRecordMeta. =A0So =
that could become quite messy.</div>

<div><br></div><div>However, standing back, I really do wonder whether this=
 really adds a lot of value to offset the substantial added complexity. =A0=
One of the important issues is to decide what not to implement. =A0There is=
 a lot of detail in doing something like this, eg. how does it affect Queri=
es (Including queries across the subtypes)? =A0(One issue is that in a data=
base, subtypes can change -- the student can become a lecturer -- but in Ja=
va they are fixed.)</div>

<div><br></div><div>I think that a read mostly cache could add more real va=
lue. =A0But it is also tricky to get right. =A0I also wonder if we could ut=
ilize something like EH-Cache, but have not thought about it much. But I wo=
uld probably prefer to improve the existing querying of disconnected SDataS=
ets.</div>

<div><br></div><div>I do hope that you submit=A0improvements=A0to the main =
repository. =A0But they have to be sound, with test cases, and not break ot=
her peoples code.</div><div><br></div><div>There is a list of little things=
 that need to be done, which should probably be tackled first.</div>

<div><br></div><div>I have forwarded this to the list. =A0What do others th=
ink the priorities are?</div><div><br></div><div>Regards,</div><div><br></d=
iv><div>Anthony</div><div><br></div><div><div class=3D"gmail_quote">On Wed,=
 Feb 1, 2012 at 10:33 AM, Bartek Muszynski <span dir=3D"ltr">&lt;<a href=3D=
"mailto:[email protected]">[email protected]</a>&gt;</span> w=
rote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">





<div lang=3D"EN-CA" link=3D"blue" vlink=3D"purple">
<div>
<p class=3D"MsoNormal">Hi Anthony,<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Do you remember me? I helped implement join() functi=
onality in SimpleORM about 7 or 8 years ago!<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Wow, I like the changes I=92ve seen since then. And =
yet, it still simple and elegant!<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">After working at Epic Data, I ran my own business fo=
r about 6 years, where I used SimpleORM which I ported to C#. It worked gre=
at.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Now, I just started a new job and plan to use Simple=
ORM once again. I=92ve taken a snapshot of the source, and I plan to implem=
ent the following features:<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p><u></u><span>1.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=
=A0=A0=A0=A0=A0=A0
</span></span><u></u>Ability to store classes which are part of an inherita=
nce hierarchy. I plan to implement this, roughly, as follows:<u></u><u></u>=
</p>
<p style=3D"margin-left:72.0pt">
<u></u><span>a.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=
=A0=A0=A0=A0=A0
</span></span><u></u>The DB table would contain the union of all fields of =
all classes in a hierarchy<u></u><u></u></p>
<p style=3D"margin-left:72.0pt">
<u></u><span>b.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=
=A0=A0=A0=A0
</span></span><u></u>It would also contain a special =91Discriminator=92 fi=
eld (of datatype =91int=92) which indicates which class should be instantia=
ted<u></u><u></u></p>
<p style=3D"margin-left:72.0pt">
<u></u><span>c.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=
=A0=A0=A0=A0=A0
</span></span><u></u>Add overloaded constructor to SRecordMeta which, rathe=
r than just taking a Class object, takes a Map of discriminator values to C=
lasses)<u></u><u></u></p>
<p style=3D"margin-left:72.0pt">
<u></u><span>d.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=
=A0=A0=A0=A0
</span></span><u></u>Postpone the call to SRecordMeta.newRecordInstance() u=
ntil the actual DB access has been made, so that the discriminator is read =
and the proper class can be created<u></u><u></u></p>
<p style=3D"margin-left:72.0pt">
<u></u><span>e.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=
=A0=A0=A0=A0
</span></span><u></u>Since right now you use an otherwise empty SRecordInst=
ance to hold and pass the key (or even a NullKey value), this would have to=
 be changed to just create and pass the key value fields, rather than the o=
bject.<u></u><u></u></p>


<p><u></u>=A0<u></u></p>
<p><u></u><span>2.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=
=A0=A0=A0=A0=A0=A0
</span></span><u></u>Ability to have a detached DataSet where an SSessionJD=
BC looks into to resolve records before going to the DB. This is the idea o=
f a =93Read Mostly=94 cache that you hinted at in earlier code, though I th=
ink never implemented. This is useful
 because in a typical DB application there is a large set of tables with ve=
ry static data, and tons of DB accesses can be saved by caching this data b=
etween transactions. Please let me know if the current version of SimpleORM=
 can do this already.<u></u><u></u></p>


<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Questions:<u></u><u></u></p>
<p><u></u><span style=3D"font-family:Wingdings"><span>=D8<span style=3D"fon=
t:7.0pt &quot;Times New Roman&quot;">=A0
</span></span></span><u></u>Are you interested in putting any of these feat=
ures into the official SimpleORM?
<u></u><u></u></p>
<p><u></u><span style=3D"font-family:Wingdings"><span>=D8<span style=3D"fon=
t:7.0pt &quot;Times New Roman&quot;">=A0
</span></span></span><u></u>Did you ever make any money of SimpleORM? I=92m=
 curious for two reasons:
<u></u><u></u></p>
<p style=3D"margin-left:72.0pt">
<u></u><span style=3D"font-family:&quot;Courier New&quot;"><span>o<span sty=
le=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=A0
</span></span></span><u></u>It=92s such a great tool, and you deserve it<u>=
</u><u></u></p>
<p style=3D"margin-left:72.0pt">
<u></u><span style=3D"font-family:&quot;Courier New&quot;"><span>o<span sty=
le=3D"font:7.0pt &quot;Times New Roman&quot;">=A0=A0
</span></span></span><u></u>I=92m considering launching my own Open Source =
project (related to test automation) and am curious about others=92 experie=
nce in this area.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Bye for now.<u></u><u></u></p>
<p class=3D"MsoNormal">I hope to hear from you soon, and all the best!<u></=
u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Bartek <span style=3D"font-family:Wingdings">J</span=
><u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">PS. After I make the above changes in Java, I plan t=
o port the new version to C# again.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal"><b><span lang=3D"EN-US">Bartek Muszynski<u></u><u></=
u></span></b></p>
<p class=3D"MsoNormal"><b><span lang=3D"EN-US">Senior Software Architect<u>=
</u><u></u></span></b></p>
<p class=3D"MsoNormal"><b><span lang=3D"EN-US">Aurora Control Technologies =
Inc.<br>
<a href=3D"tel:%2B1%20778-241-5000" value=3D"+17782415000" target=3D"_blank=
">+1 778-241-5000</a></span></b><span lang=3D"EN-US" style=3D"font-size:9.0=
pt;font-family:&quot;Helvetica&quot;,&quot;sans-serif&quot;"><u></u><u></u>=
</span></p>


<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:11.5pt;co=
lor:green"><a href=3D"http://www.auroracontrol.com/" target=3D"_blank"><spa=
n style=3D"color:blue">www.auroracontrol.com</span></a></span></b><span lan=
g=3D"EN-US" style=3D"color:black"><u></u><u></u></span></p>


<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:9.0pt;col=
or:green"><br>
</span></b><b><span style=3D"font-size:9.0pt;color:green"><img border=3D"0"=
 width=3D"236" height=3D"45" alt=3D"Description: cid:0728C5A1-A3B0-496E-9D4=
[email protected]"></span></b><span lang=3D"EN-US"><u></u><u>=
</u></span></p>


<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
</div>
</div>

</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><p>
</p><p>Dr Anthony Berglas, <a href=3D"mailto:[email protected]" target=3D=
"_blank">[email protected]</a>=A0=A0=A0=A0=A0=A0 Mobile: +61 4 4838 8874<=
br>
Just because it is possible to push twigs along the ground with ones nose<b=
r>
does not necessarily mean that that is the best way to collect firewood.</p=
><br>
</div>




<!-- |**|begin egp html banner|**| -->

<br>

=20=20=20=20
=20=20=20=20
<br>

<!-- |**|end egp html banner|**| -->


<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>

<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D7360226/grpspI=
d=3D1705006905/msgId=3D2043/stime=3D1328229457" width=3D"1" height=3D"1"> <=
br>

<!-- |**|end egp html banner|**| -->

=20=20
<!-- |**|begin egp html banner|**| -->

<br>
      <div style=3D"font-family: verdana; font-size: 77%; border-top: 1px s=
olid #666; padding: 5px 0;" >
      Your email settings: Individual Email|Traditional <br>
      <a href=3D"http://groups.yahoo.com/group/SimpleORM/join;_ylc=3DX3oDMT=
Jmamh2czJxBF9TAzk3NDc2NTkwBGdycElkAzczNjAyMjYEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlY=
wNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzMjgyMjk0NTc-">Change settings via the Web</a=
> (Yahoo! ID required) <br>
      Change settings via email: <a href=3D"mailto:SimpleORM-digest@yahoogr=
oups.com?subject=3DEmail Delivery: Digest">Switch delivery to Daily Digest<=
/a> | <a href =3D "mailto:[email protected]?subject=3D=
Change Delivery Format: Fully Featured">Switch to Fully Featured</a> <br>
           <a href=3D"http://groups.yahoo.com/group/SimpleORM;_ylc=3DX3oDMT=
Jka2MxdTJtBF9TAzk3NDc2NTkwBGdycElkAzczNjAyMjYEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlY=
wNmdHIEc2xrA2hwZgRzdGltZQMxMzI4MjI5NDU3">
        Visit Your Group=20
      </a> |
      <a href=3D"http://docs.yahoo.com/info/terms/">
        Yahoo! Groups Terms of Use
      </a> |
      <a href=3D"mailto:[email protected]?subject=3DUns=
ubscribe">
       Unsubscribe=20
      </a>=20
 <br>
    </div>
  <br>

<!-- |**|end egp html banner|**| -->


<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body>

</html>

--14dae9ccd4c0a0321604b80484de--