﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agile Toolkit Blog</title>
	<atom:link href="http://agiletoolkit.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://agiletoolkit.org/blog</link>
	<description>library updates, tips, information and more</description>
	<lastBuildDate>Sun, 13 May 2012 22:15:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Why Your Active Record Implementation is Example of a Poor Software Design?</title>
		<link>http://agiletoolkit.org/blog/best-active-record-in-php/</link>
		<comments>http://agiletoolkit.org/blog/best-active-record-in-php/#comments</comments>
		<pubDate>Sun, 13 May 2012 22:06:27 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Beginner tips]]></category>
		<category><![CDATA[Verison 4.2]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=893</guid>
		<description><![CDATA[Through Agile Toolkit I&#8217;m sharing with the world my improved vision for a better Active Record Implementation. I believe that the widely popular Active Record implementations are examples of a bad software design. Here is the reason. What is Active Record? Active Record pattern have been hugely popular due to adoption in Ruby on Rails [...]]]></description>
			<content:encoded><![CDATA[<p>Through Agile Toolkit I&#8217;m sharing with the world my improved vision for a better Active Record Implementation. I believe that the widely popular Active Record implementations are examples of a bad software design. Here is the reason.</p>
<p><span id="more-893"></span></p>
<h3>What is Active Record?</h3>
<p>Active Record pattern have been hugely popular due to adoption in Ruby on Rails and in other frameworks. (<a href="http://en.wikipedia.org/wiki/Active_record_pattern#Implementations">Active Record explained on wikipedia</a>). Typically a class is generated based on the database table schema. All the fields of the database are reflected as properties of the model. Class has several constructors allowing to load model directly by ID or search for records. Only one record can be loaded at a time.</p>
<h2>Why Classic Active Record is Broken?</h2>
<h3>No Testability</h3>
<p>When the object is created, constructors does not accept reference to the database engine. Instead, they manage to pull it from some global namespace. That makes it very difficult to use Active Record with multiple database configuration or for testing.</p>
<h3>Static methods / Constructors</h3>
<p>A static method of a class which creates new instance of that class is called &#8220;constructor&#8221;. With Active Record there are multiple constructors present which can load record in a different ways. Number of constructors depend on the table structure in some implementation such as loadByCode() would only be applicable if &#8220;code&#8221; field exists.</p>
<h3>Abusive properties</h3>
<p>Potentially table can contain any field therefore model may have no &#8220;reserved&#8221; properties. That makes it virtually impossible to build any decent logic in the abstract model class.</p>
<h3>Code generation = duplication</h3>
<p>I am always amazed how same people preach about code re-use and how awful it is to copy-paste your code and then use code generators which effectively build thousands of lines of code for them. It might look good in your versioning system, but it is a very bad development practice.</p>
<h3>One table = one class</h3>
<p>While frameworks typically allow you to specify &#8220;parent class&#8221; in the YAML definition, in practice it is rarely used. We know that sometimes one table may contain different entity types, but Active Record implementations does not help in separating them into different classes.</p>
<h3>Operations with multiple records</h3>
<p>By definition Active Record object can hold one record only. If you need to iterate through multiple records you will end up creating and destroying objects, which introduces performance overheads.</p>
<h3>Lack of conditioning</h3>
<p>Active Record typically allow to load ANY record present in the table. It&#8217;s virtually impossible in many implementation of Active Record to restrict loading to certain types of data. That is, for example, implementation of soft-deletion. Implementing it often is <a href="https://github.com/technoweenie/acts_as_paranoid/blob/master/lib/caboose/acts/paranoid.rb">a major effort</a>.</p>
<h2>Recipe for an Improved Active Record</h2>
<h3>Dependency Injection</h3>
<p>There might be many variables model may require. Database driver object is one thing, but it might also require some other information. Specifying multiple objects for constructor is troublesome and inconsistent. My suggestion is to specify just one object which contains links to other necessary resources.</p>
<p>This object can be passed through the factory class. I have solved this problem having each object carry reference to such an object and whenever new object is created, it also receives that reference. That is a &#8220;api&#8221; class which can be used to reference database connection: $this-&gt;api-&gt;db. In practice, there may be multiple API classes, which makes it possible to inject dependency into any object.</p>
<h3>Avoiding Constructors</h3>
<p>If a model object could have a state where it is not associated with the database record, then the same object could be reused multiple times. If object is created first and then load() method is used to load new record from database then it can be subsequently called to add more records without the need to create model instance every time.</p>
<p>That means other methods can be used for loading data. As developer you may define new methods for data loading in your model classes which would override default methods.</p>
<h3>Avoiding using properties for fields</h3>
<p>In a database one field usually is a primary key. In most cases it&#8217;s called &#8220;id&#8221; but not always. If we want to introduce a property in our model, which will always refer to this primary key it may clash with non-primary key in a classic implementation of Active Record.</p>
<p>Fortunately PHP objects can also act as arrays. By using $model['name']=&#8217;John&#8217; the requests can be easily routed and saved inside internal array without polluting all of model property namespace. The $model-&gt;id then can always contain value of record&#8217;s primary key. Other operations are possible through methods set() and get(). $model-&gt;set($array);</p>
<p>In this implementation other model properties can be used internally by model business logic without affecting any fields.</p>
<h3>Avoid Code Generation</h3>
<p>Now that we have freed up properties of the Model class, we no longer need code generation. In fact we can configure model fields through PHP and store more meta-information for each field.</p>
<p>Not only that, but adding fields dynamically is now possible by using addField method. Native PHP calls are faster then using PHP to parse other file format. Native PHP is also more powerful and can allow you to define fields much more flexibly.</p>
<h3>One table = Many Classes</h3>
<p>Now we can inherit our models and add additional models and change behavior for the newly created classes. No longer there is one-to-one relation. You can also remove some field definition in your sub-classes if the field is not used for that business case.</p>
<p>Now you can create models for &#8220;User&#8221;, &#8220;Admin&#8221; and &#8220;Moderator&#8221; based on the same code-base and the same database table. Moderator, however, would have more methods/actions and might as well be able to address more fields in a table.</p>
<p>Ability to extend Models is a powerful strategy. It allows you to leave your existing code intact, but add a new model for your new use-cases. This greatly helps you to reduce amount of testing you need to perform after structural change of your database.</p>
<h3>Operation with multiple rows</h3>
<p>Now that the active record object have a state with no data, it can also be used as iterator through multiple records. What is great about our implementation is that for each iteration we simply need to load data from PDO into our internal array.</p>
<p>But let&#8217;s also add ability for a model to have conditions, which are automatically applied when loading data. By using conditions you can narrow down the selection of a model. Some models can even have default conditions, such as &#8220;Admin&#8221; model would only iterate through records with is_admin=&#8221;Y&#8221;.</p>
<h3>Full Conditioning</h3>
<p>With the availability of transactions, we can now insert record into the database and then attempt to load it. If existing model conditions will let record to be loaded, then it was saved properly. Otherwise the newly saved model does not conform to the conditions and transaction must be canceled.</p>
<p>With this the model of &#8220;Admin&#8221; can no longer save non-admin users into the database. Full conditioning now gives us a great assurance that any widget, piece of code or any developer working with Admin model would have no way to bypass some of the restrictions.</p>
<p>What&#8217;s even more valuable in SaaS applications is the ability to introduce condition based on a currently-logged-in user. Removing the need to always check for record author and having it done automatically is a great piece of mind for the security focused people.</p>
<h2>Agile Toolkit delivers Improved Active Record Approach and more</h2>
<p>Model implementation in Agile Toolkit offers all of the solutions described above and much more including Joins, Expressions, Traversing and Behaviors. Found out more: <a href="http://agiletoolkit.org/doc/modeltable">http://agiletoolkit.org/doc/modeltable</a></p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/best-active-record-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Framework for Professional, Enterprise and Scalable development</title>
		<link>http://agiletoolkit.org/blog/a-framework-for-professional-enterprise-and-scalable-development/</link>
		<comments>http://agiletoolkit.org/blog/a-framework-for-professional-enterprise-and-scalable-development/#comments</comments>
		<pubDate>Tue, 08 May 2012 22:32:14 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=891</guid>
		<description><![CDATA[Have you seen some potential in Agile Toolkit? If you are still unsure if you should adopt it in your critical product, read the following introduction to Agile Toolkit. This introduction is oriented at senior software engineers and describe some of the problems Agile Toolkit will help you solve in the long run. Read More&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Have you seen some potential in Agile Toolkit? If you are still unsure if you should adopt it in your critical product, read the following introduction to Agile Toolkit. This introduction is oriented at senior software engineers and describe some of the problems Agile Toolkit will help you solve in the long run.</p>
<p><a title="Read More" href="http://agiletoolkit.org/learn/understand/wiz">Read More&#8230;</a></p>
<p>Or</p>
<p><a title="Agile Toolkit Presentation" href="http://public.iwork.com/document/?d=Agile_Toolkit_Present_2012.key&amp;a=p102985462">Watch Presentation Slides&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/a-framework-for-professional-enterprise-and-scalable-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agile Toolkit 4.2 is Released!</title>
		<link>http://agiletoolkit.org/blog/agile-toolkit-4-2-is-released/</link>
		<comments>http://agiletoolkit.org/blog/agile-toolkit-4-2-is-released/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 14:31:00 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Core changes]]></category>
		<category><![CDATA[Verison 4.2]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=882</guid>
		<description><![CDATA[Agile Toolkit 4.2 is now available to download from http://agiletoolkit.org/. This release is the result of a half year effort and is based on the feedback we have received on 4.1 version. It brings a lot of improvements and enhancements but the primary goal is to create a fully transparent and fully-documented underlying architecture and [...]]]></description>
			<content:encoded><![CDATA[<p>Agile Toolkit 4.2 is now available to download from http://agiletoolkit.org/.</p>
<p>This release is the result of a half year effort and is based on the feedback we have received on 4.1 version. It brings a lot of improvements and enhancements but the primary goal is to create a fully transparent and fully-documented underlying architecture and promote extensibility through add-ons. The syntax of a new version is compatible with 4.1 with some exceptions outlined in our <a title="Upgrade Notes for Agile Toolkit 4.2" href="http://agiletoolkit.org/whatsnew/4-2">upgrade notes</a>.</p>
<p>If you are new to Agile Toolkit — <a title="Interactive Introduction" href="http://agiletoolkit.org/intro/1">follow to our interactive introduction</a>.</p>
<h3>New Data Model</h3>
<p>Agile Toolkit have always had a powerful ORM manager, but the Active Record support was lacking. With 4.2 the base classes for Models and Relational Models are completely rewritten. The new structure is much more extensible and efficient. The syntax has been simplified considerably.</p>
<p>The Agile Toolkit have been well received in the small companies and with new release it now targets medium companies. Support for variety of relational databases now includes SQLite, PostgreSQL and can be extended very easily for any database supported by underlying PDO architecture. Agile Toolkit now also have a set of models which can be used with no-SQL databases, caches and transparent APIs.</p>
<p>Support for additional databases, techniques and protocols will be coming through add-ons.</p>
<h3>New CSS Framework</h3>
<p>Although the interface retains the similar look, the underlying CSS framework is now much more powerful. It&#8217;s been re-writen using lessCSS and is based on 12-column grid system. CSS classes are much easier to use and build your interface with. The alteration of the look can also be easily achieved, things like line radius, spacings, number of columns, footer behavior can be very easily changed through a very simple CSS configuration file.</p>
<h3>New Add-on architecture</h3>
<p>With the version of 4.2 minimum requirement for PHP is now 5.3. That enables the use of namespaces. With namespaces developing add-ons for Agile Toolkit is pure enjoyment. You will find a add-on developer guide on our documentation site, but what&#8217;s really important is that your add-on can rely on core user interface, other addons and contain both the library and UI elements. This makes it possible for addons to be quite awesome. Developer of payment gateway can now provide developers with the actual payment form instead of set of functions written in the low-level PHP.</p>
<h3>Fully Documented</h3>
<p>Agile Toolkit is coming from a closed-source environment. It was initially designed to be used within our web development company: <a title="Web App development Ireland UK" href="http://agiletech.ie/">Agile Technologies</a>. We have <a href="http://agiletoolkit.org/blog/why-i-created-agile-toolkit/">open-sourced our Agile Toolkit in early 2011</a> but it is only now that the documentation have matured enough for wide adoption.</p>
<h3>Become Agile!!</h3>
<p>For all web developers either freelancers or working for the companies <a title="Benefits of Using Agile Toolkit" href="http://agiletoolkit.org/commercial/benefits">there are many reasons</a> for using Agile Toolkit in your next project or in your company. If you need to look at some project examples, <a href="http://allianceindependentauthors.org/">here</a> <a href="http://my-tools.ie/">are some</a> <a href="http://www.elexu.com/">example</a> <a href="http://www.invest-game.com">sites</a> launched recently and built completely in Agile Toolkit. If your project has already started why not:</p>
<ul>
<li>develop Administrative Back-end using Agile Toolkit to save time.</li>
<li>re-build your model structure on Agile Toolkit ORM and improve security.</li>
<li>use Agile Toolkit for serving static pages and improve speed.</li>
</ul>
<p>If you are in the need of custom web development using Agile Toolkit, consultancy, training or add-on development — <a href="http://www.agiletech.ie/contact/">our experienced team can offer you great solution</a> (we are now based in <strong>London, UK</strong>)</p>
<h3>We are hiring!</h3>
<p>Are you looking to join a great team to join which values great software design and your artistic programming skills? Would you want to collaborate as a part-time freelancer or a full-time employee? We have some great employment offers and real projects you can join. Contact jobs at agiletoolkit.org.</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/agile-toolkit-4-2-is-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Development Mailing List / Group Launched</title>
		<link>http://agiletoolkit.org/blog/development-mailing-list-group/</link>
		<comments>http://agiletoolkit.org/blog/development-mailing-list-group/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 16:27:20 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Verison 4.2]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=879</guid>
		<description><![CDATA[I would like to welcome anyone who wants to participate in brain-storming and helping with some testing of 4.2 into our new google group: https://groups.google.com/forum/#!forum/agile-toolkit-devel You can learn a lot buy learning fundamentals of Agile Toolkit.  I&#8217;m starting from the very bottom layers of the framework, so join in quick!]]></description>
			<content:encoded><![CDATA[<p>I would like to welcome anyone who wants to participate in brain-storming and helping with some testing of 4.2 into our new google group:</p>
<p>https://groups.google.com/forum/#!forum/agile-toolkit-devel</p>
<p>You can learn a lot buy learning fundamentals of Agile Toolkit.  I&#8217;m starting from the very bottom layers of the framework, so join in quick!</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/development-mailing-list-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to execute PHP code from JavaScript</title>
		<link>http://agiletoolkit.org/blog/how-to-execute-php-code-from-javascript/</link>
		<comments>http://agiletoolkit.org/blog/how-to-execute-php-code-from-javascript/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 11:10:33 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Beginner tips]]></category>
		<category><![CDATA[Brainstorming]]></category>
		<category><![CDATA[Verison 4.2]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=876</guid>
		<description><![CDATA[If you are only starting with PHP and Web Development, questions like &#8220;how to execute PHP from JavaScript&#8221; are inevitable. First I must say that JavaScript and PHP are living on the different sides of the fence and are simply throwing ball over to each-other. So your JavaScript needs a request to the PHP asking [...]]]></description>
			<content:encoded><![CDATA[<p>If you are only starting with PHP and Web Development, questions like &#8220;how to execute PHP from JavaScript&#8221; are inevitable. First I must say that JavaScript and PHP are living on the different sides of the fence and are simply throwing ball over to each-other. So your JavaScript needs a request to the PHP asking it to execute some code.</p>
<p>Unless you want to reinvent the wheel, you should look into using some <a href="http://ajaxpatterns.org/PHP_Ajax_Frameworks">AJAX / PHP library</a>. Agile Toolkit amongst other can be a great help when you want to build interaction between JavaScript and PHP.</p>
<p><span id="more-876"></span></p>
<h2>JavaScript event to trigger PHP function</h2>
<p>Before going into AJAX, here is how you could produce random numbers in plain JavaScript:</p>
<p>&lt;button id=&#8221;mybutton&#8221;&gt;Click Me&lt;/button&gt;<br />
&lt;script&gt;<br />
$(&#8216;#mybutton&#8217;).click( function(){<br />
$(&#8216;#mybutton&#8217;).text( Math.random() );<br />
}<br />
&lt;/script&gt;</p>
<p>Agile Toolkit comes up with an elegant way in PHP:</p>
<p>$mybutton=$this-&gt;add(&#8216;Button&#8217;)-&gt;setLabel(&#8216;Click me&#8217;);<br />
if($mybutton-&gt;isClicked()){<br />
$mybutton-&gt;js()-&gt;text( rand() )-&gt;execute();<br />
}</p>
<p><a title="Executing PHP code when button is clicked. AJAX and JavaScript events" href="http://codepad.agiletoolkit.org/buttonpushing" target="_blank">See this example in action</a></p>
<p><a title="JavaScript binding with PHP" href="http://agiletoolkit.org/learn/understand/chains" target="_blank">More information of Binding JavaScript actions to PHP</a></p>
<p>Code achieves same result, but the &#8220;Rand&#8221; value is calculated on the server. This code relies on the JavaScript function &#8220;ajaxec()&#8221; defined in JavaScript Utility library (Universal Chain).</p>
<h2>How to make it even better?</h2>
<p>Wouldn&#8217;t it be even greater if you could bind any action to any object like that?</p>
<p>$this-&gt;add(&#8216;H3&#8242;)-&gt;set(&#8216;Move mouse over&#8217;)-&gt;on(&#8216;mouseover&#8217;, function(){</p>
<p>$this-&gt;js()-&gt;text(&#8216;Thank you&#8217;)-&gt;execute();</p>
<p>});</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/how-to-execute-php-code-from-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Screencast Series for PHP Developers</title>
		<link>http://agiletoolkit.org/blog/practical-screencasts/</link>
		<comments>http://agiletoolkit.org/blog/practical-screencasts/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 17:07:18 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Beginner tips]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=873</guid>
		<description><![CDATA[I have asked few people in London, who was up to help me out with Screencasts. Few people responded who have some ideas they wanted to implement in Agile Toolkit. I was able to help them and recorded our sessions. I now have 8 hours of screencast footage, which I&#8217;ll be releasing to youtube. Subscribe [...]]]></description>
			<content:encoded><![CDATA[<p>I have asked few people in London, who was up to help me out with Screencasts. Few people responded who have some ideas they wanted to implement in Agile Toolkit. I was able to help them and recorded our sessions. I now have 8 hours of screencast footage, which I&#8217;ll be releasing to youtube.</p>
<p><a href="http://www.youtube.com/romaninsh/#p/a/u/1/0_OROS53Fq8">Subscribe to my channel on YouTube to see the screencasts as soon as I publish them</a>.</p>
<p>The first 6 one-hour sessions is about creating a simple Task Manager. Many thanks to Maurizio for his participations.</p>
<h2>Screencast with me!</h2>
<p>If you&#8217;ve got Skype and great idea for Agile Toolkit we could help each-other. I can help you move forward with your idea and I would get a material for a new screencast session. Please use contact form to send me your ideas.</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/practical-screencasts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sneak Peak into Agile Toolkit 4.2</title>
		<link>http://agiletoolkit.org/blog/sneak-peak-into-agile-toolkit-4-2/</link>
		<comments>http://agiletoolkit.org/blog/sneak-peak-into-agile-toolkit-4-2/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 23:39:40 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Brainstorming]]></category>
		<category><![CDATA[Core changes]]></category>
		<category><![CDATA[Verison 4.2]]></category>
		<category><![CDATA[Version 4]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=866</guid>
		<description><![CDATA[As we nearing our deadline fro 4.2 release a lot of cool features have been added into development branch of Agile Toolkit such as: Completely new &#8220;TMail&#8221; implementation Completely new &#8220;DB&#8221; implementation based on PDO Completely new &#8220;DSQL&#8221; implementation Completely new &#8220;Model&#8221; implementation Completely new SMlite implementation Improvements in Site Debugging The new implementations are [...]]]></description>
			<content:encoded><![CDATA[<p>As we nearing our deadline fro 4.2 release a lot of cool features have been added into development branch of Agile Toolkit such as:</p>
<ul>
<li>Completely new &#8220;TMail&#8221; implementation</li>
<li>Completely new &#8220;DB&#8221; implementation based on PDO</li>
<li>Completely new &#8220;DSQL&#8221; implementation</li>
<li>Completely new &#8220;Model&#8221; implementation</li>
<li>Completely new SMlite implementation</li>
<li>Improvements in Site Debugging</li>
</ul>
<p>The new implementations are functionally compatible with the 4.1 branch, although the do offer a number of benefits. In this article, I&#8217;ll highlight some of the new features about the new component implementation.</p>
<p>Another important feature of all the new modules is that they are are under heavy automated testing from the very start.</p>
<p><span id="more-866"></span></p>
<h3>What&#8217;s new in the &#8220;TMail 2.0&#8243;</h3>
<p>The TMail class actually been pushed into 4.1.3 release adds much more modularity as well as support for transports. Previously TMail would only send out emails through the mail() function, now it could be written into database, sent over Amazon SES, mail() or any combination of these.</p>
<p>There are also number of improvements in how TMail manages templates &#8211; it allow both HTML and Text part to be defined in your template and will automatically produce non-HTML version if you supply with the HTML only.</p>
<h3>What&#8217;s new in DB implementation</h3>
<p>Actually there is nothing new in the DB as compared to &#8220;DBlite&#8221;. You initialize database by calling $api-&gt;dbConnect() and it&#8217;s going to stay this way. To use the new database driver you would need to supply the &#8220;pdo&#8221; in the $config file.</p>
<p>DB implementation features a &#8220;query cache&#8221;, if a query is executed multiple times, it is prepared only once. This actually makes a lot of sense when you operate with models and parametric values.</p>
<h3>What&#8217;s new in DSQL implementation</h3>
<p>DSQL has been rewritten, but the fundamentals are the same. You create dsql() instance then call methods such as &#8220;field()&#8221;, &#8220;where()&#8221;. The new version is much more consistent about escaping arguments and handling of expressions. The new implementation completely relies on parametric nature of PDO, which proved to be a little more challenging to implement, but the interface have not been changed.</p>
<p>1. where(&#8216;id&#8217;,2);                    // equals<br />
2. where(&#8216;id&#8217;,'&gt;&#8217;,2);                // explicit condition<br />
3. where(array(&#8216;id&#8217;,2),array(&#8216;id&#8217;,3));    // or<br />
4. where(&#8216;id&#8217;,array(2,3));           // in<br />
5. where($dsql,4);                   // subquery<br />
6. where(&#8216;id&#8217;,dsql);                // in subquery<br />
7. where($dsql-&gt;expr(&#8216;length(name)&#8217;),123);      // expressions</p>
<p>The new are expression and sub-qureies, and DSQL does a great job figuring out all the parametric queries as you wildly join tables. Dsql now support iterators and the following syntax is permitted:</p>
<pre class="brush: php; title: ; notranslate">
$q=$this-&gt;api-&gt;db-&gt;dsql();
$q-&gt;table('books')-&gt;where('price&lt;',20);
foreach($q as $row){
    echo implode(',',$row).&quot;\n&quot;;
}
</pre>
<h3>What&#8217;s new in Model implementation</h3>
<p>It has become much simpler and modular. Also I&#8217;m adding implementation of interfaces which makes it possible to access active-record in a super-easy way. Here is an example of model use in 4.2 which implements Iterators and ArrayAccess:</p>
<pre class="brush: php; title: ; notranslate">
foreach($this-&gt;add('Model_Books')-&gt;addCondition('price&lt;',20) as $book){
    $author = $book-&gt;getRef('author_id')-&gt;sendNotification();
    echo $book['name'].&quot; by &quot;.$author['name'].&quot;\n&quot;;
}
</pre>
<p>Additionally field implementation is now implemented as number of classes, not just a single &#8220;FieldDefinition&#8221; class.</p>
<pre class="brush: php; title: ; notranslate">
$model-&gt;addField('name');
$model-&gt;addExpression('age')-&gt;calculated(function(){ return 'years(now())-years(birthday)'; });
$model-&gt;addReference('client_id')-&gt;setModel('Client');
</pre>
<p>In all 3 cases the field is defined by a different class which defines how the field is being queried. &#8220;Model_Table&#8221; is now implemented on top of &#8220;Model&#8221; class which is a very simple implementation of a model without data-source. This base class can be further extended to allow storing model data in No-SQL storage. Caching could also be further added through controllers.</p>
<p>Models have also some of their methods renamed shorter. Long version will continue to work throughout 4.2, but the use of shorter version is recommended.</p>
<pre class="brush: php; title: ; notranslate">

if(!$model-&gt;loaded())$model-&gt;load(3);
</pre>
<p>Models will also support proper joins in which you could define how new entries are being added.</p>
<p>The way how Models interact with Views and Controllers will be different. Currently $view-&gt;setModel(&#8216;abc&#8217;) initializes controller first and then initializes model. In 4.2, model is initialized first and placed inside $view-&gt;model() and then controller is initialized which imports fields into a form or grid. As a result, you will be able to use Models with &#8220;Form&#8221; and &#8220;Grid&#8221; classes, without the need for &#8220;MVCForm&#8221; and &#8220;MVCGrid&#8221;</p>
<p>This makes it possible to do many really interesting things for example create Form presenting fields from multiple models.</p>
<p>Also &#8220;reference&#8221; field is no longer needed as models can be used with &#8220;dropdown&#8221;.</p>
<h3>SMLite improvements</h3>
<p>The implementation of our Template Engine is really old but works well. It relies on explode()ing string into chunks then iterating through them. The new SMlite implementation will rely on regular expressions and will perform faster. Currently there are some technical issues with regular expressions, but I hope to overcome them before next release. There will be no new features for the template engine, I intend to keep it simple.</p>
<h3>Other improvements and Debug</h3>
<p>Overall the migration to use exception() method for raising exceptions proves to be quite rewarding. Errors now contain more useful information and are ready to be localized.</p>
<p>While in debug mode, it will be possible to extract additional information from your current errors. For instance if exception is raised inside Model, it adds a link to error message allowing you to reload the page with model&#8217;s debug enabled. This way you don&#8217;t need to add $m-&gt;debug() manually to spot the problem.</p>
<p>Additionally debugger will allow you to dump a complete tree of all the objects in the system highlighting the problem branch which produced an error.</p>
<p>On the user-interface side, the started installation of Agile Toolkit will feature a simple &#8220;inspector&#8221; so that you could visually see and understand your code as you start with Agile Toolkit, very similarly to <a href="http://codepad.agiletoolkit.org/" target="_blank">http://codepad.agiletoolkit.org</a>.</p>
<h3>Changes into atk4-addons</h3>
<p>I plan to discontinue atk4-addons repository and instead make those addons loadable and installable through a web interface. The initial package of Agile Toolkit will allow you to browse addons library and install them individually with a mouse click. Addons would be installed into atk4-addons folder.</p>
<h3>Documentation and Testing</h3>
<p>One of the reasons why DSQL, SMlite and Models are currently lacking in documentation is because I am not satisfied with their internal implementation and was planning to re-implement them for 4.2. I am planning to have our own &#8220;Documentation Viewer&#8221; and &#8220;Testing Engine&#8221; as downloadable add-ons as well as having the documentation available for you in off-line format as some users have been requesting.</p>
<p>More importantly you will be able to enhance documentation and test scripts with your own as your application grow in scale.</p>
<h3>Conclusion</h3>
<p>I&#8217;m looking forward to the 4.2 release this winter. As I have already mentioned, Agile Toolkit release cycle produces new major version once every half year. The version is compatible with previous release, however if you do run into some compatibility problems you can still use old TMail, SMlite or DBlite/Models.</p>
<p>Throughout the minor releases any changes are backwards compatible with the use of &#8220;Contoller_Compat&#8221; class.</p>
<p><strong>Many thanks for your continued interest in Agile Toolkit and I hope you are as excited about new changes as I am.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/sneak-peak-into-agile-toolkit-4-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Why I created Agile Toolkit?</title>
		<link>http://agiletoolkit.org/blog/why-i-created-agile-toolkit/</link>
		<comments>http://agiletoolkit.org/blog/why-i-created-agile-toolkit/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 18:12:23 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Beginner tips]]></category>
		<category><![CDATA[Version 4]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=845</guid>
		<description><![CDATA[Romans Malinovskis Author of Agile Toolkit I first have learned about Object Oriented in the age of 10, in 1990. I have already mastered BASIC and was exploring the world of Turbo Pascal. My young mind couldn&#8217;t grasp the ideas of in capsulation and polymorphism so I asked my mom to help out. She took [...]]]></description>
			<content:encoded><![CDATA[<div class="float-right" style="margin: 0 0 10px 20px;">
<div><a href="http://agiletoolkit.org/blog/wp-content/uploads/2011/10/romans-malinovskis-1.jpg"><img class="size-full wp-image-846  " title="romans-malinovskis-1" src="http://agiletoolkit.org/blog/wp-content/uploads/2011/10/romans-malinovskis-1.jpg" alt="" width="133" height="200" /></a></div>
<div class="small" style="margin-top: 5px;"><strong>Romans Malinovskis</strong><br />
Author of Agile Toolkit</div>
</div>
<p>I first have learned about Object Oriented in the age of 10, in 1990. I have already mastered BASIC and was exploring the world of Turbo Pascal. My young mind couldn&#8217;t grasp the ideas of in capsulation and polymorphism so I asked my mom to help out. She took the book and carefully kept re-reading the introduction.</p>
<p>&#8220;Objects. Think Objects&#8221;.</p>
<p>Years later I have been eager to apply the Object Oriented principles everywhere: the games I wrote, the demo-scene productions, my copy of multiplayer user dungeon. When I settled in as a Web Developer and learned PHP3.0 I was disappointed at the poor implementation of the objects.</p>
<p>The birth of Agile Toolkit was as soon as the Zend Engine 2.0 alpha was released. I started to re-wrote the framework I had into a new, powerful language. From the first versions the most important distinctive feature of Agile Toolkit today have been embedded into the very core of the framework.</p>
<h2>Rendering of the Runtime Object Tree</h2>
<p>2-3 decades have passed since the concept of Object-Oriented User Interface have been launched on the desk-top computers. The realization that the elements you can see on your screen have many similarities even through the look differently defines every Graphics User Interface today. To understand this concept Imagine a &#8220;button&#8221; and a &#8220;input field&#8221; next to each-other.</p>
<p><a href="http://agiletoolkit.org/blog/wp-content/uploads/2011/10/Screen-Shot-2011-10-30-at-01.38.39.png"></a><span style="font-size: 13px; font-weight: normal;"><a href="http://agiletoolkit.org/blog/wp-content/uploads/2011/10/Screen-Shot-2011-10-30-at-01.38.39.png"><img class="aligncenter size-full wp-image-848" title="Screen Shot 2011-10-30 at 01.38.39" src="http://agiletoolkit.org/blog/wp-content/uploads/2011/10/Screen-Shot-2011-10-30-at-01.38.39.png" alt="" width="214" height="35" /></a></span>Here a two object quite distinctive in their appearance are being rendered by the operating system by calling each object&#8217;s rendering function. The system may decide to force objects to re-render or skip rendering if they are not actually visible on the screen.</p>
<p>The exactly same idea is in the foundation of Agile Toolkit. Because I have been creating my own User Interface in Pascal and Assembler this was to me the best possible solution to interfaces in the Web Applications &#8211; implement them as a tree of visual objects generated during the run-time of your application and then rendering the necessary components.</p>
<h2>Making Interface More &#8220;Webby&#8221;</h2>
<p>Initial implementation of Agile Toolkit was only good to produce back-end administration systems as it was too in-flexible to do the requirements of the creative minds of our web-designers. Many UI Frameworks are destined with the same interface style, but Agile Toolkit was able to introduce a great breakthrough.</p>
<p>All the objects in Agile Toolkit, no matter how complex, are producing a valid HTML code based on object templates. This approach allows to easily change HTML behind individual or all objects and finally produce the great solution for website front-ends. However the default look and feel of Agile Toolkit application gives developers a great start.</p>
<h2>Progressive Enhancement</h2>
<p>By the time Agile Toolkit has matured the move towards Progressive Enhancements in CSS and Scripting made it possible to create a separate JavaScript layer which would  be optional for the elements. While earlier we would need to set &#8220;onchange&#8221; and &#8220;onsubmit&#8221; handlers into HTML baking templates extremely complex, now all of the JavaScript code have gone into a separate JavaScript API based on top of jQuery UI.</p>
<p>This allowed to purge all the JavaScript hacks from the code and rely on a much more powerful Object-oriented interface between JavaScript and PHP.</p>
<h2>Business Logic</h2>
<p>With the increasing complexity of our projects, it became apparent that a Objective Model layer is necessary. It finally appeared in Agile Toolkit in 2008 as an optional component. The models in Agile Toolkit serve a different role than the Models of other ORMs and Frameworks. Instead of only offering DataBase engine transparency and populating classes from data structures models in Agile Toolkit introduce a new dimension to modeling &#8211; inheritance. You can understand the power of this when you can narrow down values in the drop-down field by simply setting the right model to the reference definition. SQL Databases could not implement such flexibility but a PHP framework can.</p>
<h2>RoadMap for Agile Toolkit</h2>
<p>Up till now, Agile Toolkit had been walking a different path than other frameworks. Their goal was to provide developers with &#8220;utility&#8221; or a wrench to do certain things better. Approach of Agile Toolkit is to build levels of abstractions from the very bottom up. I must admit, that I can solve any web-related task with Agile Toolkit, but if I must produce a solution in clear PHP I feel lost and confused.</p>
<p>The immediate road-map for Agile Toolkit is to improve the 3 strengths it has by making it easier to interact and build. The &#8220;Model Builder&#8221; is in the works, which provides a visual interface to building new model fields and actually generating a PHP file as a result. The syntax of Models is already extremely simple but it will be even more so with the builder.</p>
<p>Another initiative is the User Interface builder. This allows create pages and add objects on your pages with a drag-and-drop interface. Similarly the tool would be capable of outputting a valid PHP code you can then further modify.</p>
<p>The number of Views and Templates will be made available through an on-line repository. In a way this would be similar to WordPress extensions, but tho time you will be installing classes which will aid you in building an Interface. The available views could be either free or paid creating a possible new revenue model for developers. A good example for such an view would be a &#8220;Gallery&#8221;. You could add this to any application you&#8217;ve got and bind it with the model holding images.</p>
<p>Unlike add-ons in other frameworks, the unified UI, JavaScript and Model structure makes sure that the add-on you are adding will fit-in perfectly, will be easily configurable to do the job and will contain minimum amount of code.</p>
<h2>Conclusion</h2>
<p>I adore web applications, but today it is way too complicated to build a web application. The situation reminds me the &#8220;DOS&#8221; and with Agile Toolkit I am able to introduce a Graphical User Interface for The Web.</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/why-i-created-agile-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Example code browser / inspector</title>
		<link>http://agiletoolkit.org/blog/new-example-code-browser-inspector/</link>
		<comments>http://agiletoolkit.org/blog/new-example-code-browser-inspector/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 20:33:09 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=851</guid>
		<description><![CDATA[I&#8217;m pleased to announce the update of the &#8220;codepad&#8221;, which has been transformed into much more powerful Example browser and Object inspector. http://codepad.agiletoolkit.org/ One awesome tool I&#8217;ve created in the process is the right-side &#8220;inspector&#8221;. Inspector examines the current page and objects on that page looping through them and finding objects which were added by [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the update of the &#8220;codepad&#8221;, which has been transformed into much more powerful <strong>Example browser</strong> and <strong>Object inspector</strong>.</p>
<p><a href="http://codepad.agiletoolkit.org/" target="_blank">http://codepad.agiletoolkit.org/</a></p>
<p>One awesome tool I&#8217;ve created in the process is the right-side &#8220;inspector&#8221;. Inspector examines the current page and objects on that page looping through them and finding objects which were added by the example. You can then mouse-over the objects to highlight the objects on the page or click to see source code of that class.</p>
<p>Enjoy all the examples and I plan to add more examples (from <a href="http://demo.atk4.com/" target="_blank">http://demo.atk4.com/</a>) soon.</p>
<h3>Download and Install Codepad</h3>
<p>Would you like to look further into how codepad works? You can <a href="https://github.com/atk4/atk4-codepad" target="_blank">get it from github</a>:</p>
<pre>git clone git://github.com/atk4/atk4-codepad.git
git submodule init
git submodule update</pre>
<p>Add your own examples into page/* to share them with your friends. You can also &#8220;fork&#8221; codepad and push back some of your own examples if you would like to see them in the Codepad.</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/new-example-code-browser-inspector/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Integrating Agile Toolkit with WordPress</title>
		<link>http://agiletoolkit.org/blog/integrating-agile-toolkit-with-wordpress/</link>
		<comments>http://agiletoolkit.org/blog/integrating-agile-toolkit-with-wordpress/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 03:14:24 +0000</pubDate>
		<dc:creator>Romans</dc:creator>
				<category><![CDATA[Beginner tips]]></category>
		<category><![CDATA[Version 4]]></category>

		<guid isPermaLink="false">http://agiletoolkit.org/blog/?p=829</guid>
		<description><![CDATA[The question I get asked a lot is how to integrate Agile Toolkit with other frameworks. One of the best qualities of Agile Toolkit is that it can be very nibble when you want to use it to fill the gap. So let&#8217;s scrap the whole page routing mechanics and simply create a SINGLE PHP [...]]]></description>
			<content:encoded><![CDATA[<p>The question I get asked a lot is how to integrate Agile Toolkit with other frameworks.</p>
<p>One of the best qualities of Agile Toolkit is that it can be very nibble when you want to use it to fill the gap. So let&#8217;s scrap the whole page routing mechanics and simply create a SINGLE PHP file which would work on it&#8217;s own. For this, you will need to have most up-to-date Agile Toolkit (4.1.3).</p>
<p><span id="more-829"></span>Download &#8220;Agile Toolkit&#8221; and un-pack in the temporary directory. Copy folder &#8220;atk4&#8243; into your wordpress directory.</p>
<p>Next open file test.php inside your wordpress and type the following:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
include 'atk4/loader.php';
$api=new ApiWeb('sample_project');
$api-&gt;add('jUI');
$api-&gt;add('H1')-&gt;set('Subscribe to Newsletter');
$form=$api-&gt;add('Form');
$form-&gt;addField('line','email');
$form-&gt;addSubmit('ok');
if($form-&gt;isSubmitted()){
$em=$form-&gt;get('email');
$form-&gt;js()-&gt;univ()-&gt;alert('Thank you for subscribing, '.$em)-&gt;execute();
}
$api-&gt;execute();
</pre>
<p>If you open this file in your browser, you&#8217;ll see a form with a field. You can now refer to samples on <a href="http://agiletoolkit.org/">agiletoolkit.org</a> site to customize or even create your own theme, but pretty much any code should work for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://agiletoolkit.org/blog/integrating-agile-toolkit-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

