
Le 6 avr. 2017 =C3=A0 16:12, Yaniv Kaul <ykaul@redhat.com> a =C3=A9crit = : =20 =20 =20 On Thu, Apr 6, 2017 at 4:49 PM, Fabrice Bacchella = <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> = wrote: =20
Le 6 avr. 2017 =C3=A0 15:32, Yaniv Kaul <ykaul@redhat.com = <mailto:ykaul@redhat.com>> a =C3=A9crit : =20 =20 =20 On Thu, Apr 6, 2017 at 3:58 PM, Fabrice Bacchella = <fabrice.bacchella@orange.fr <mailto:fabrice.bacchella@orange.fr>> = wrote: Yes I'm starting to understand that thinking about migrating code is =
=20 The old skd3 code is just good to be thrown away. There is no hope =
--Apple-Mail=_A0BCE435-D932-45C3-A53D-79ED9D41DC62 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 pointless. thinking about "migrating code". And as it's just a thin layer around = REST calls, it's up to us to try to make something usable around that. = So I expect a lot of sweat and tears to adapt my existing code.
=20 Well, yes and no. Yes, it's not smooth, but once you 'get' the idea = behind the v4 API philosophy, it's quite easy to write to (at least in = Python). =20 An example of code that I'm unhappy to write and that a good sdk = should have provided: =20 searchfilter =3D "%s=3D%s" % (type, value) vm =3D vms_service.list(search=3D searchfilter)[0] =20 instead of : vms_service.list(search=3D {type: value})[0] =20 or even better: vms_service.get(**{type: value}) =20 =20 Yes, I see what you mean. 100% more LoC are currently needed vs. your = idea ;-)
It's not about the number of LoC, it's about legibility, having code = that says what's it's doing and doing what it says.= --Apple-Mail=_A0BCE435-D932-45C3-A53D-79ED9D41DC62 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = class=3D""><br class=3D""><div><blockquote type=3D"cite" class=3D""><div = class=3D"">Le 6 avr. 2017 =C3=A0 16:12, Yaniv Kaul <<a = href=3D"mailto:ykaul@redhat.com" class=3D"">ykaul@redhat.com</a>> a = =C3=A9crit :</div><br class=3D"Apple-interchange-newline"><div = class=3D""><div dir=3D"ltr" class=3D""><br class=3D""><div = class=3D"gmail_extra"><br class=3D""><div class=3D"gmail_quote">On Thu, = Apr 6, 2017 at 4:49 PM, Fabrice Bacchella <span dir=3D"ltr" = class=3D""><<a href=3D"mailto:fabrice.bacchella@orange.fr" = target=3D"_blank" class=3D"">fabrice.bacchella@orange.fr</a>></span> = wrote:<br class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0px= 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex"><div style=3D"word-wrap:break-word" = class=3D""><span class=3D"gmail-"><br class=3D""><div = class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">Le 6 = avr. 2017 =C3=A0 15:32, Yaniv Kaul <<a href=3D"mailto:ykaul@redhat.com"= target=3D"_blank" class=3D"">ykaul@redhat.com</a>> a =C3=A9crit = :</div><br = class=3D"gmail-m_-6007873883923554742Apple-interchange-newline"><div = class=3D""><div dir=3D"ltr" class=3D""><br class=3D""><div = class=3D"gmail_extra"><br class=3D""><div class=3D"gmail_quote">On Thu, = Apr 6, 2017 at 3:58 PM, Fabrice Bacchella <span dir=3D"ltr" = class=3D""><<a href=3D"mailto:fabrice.bacchella@orange.fr" = target=3D"_blank" class=3D"">fabrice.bacchella@orange.fr</a>></span> = wrote:<br class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0px= 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex"><div style=3D"word-wrap:break-word" = class=3D"">Yes I'm starting to understand that thinking about migrating = code is pointless.<div class=3D""><br class=3D""></div><div class=3D"">The= old skd3 code is just good to be thrown away. There is no hope thinking = about "migrating code". And as it's just a thin layer around REST calls, = it's up to us to try to make something usable around that. So I expect a = lot of sweat and tears to adapt my existing = code.</div></div></blockquote><div class=3D""><br class=3D""></div><div = class=3D"">Well, yes and no. Yes, it's not smooth, but once you 'get' = the idea behind the v4 API philosophy, it's quite easy to write to (at = least in Python).</div></div></div></div></div></blockquote><br = class=3D""></div></span><div class=3D"">An example of code that I'm = unhappy to write and that a good sdk should have provided:</div><div = class=3D""><br class=3D""></div><div class=3D"">searchfilter =3D "%s=3D%s"= % (type, value)</div><div class=3D""><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">vm </span><span = class=3D"gmail-m_-6007873883923554742pl-k" = style=3D"box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-reg= ular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">=3D</span><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D""> vms_service.list(</span><span = class=3D"gmail-m_-6007873883923554742pl-v" = style=3D"box-sizing:border-box;color:rgb(237,106,67);font-family:sfmono-re= gular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">search</span><spa= n class=3D"gmail-m_-6007873883923554742pl-k" = style=3D"box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-reg= ular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">=3D</span> <= wbr class=3D"">searchfilter<span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">)[</span><span = class=3D"gmail-m_-6007873883923554742pl-c1" = style=3D"box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-reg= ular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">0</span><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">]</span></div><div class=3D""><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D""><br class=3D""></span></div><div = class=3D""><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">instead of :</span></div><div class=3D""><span= = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">vms_service.list(</span><span = class=3D"gmail-m_-6007873883923554742pl-v" = style=3D"box-sizing:border-box;color:rgb(237,106,67);font-family:sfmono-re= gular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">search</span><spa= n class=3D"gmail-m_-6007873883923554742pl-k" = style=3D"box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-reg= ular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">=3D</span> {= <wbr class=3D"">type: value}<span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">)[</span><span = class=3D"gmail-m_-6007873883923554742pl-c1" = style=3D"box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-reg= ular,consolas,"liberation = mono",menlo,courier,monospace;white-space:pre-wrap">0</span><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">]</span></div><div class=3D""><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D""><br class=3D""></span></div><div = class=3D""><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">or even better:</span></div><div = class=3D""><span = style=3D"color:rgb(36,41,46);font-family:sfmono-regular,consolas,"lib= eration = mono",menlo,courier,monospace;white-space:pre-wrap;background-color:r= gb(255,255,255)" class=3D"">vms_service.get(**{type: = value})</span></div></div></blockquote><div class=3D""><br = class=3D""></div><div class=3D""><br class=3D""></div><div class=3D"">Yes,= I see what you mean. 100% more LoC are currently needed vs. your idea = ;-)</div></div></div></div></div></blockquote><br = class=3D""></div><div>It's not about the number of LoC, it's about = legibility, having code that says what's it's doing and doing what it = says.</div></body></html>= --Apple-Mail=_A0BCE435-D932-45C3-A53D-79ED9D41DC62--