<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Berry Langerak</title>
	<atom:link href="http://berryllium.nl/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://berryllium.nl</link>
	<description>Thoughts on life and programming</description>
	<lastBuildDate>Fri, 03 Jun 2011 14:50:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Generate random password PostgreSQL by Alex Smith</title>
		<link>http://berryllium.nl/2010/07/generate-random-password-postgresql/#comment-205</link>
		<dc:creator>Alex Smith</dc:creator>
		<pubDate>Fri, 03 Jun 2011 14:50:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.berryllium.nl/?p=70#comment-205</guid>
		<description>This SQL generates a 6 chars random password (see last line if you want to generate a bigger/smaller one) using A table&#039;s charset:

SELECT ARRAY_TO_STRING(ARRAY_AGG(SUBSTR(A.chars, (RANDOM()*1000)::int%(LENGTH(A.chars))+1, 1)), &#039;&#039;)
  FROM (SELECT &#039;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%*&#039;::varchar AS chars) A,
       (SELECT generate_series(1, 6, 1) AS line) B

I think it also solves the problem.

Tested in postgresql 8.4.</description>
		<content:encoded><![CDATA[<p>This SQL generates a 6 chars random password (see last line if you want to generate a bigger/smaller one) using A table&#8217;s charset:</p>
<p>SELECT ARRAY_TO_STRING(ARRAY_AGG(SUBSTR(A.chars, (RANDOM()*1000)::int%(LENGTH(A.chars))+1, 1)), &#8221;)<br />
  FROM (SELECT &#8216;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%*&#8217;::varchar AS chars) A,<br />
       (SELECT generate_series(1, 6, 1) AS line) B</p>
<p>I think it also solves the problem.</p>
<p>Tested in postgresql 8.4.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by OZ</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-197</link>
		<dc:creator>OZ</dc:creator>
		<pubDate>Mon, 23 May 2011 16:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-197</guid>
		<description>Getters and Setters aren&#039;t evil. Idea of Encapsulation is not just hide fields, but hide, how class works. Getters and setters can be declared in interface, so you can replace one abject by another - and it is what for encapsulation was invented! 

`withdraw` and `deposit` it&#039;s setters. All this code can be successfully done in `setBalance` method, almost nothing will be changed. All these checks, comparison - it&#039;s usual work of setters. 

Why public fields are evil? Because object can&#039;t control their changing and because they can&#039;t be declared in interfaces. Getters and setters can do it, so it&#039;s perfect tool of OOP. 

Accessors can be written silly, of course, but it doesn&#039;t mean that they are evil. Any method in the class can be written silly.</description>
		<content:encoded><![CDATA[<p>Getters and Setters aren&#8217;t evil. Idea of Encapsulation is not just hide fields, but hide, how class works. Getters and setters can be declared in interface, so you can replace one abject by another &#8211; and it is what for encapsulation was invented! </p>
<p>`withdraw` and `deposit` it&#8217;s setters. All this code can be successfully done in `setBalance` method, almost nothing will be changed. All these checks, comparison &#8211; it&#8217;s usual work of setters. </p>
<p>Why public fields are evil? Because object can&#8217;t control their changing and because they can&#8217;t be declared in interfaces. Getters and setters can do it, so it&#8217;s perfect tool of OOP. </p>
<p>Accessors can be written silly, of course, but it doesn&#8217;t mean that they are evil. Any method in the class can be written silly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by The great (PHP) getter/setter debate &#124; Gargoyle</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-177</link>
		<dc:creator>The great (PHP) getter/setter debate &#124; Gargoyle</dc:creator>
		<pubDate>Thu, 28 Apr 2011 09:02:45 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-177</guid>
		<description>[...] on this front that Berry Langerak puts forward a good case, and where I want to add my two cents worth. Berry attempts to stress that [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #F8F7F6; border: 1px solid #D6D3D3;">
<p>[...] on this front that Berry Langerak puts forward a good case, and where I want to add my two cents worth. Berry attempts to stress that [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Berry</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-175</link>
		<dc:creator>Berry</dc:creator>
		<pubDate>Fri, 25 Mar 2011 15:24:34 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-175</guid>
		<description>Thanks! Yeah, I&#039;ll try to write up on some stuff this weekend, so keep your eye on the blog! ;)</description>
		<content:encoded><![CDATA[<p>Thanks! Yeah, I&#8217;ll try to write up on some stuff this weekend, so keep your eye on the blog! <img src='http://berryllium.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Phill Pafford</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-174</link>
		<dc:creator>Phill Pafford</dc:creator>
		<pubDate>Fri, 25 Mar 2011 14:35:32 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-174</guid>
		<description>Hi Berry, 

Great post! Any chance you are doing more on this topic? or should I say style of development?</description>
		<content:encoded><![CDATA[<p>Hi Berry, </p>
<p>Great post! Any chance you are doing more on this topic? or should I say style of development?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Compilado de enlaces &#171; Programación &#8211; por droope</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-173</link>
		<dc:creator>Compilado de enlaces &#171; Programación &#8211; por droope</dc:creator>
		<pubDate>Thu, 24 Mar 2011 06:09:55 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-173</guid>
		<description>[...] Excelente artículo sobre si usar o no usar getters y setters para nuestros objetos, y sobre cuando es práctico hacerlo. [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #F8F7F6; border: 1px solid #D6D3D3;">
<p>[...] Excelente artículo sobre si usar o no usar getters y setters para nuestros objetos, y sobre cuando es práctico hacerlo. [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Berry</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-159</link>
		<dc:creator>Berry</dc:creator>
		<pubDate>Mon, 21 Feb 2011 09:00:18 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-159</guid>
		<description>Hi Alex,

&gt; If you fail to see how adding an accessor only when the need becomes 
&gt; clear will break an existing API then imagine a situation where your 
&gt; team uses a public varible 1000+ times and then you need to alter the 
&gt; value they receive based on some dynamic environment.

Agreed: if your team uses a public variable 1000+ times, and they use it and apply logic to it, the brown substance has hit the fan. 

&gt; The example is simple because I just wanted to say – nobody(!) ever 
&gt; uses accessor methods to move business logic outside an object but 
&gt; to achieve different kinds of polymorphism or make it achievable.

I hate to break it to you, but you&#039;re contradicting yourself somewhat. You&#039;re telling me that nobody(!) will ever use accessor methods to move business logic outside of an object, but you&#039;re also telling me your team uses a public parameter to move business logic outside of an object?  

&gt; I hope you really meant you are against public properties and not 
&gt; against accessor methods. Otherwise the point is senseless, a usual 
&gt; programmer does not do what you have explained (and we don’t count 
&gt; newbies).

Perhaps not your colleagues, but I see it happening a lot in PHP projects. I&#039;ll try to find some real life examples for you to enjoy.</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>> If you fail to see how adding an accessor only when the need becomes<br />
> clear will break an existing API then imagine a situation where your<br />
> team uses a public varible 1000+ times and then you need to alter the<br />
> value they receive based on some dynamic environment.</p>
<p>Agreed: if your team uses a public variable 1000+ times, and they use it and apply logic to it, the brown substance has hit the fan. </p>
<p>> The example is simple because I just wanted to say – nobody(!) ever<br />
> uses accessor methods to move business logic outside an object but<br />
> to achieve different kinds of polymorphism or make it achievable.</p>
<p>I hate to break it to you, but you&#8217;re contradicting yourself somewhat. You&#8217;re telling me that nobody(!) will ever use accessor methods to move business logic outside of an object, but you&#8217;re also telling me your team uses a public parameter to move business logic outside of an object?  </p>
<p>> I hope you really meant you are against public properties and not<br />
> against accessor methods. Otherwise the point is senseless, a usual<br />
> programmer does not do what you have explained (and we don’t count<br />
> newbies).</p>
<p>Perhaps not your colleagues, but I see it happening a lot in PHP projects. I&#8217;ll try to find some real life examples for you to enjoy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Alex Prider</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-156</link>
		<dc:creator>Alex Prider</dc:creator>
		<pubDate>Fri, 18 Feb 2011 23:37:45 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-156</guid>
		<description>Berry. If you  fail to see how adding an accessor only when the need becomes clear will break an existing API then imagine a situation where your team uses a public varible 1000+ times and then you need to alter the value they receive based on some dynamic environment. You will have to update the code in 1000+ different places (switching to method calls).

The example is simple because I just wanted to say - nobody(!) ever uses  accessor methods to move business logic outside an object but to achieve different kinds of polymorphism or make it achievable.

I hope you really meant you are against public properties and not against accessor methods. Otherwise the point is senseless, a usual programmer does not do what you have explained (and we don&#039;t count newbies).</description>
		<content:encoded><![CDATA[<p>Berry. If you  fail to see how adding an accessor only when the need becomes clear will break an existing API then imagine a situation where your team uses a public varible 1000+ times and then you need to alter the value they receive based on some dynamic environment. You will have to update the code in 1000+ different places (switching to method calls).</p>
<p>The example is simple because I just wanted to say &#8211; nobody(!) ever uses  accessor methods to move business logic outside an object but to achieve different kinds of polymorphism or make it achievable.</p>
<p>I hope you really meant you are against public properties and not against accessor methods. Otherwise the point is senseless, a usual programmer does not do what you have explained (and we don&#8217;t count newbies).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Berry</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-152</link>
		<dc:creator>Berry</dc:creator>
		<pubDate>Wed, 16 Feb 2011 09:34:59 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-152</guid>
		<description>Hi Wil,

&gt; 1 – An accessor method, even if it provides no other domain logic beyond 
&gt; returning it’s underlying field data, is a better API design as it protects
&gt; from potentially breaking the API when domain logic must be factored in. 
&gt; This is a huge part of iterative development.

I fail to see how adding an accessor only when the need becomes clear will break an existing API. Also, in my book, iterative development also means don&#039;t build today what you may need tomorrow. If you plan ahead for a possible change in the future, you&#039;re planning too much. TDD actually dictates that you should do the simplest thing that works, and refactor afterwards. I&#039;ve done TDD on a few projects, and there were no (unnecessary) accessors to be found. YAGNI++

Apart from that, I still stand by the thought that normal methods still facilitate changes much better than having a bunch of accessors. Part of the success from iterative development is that it facilitates change. OO facilitates change by containing the behaviour in one single unit. All in all, I&#039;m not sure I agree with you.

&gt; 2 – See #1 and ignore it if you are primarily working alone and not in a
&gt; team — also, ignore #1 if you are the only one to ever consume this API.

Breaking your own code would be just as bad as breaking others&#039; code though right? The only benefit is that you only affect your own code, and you will know what you&#039;ve changed. That&#039;s a plus.

&gt; 3 – Just because you don’t have a need for accessors at the outset doesn’t
&gt; mean you won’t need them later.

And vice-versa: just because you have a parameters, doesn&#039;t mean you&#039;ll ever need an accessor for it -- if you keep behaviour in the Unit itself, that is. Mind you, I&#039;m still not trying to bash accessors in general: I&#039;m talking about collaborators that take over behaviour that belongs to another object.

&gt; I also notice (not just here but in a lot of PHP debate articles) a lot
&gt; of comparisons with Java; however, Java is not the only language to utilize
&gt; these concepts we debate.

I&#039;m not comparing to PHP to Java a lot in the article though am I? I merely stated I was introduced to accessors in my Java classes, and that PHP seems to have borrowed the whole &quot;we need accessors for everything&quot;-attitude from Java.

&gt; For instance, Ruby *BAKES* into the language the very thing we are 
&gt; debating here.

If that&#039;s what you think we&#039;re debating, I&#039;m afraid we&#039;re not on the same subject. My point is that you should wonder if code actually belongs in class A, if all it does is use data from class B, where class B consists solely of accessors. And yes, accessors create that possibility, which means that when you write them, you&#039;ll want to wonder if you aren&#039;t &quot;Doing it wrong&quot; ;)  It may sound rediculous to you, but in PHP, it seems to be a common phenomenon.

&gt; I guess my argument here is that we stop bashing Java and pick on a 
&gt; language that can actually defend itself on a more level playing field. 
&gt; I would assume that bashing session wouldn’t last very long

I actually *like* Java, so I don&#039;t bash it at all. All the mentions on Java in the comments is because the commenters are Java developers.</description>
		<content:encoded><![CDATA[<p>Hi Wil,</p>
<p>> 1 – An accessor method, even if it provides no other domain logic beyond<br />
> returning it’s underlying field data, is a better API design as it protects<br />
> from potentially breaking the API when domain logic must be factored in.<br />
> This is a huge part of iterative development.</p>
<p>I fail to see how adding an accessor only when the need becomes clear will break an existing API. Also, in my book, iterative development also means don&#8217;t build today what you may need tomorrow. If you plan ahead for a possible change in the future, you&#8217;re planning too much. TDD actually dictates that you should do the simplest thing that works, and refactor afterwards. I&#8217;ve done TDD on a few projects, and there were no (unnecessary) accessors to be found. YAGNI++</p>
<p>Apart from that, I still stand by the thought that normal methods still facilitate changes much better than having a bunch of accessors. Part of the success from iterative development is that it facilitates change. OO facilitates change by containing the behaviour in one single unit. All in all, I&#8217;m not sure I agree with you.</p>
<p>> 2 – See #1 and ignore it if you are primarily working alone and not in a<br />
> team — also, ignore #1 if you are the only one to ever consume this API.</p>
<p>Breaking your own code would be just as bad as breaking others&#8217; code though right? The only benefit is that you only affect your own code, and you will know what you&#8217;ve changed. That&#8217;s a plus.</p>
<p>> 3 – Just because you don’t have a need for accessors at the outset doesn’t<br />
> mean you won’t need them later.</p>
<p>And vice-versa: just because you have a parameters, doesn&#8217;t mean you&#8217;ll ever need an accessor for it &#8212; if you keep behaviour in the Unit itself, that is. Mind you, I&#8217;m still not trying to bash accessors in general: I&#8217;m talking about collaborators that take over behaviour that belongs to another object.</p>
<p>> I also notice (not just here but in a lot of PHP debate articles) a lot<br />
> of comparisons with Java; however, Java is not the only language to utilize<br />
> these concepts we debate.</p>
<p>I&#8217;m not comparing to PHP to Java a lot in the article though am I? I merely stated I was introduced to accessors in my Java classes, and that PHP seems to have borrowed the whole &#8220;we need accessors for everything&#8221;-attitude from Java.</p>
<p>> For instance, Ruby *BAKES* into the language the very thing we are<br />
> debating here.</p>
<p>If that&#8217;s what you think we&#8217;re debating, I&#8217;m afraid we&#8217;re not on the same subject. My point is that you should wonder if code actually belongs in class A, if all it does is use data from class B, where class B consists solely of accessors. And yes, accessors create that possibility, which means that when you write them, you&#8217;ll want to wonder if you aren&#8217;t &#8220;Doing it wrong&#8221; <img src='http://berryllium.nl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   It may sound rediculous to you, but in PHP, it seems to be a common phenomenon.</p>
<p>> I guess my argument here is that we stop bashing Java and pick on a<br />
> language that can actually defend itself on a more level playing field.<br />
> I would assume that bashing session wouldn’t last very long</p>
<p>I actually *like* Java, so I don&#8217;t bash it at all. All the mentions on Java in the comments is because the commenters are Java developers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getters and setters: evil or necessary evil? by Nicolas</title>
		<link>http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/#comment-151</link>
		<dc:creator>Nicolas</dc:creator>
		<pubDate>Wed, 16 Feb 2011 09:33:16 +0000</pubDate>
		<guid isPermaLink="false">http://berryllium.nl/?p=130#comment-151</guid>
		<description>The question finally is what you are really doing in your software.

Many software do that :

- Listen for HTTP request with HTTP parameters
- Embed theses parameters into a behaviour less object.
- Send this object to the business layer that do nearly nothing but forward it to the access layer.
- The access layer use it to generate a request to the database.
- The access layer put the response to a list of behaviour less objects.
- The business layer get the response from access and transform it to bring it back to the UI
- The UI show it on the screen.

If you really try to understand this pipeline, you see that this design :
- Allow easy changes : UI / Access can be changed with minimal impacts
- Allow good encapsulation : UI can corrupt Access/Business data. And Access can&#039;t corrupt Business/UI data too.
- That this not OOP at all. This is a plain procedural pipeline. This is simply a very good pratice. Not everything fit in an OOP way. Basically in this design, we might use object and interfaces, but we don&#039;t do OOP other that for technical reason and because we do program with an OO language.

Then there is no need at all to use getter/setters. They serve nothing. Public fields are more consise. Using a map can even be a better choice if you don&#039;t mind having type/name information at runtime only. Then your business layer and access layer is reduced to nearly nothing and use 99% the same generic code. (Think about ActiveRecord).

The thing is that theses sort of applications are in reality data driven. The more objects, the more OOP you try to bring in (using ORM with complex class hierachy for exemple), the more complex your project become and the more problems you have. Introducing OOP in this sort of application is just introducing what we call an impedance mismatch.

Why they are data driven ? Because basically all you do is CRUD operations. There is nearly no business. Just a UI and a database. That&#039;s why plain old PHP is so good for that sort of applications/website. You don&#039;t loose time on useless OO design. You design your datamodel instead.

All data intensive applications have the same sort of concern. 3D Video games for exemple. At first using objects everywhere seems good. But then your data are not ordered and aligned in memory. You have lot of cache miss, because you loose spacial proximity. Your graphic card (that is a giant pipeline) rely on spacial proximity and have cache everywhere. What your GPU want is a big array of data. But if you use too much objects, too much new everywhere instead of big array, your performance will be abyssal hurting the hardware.

A good architechture is not something that we choose because we like it, even because it is beautifull, but because it is efficiant and simple.

You should think OO when you really need the concepts. When coupling data and code make sence and really help the modelisation of your domain. When polymorphism bring really something interresting to the table.

There is a hint of the limitations of OOP. A hint that nearly everybody have seen at school. Of course the teacher didn&#039;t speak about them. You guess what is it ? Well it is the examples you are given to understand OOP.

When you are lucky, they give you good exemple like an UI framework (where any specialised widget appear to be a standard widget with a specialized behavior).

But how many time your are given silly exemple ? Like animal that make smell ? Vehicules with it subhierarchy (Car / Plane...) that just have a method that print the noise they make ? Or shape that draw themselves ?

Do you understand what is the real problem about theses examples ? You&#039;ll never have to modelize something like that in most softwares. The best OOP example you are given are simply useless theoretical example that nobody care about in reality.

Well you can have the exemple of the library. And you will modelize it. Just for the fun... Try it to modelize it with a data driven approach (3NF, relationnal databases and all) and try to not espacialy use objects concepts. You&#039;ll see that your design with be perfectly right and efficiant.

In most modern project we don&#039;t use OOP to modelize something real. No. Oh we do use pattern. An abstract factory, a singleton,  things like that. We use inheritence to reuse code more than to really modelize a class hierarchy that as sence for the domain.

We use  OOP most of the time for purely technical concerns. It is not especially better, it is just that well we have OO languages and that we use what our languages can do.

An interface is basically a glorified header file in C. (And an interface has nothing to do with OO, it has no behaviour). Many objects we use have no behaviour, but just data containers. The pattern we use are here for technical concern. How to be able to mock this service for testing ? How to be able to replace this implementation with another one ? How to ensure that we have only one instance of this thing at runtime ?

OOP is hype. OOP is a buzzword. It is usefull, but overlooked.</description>
		<content:encoded><![CDATA[<p>The question finally is what you are really doing in your software.</p>
<p>Many software do that :</p>
<p>- Listen for HTTP request with HTTP parameters<br />
- Embed theses parameters into a behaviour less object.<br />
- Send this object to the business layer that do nearly nothing but forward it to the access layer.<br />
- The access layer use it to generate a request to the database.<br />
- The access layer put the response to a list of behaviour less objects.<br />
- The business layer get the response from access and transform it to bring it back to the UI<br />
- The UI show it on the screen.</p>
<p>If you really try to understand this pipeline, you see that this design :<br />
- Allow easy changes : UI / Access can be changed with minimal impacts<br />
- Allow good encapsulation : UI can corrupt Access/Business data. And Access can&#8217;t corrupt Business/UI data too.<br />
- That this not OOP at all. This is a plain procedural pipeline. This is simply a very good pratice. Not everything fit in an OOP way. Basically in this design, we might use object and interfaces, but we don&#8217;t do OOP other that for technical reason and because we do program with an OO language.</p>
<p>Then there is no need at all to use getter/setters. They serve nothing. Public fields are more consise. Using a map can even be a better choice if you don&#8217;t mind having type/name information at runtime only. Then your business layer and access layer is reduced to nearly nothing and use 99% the same generic code. (Think about ActiveRecord).</p>
<p>The thing is that theses sort of applications are in reality data driven. The more objects, the more OOP you try to bring in (using ORM with complex class hierachy for exemple), the more complex your project become and the more problems you have. Introducing OOP in this sort of application is just introducing what we call an impedance mismatch.</p>
<p>Why they are data driven ? Because basically all you do is CRUD operations. There is nearly no business. Just a UI and a database. That&#8217;s why plain old PHP is so good for that sort of applications/website. You don&#8217;t loose time on useless OO design. You design your datamodel instead.</p>
<p>All data intensive applications have the same sort of concern. 3D Video games for exemple. At first using objects everywhere seems good. But then your data are not ordered and aligned in memory. You have lot of cache miss, because you loose spacial proximity. Your graphic card (that is a giant pipeline) rely on spacial proximity and have cache everywhere. What your GPU want is a big array of data. But if you use too much objects, too much new everywhere instead of big array, your performance will be abyssal hurting the hardware.</p>
<p>A good architechture is not something that we choose because we like it, even because it is beautifull, but because it is efficiant and simple.</p>
<p>You should think OO when you really need the concepts. When coupling data and code make sence and really help the modelisation of your domain. When polymorphism bring really something interresting to the table.</p>
<p>There is a hint of the limitations of OOP. A hint that nearly everybody have seen at school. Of course the teacher didn&#8217;t speak about them. You guess what is it ? Well it is the examples you are given to understand OOP.</p>
<p>When you are lucky, they give you good exemple like an UI framework (where any specialised widget appear to be a standard widget with a specialized behavior).</p>
<p>But how many time your are given silly exemple ? Like animal that make smell ? Vehicules with it subhierarchy (Car / Plane&#8230;) that just have a method that print the noise they make ? Or shape that draw themselves ?</p>
<p>Do you understand what is the real problem about theses examples ? You&#8217;ll never have to modelize something like that in most softwares. The best OOP example you are given are simply useless theoretical example that nobody care about in reality.</p>
<p>Well you can have the exemple of the library. And you will modelize it. Just for the fun&#8230; Try it to modelize it with a data driven approach (3NF, relationnal databases and all) and try to not espacialy use objects concepts. You&#8217;ll see that your design with be perfectly right and efficiant.</p>
<p>In most modern project we don&#8217;t use OOP to modelize something real. No. Oh we do use pattern. An abstract factory, a singleton,  things like that. We use inheritence to reuse code more than to really modelize a class hierarchy that as sence for the domain.</p>
<p>We use  OOP most of the time for purely technical concerns. It is not especially better, it is just that well we have OO languages and that we use what our languages can do.</p>
<p>An interface is basically a glorified header file in C. (And an interface has nothing to do with OO, it has no behaviour). Many objects we use have no behaviour, but just data containers. The pattern we use are here for technical concern. How to be able to mock this service for testing ? How to be able to replace this implementation with another one ? How to ensure that we have only one instance of this thing at runtime ?</p>
<p>OOP is hype. OOP is a buzzword. It is usefull, but overlooked.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

