<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Steven Yap on Medium]]></title>
        <description><![CDATA[Stories by Steven Yap on Medium]]></description>
        <link>https://medium.com/@stevenyap?source=rss-d28fd398ffe1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TuedhO2uL9bj14b7.</url>
            <title>Stories by Steven Yap on Medium</title>
            <link>https://medium.com/@stevenyap?source=rss-d28fd398ffe1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:53:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stevenyap/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Easy Way To Write A Test Case]]></title>
            <link>https://medium.com/agile-lab/the-easy-way-to-write-a-test-case-54ccad7a9233?source=rss-d28fd398ffe1------2</link>
            <guid isPermaLink="false">https://medium.com/p/54ccad7a9233</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[test]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Steven Yap]]></dc:creator>
            <pubDate>Mon, 07 Dec 2015 08:00:42 GMT</pubDate>
            <atom:updated>2017-06-07T07:36:23.396Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*5sYbobFn51sc5VzkG1zXqQ.jpeg" /></figure><p>A lot of junior coders often complained to me that it is very difficult to write a test case even though they acknowledged that test cases are very important.</p><p>As most coders are not trained to write test cases, it can be a very daunting task to do for the uninitiated. In this blog post, I will present a very simple approach to writing your test cases.</p><h4>What is TDD?</h4><p>Before we go into writing a test case, you must understand what is test driven development (TDD). TDD means using test cases to drive your development. It can be broken down to three steps (in this specified order):</p><p>1) Red: Write a failing test case<br>2) Green: Write the code to pass the test case<br>3) Refactor: Refactor your code (including your test case code!)</p><p>We will write a test case first before writing the actual code. Naturally this test case will fail because there are no actual code to pass it (hence, red). Next we will write the actual code to pass the test (hence, green). Finally, we will refactor our actual code to make it better with the test case to protect us if we accidentally spoilt the code.</p><blockquote>You can’t refactor your code confidently unless you have a test case to cover it.</blockquote><p>So TDD can be summed up as Red-Green-Refactor. Through this cycle, we use test cases to drive our development. We achieve a higher code quality because we have a test case to cover our code which gives the affordance to refactor our code to be better.</p><h4>Why is TDD and test cases important?</h4><p>Test cases are important because they:</p><ul><li>Prevents you from breaking existing working codes</li><li>Prevents others from breaking existing working codes</li><li>Provides an updated specification of the app</li><li>Enables refactoring of code</li><li>Gives coders a peace of mind = happy coders</li><li>Rubyists write tests so you should too</li></ul><p>So we know test cases are important. But why can’t we write them <em>AFTER</em> the code? Isn’t it better? Isn’t it easier?</p><p>There are several advantages to write your test cases <em>FIRST</em> (in the style of TDD):</p><ul><li>It is actually easy to write a test case first</li><li>It helps you to make better object design decisions</li><li>It focus your thinking when writing the code later</li><li>It prevents false positive in your tests</li><li>You can use it for debugging eg. byebug or pry</li><li>You can refactor your code straight away!</li></ul><h4>How to write test case easily?</h4><p>A simple approach to write a test case is to think of behaviour, instead of implementation.</p><p>Let me give you an example.<br>Everyone knows how to use a calculator and how a calculator should behave.</p><p>We can use a calculator to help us to sum up numbers, say 1 + 1.</p><p>Input:<br>- Press 1<br>- Press +<br>- Press 1<br>- Press =</p><p>Output:<br>- Expect calculator to display 2</p><p>We understand easily what are the inputs we need and what are the outputs we expect.<br>When we perform the exact inputs, we expect the exact output.<br>If we don’t have the exact output, it means that the calculator is not working!</p><p>In the example above, do you know how does the calculator calculates 1 + 1 in order to return 2?<br>Unless you have knowledge of circuitry system, you will not be able to know the implementation.<br>However, without understanding the implementation of the calculator, we are still able to understand how should the calculator behave (ie. 1 + 1 should display 2).<br>This is the difference between behaviour and implementation.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><h4>Using behaviour thinking to test case</h4><p>So how do we translate thinking about behaviour into our test cases?<br>We just need to know the inputs and the outputs, and we can write our test cases.</p><p>In writing a test case, input is simply calling the method that we are testing and output is simply expecting the result from the method.</p><blockquote>Input = Calling the method<br> Output = Expecting the correct result<br> So Input &amp; Output becomes Call &amp; Expect.</blockquote><h4>Test case for Sum()</h4><p>Let’s play with a very simple example: write a test case for the method sum() which will return the sum of two parameters. eg. sum(1, 1) # =&amp;gt; 2</p><p>Remember “Call &amp; Expect”? To create our test case, we will <strong>call</strong> the method eg. sum(1, 1) and we will <strong>expect</strong> the result to be 2.</p><p>With the above call and expect approach, the test case becomes:</p><pre>RSpec.describe Calculator do<br>describe &#39;#sum&#39; do<br>it &#39;returns 2 for 1 and 1&#39; do<br>result = Calculator.sum(1, 1)<br>expect(result).to eq 2<br>end<br>end<br>end</pre><p>That’s it for our first test case! We can also easily triangulate it with another test case:</p><pre>RSpec.describe Calculator do<br>describe &#39;#sum&#39; do<br>it &#39;returns 2 for 1 and 1&#39; do<br>result = Calculator.sum(1, 1)<br>expect(result).to eq 2<br>end</pre><pre>it &#39;returns 8 for 3 and 5&#39; do<br>result = Calculator.sum(3, 5)<br>expect(result).to eq 8<br>end<br>end<br>end</pre><pre>This creates the test case first without us writing the code. Isn&#39;t this easy? :)</pre><pre>A More Difficult Example</pre><pre>Ok maybe sum() is a little too easy and not that practical. Let&#39;s do something really tough.</pre><pre>In mathematics, the Leibniz formula for π, named after Gottfried Leibniz, states that</pre><figure><img alt="Leibniz formula for π" src="https://cdn-images-1.medium.com/max/298/0*SqcqK203ceoEk1ly.png" /></figure><pre>Based on the formula, the more fractions (eg. 1/3, 1/5, 1/7) we used, the more accurate the value of π we will get.</pre><pre>Write a method to calculate the value of π that accepts a number n which is the number of fractions used to approximate the value of π using Leibniz formula.</pre><pre>Take a moment to understand the problem but please don&#39;t try to solve it.<br>Let me show you that is much easier to write the test case first, than the actual solution.</pre><pre>To write our test case, we think about &#39;Call &amp; Expect&#39; again.<br>In this problem, we will call the method with n which is an integer and we will expect it to give us the correct approximated π.<br>It is that easy.</pre><pre>Or not? er....</pre><pre>What should be the name of the method? Maybe approximate_pi()?<br>Where should I place this method? Maybe as a method under the module Calculator?<br>How should I call this method? Simply as Calculator.approximate_pi(6).</pre><pre>What should be the result to expect? We can get this easily by simply calculating (in Rails console) 4 * (1 - (1.0/3) + (1.0/5) - (1.0/7) + (1.0/9) - (1.0/11) + (1.0/13)) which we will get 3.2837384837384844.</pre><pre>In conclusion, we will call Calculator.approximate_pi(6) and we should expect 3.2837384837384844.<br>Call &amp; Expect: We have derived our test case!</pre><pre>Here&#39;s the code:</pre><pre>RSpec.describe Calculator do<br>describe &#39;#appromixate_pi&#39; do<br>it &#39;approximate pi to 3.283738 for 6 fractions&#39; do<br>result = Calculator.appromixate_pi(6)<br>expect(result).to be_within(0.1).of(3.283738)<br>end<br>end<br>end</pre><pre>As you can see from this example, it is much easier to create the test case than the actual solution itself.</pre><pre>Think about object design</pre><pre>From the approximate π example, while it is easy to think in terms of &#39;call &amp; expect&#39;, it may not be that easy to derive what to call in the first place.<br>This is because we need to make the design decisions on how to name the method, where to place the method and how to call the method.</pre><pre>Don&#39;t mistook these design decisions as additional work and time taken.<br>These design decisions have to be made even if you are writing the actual solution directly without the test case so there is actually no loss in time.</pre><pre>It is a matter of making the design decision in the test case before the actual code or in the actual code without the test case.</pre><pre>There is a positive side effect of making the design decision in the test case: You are using your object straight away in your test case just by the virtue of calling it. This allows you to validate if this is a good API to use. This side effect subconsciously drives better object design in your coding.</pre><pre>Focus on the actual solution now</pre><pre>With the test case written, you can focus on writing the actual code now. I find that the test case generally helps me to focus on the code on hand instead of worrying about the entire structure/flow/interaction/things-not-done-yet/etc. This gives me great productivity!</pre><pre>Furthermore, because my mind does not worry about the other uncompleted tasks, I have less stress writing my code now.</pre><pre>Test case makes me happy. :)</pre><pre>Refactor Now!</pre><pre>After you have finished the actual solution and your test cases are passing, you can refactor immediately (instead of spending time now to write the test case).</pre><pre>This is great because you just finished the actual solution and this moment is the moment where you understand the code the most.</pre><pre>Instead of being distracted to write a test case, you can immediately work on refactoring your solution.</pre><pre>Furthermore, after finishing the actual solution, you have a better understanding of the problem/solution which helps you to refactor your test cases (either by creating other test cases or refining the test cases to test more accurately).</pre><pre>This really maximise productivity.</pre><pre>Write test case first!</pre><pre>I hope I have convinced you why writing test cases first is important and also given you a simple easy approach to create test cases - Call &amp; Expect.</pre><pre>Ultimately, we all want productivity and happiness for developers. Writing test case first gives you more productivity and happiness in your development. Go forth now!</pre><pre>Image source from <a href="https://en.wikipedia.org/wiki/Sensory_processing_disorder">https://en.wikipedia.org/wiki/Sensory_processing_disorder</a></pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54ccad7a9233" width="1" height="1" alt=""><hr><p><a href="https://medium.com/agile-lab/the-easy-way-to-write-a-test-case-54ccad7a9233">The Easy Way To Write A Test Case</a> was originally published in <a href="https://medium.com/agile-lab">Agile Lab Blog | Agile Process | Startups | Web + Mobile Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Cron Jobs with Mina and Whenever]]></title>
            <link>https://medium.com/agile-lab/managing-cron-jobs-with-mina-and-whenever-53da1995a0e3?source=rss-d28fd398ffe1------2</link>
            <guid isPermaLink="false">https://medium.com/p/53da1995a0e3</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[mina]]></category>
            <category><![CDATA[hosting]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Steven Yap]]></dc:creator>
            <pubDate>Tue, 17 Nov 2015 10:30:52 GMT</pubDate>
            <atom:updated>2017-06-07T09:00:21.929Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*u6Zt6LnAZVodK1Mvv3Nw_Q.jpeg" /></figure><p>In this post, we discuss about the purpose of using a deployment gem like Mina and demonstrate how easy it is to customise the deployment process using Whenever (a cron job manager gem) as an example.</p><h3>What is Whenever</h3><p><a href="https://github.com/javan/whenever">Whenever</a> is a gem which makes our life easier to create, edit and delete cron jobs in our app. If you don’t know what is cron jobs, please read it <a href="https://en.wikipedia.org/wiki/Cron">here</a> in Wikipedia.</p><p>Using Whenever gem, we can easily specify all our cron jobs like this:</p><pre>every 3.hours do<br>runner &quot;MyModel.some_process&quot;<br>rake &quot;my:rake:task&quot;<br>command &quot;/usr/bin/my_great_command&quot;<br>end</pre><pre>every 1.day, :at =&gt; &#39;4:30 am&#39; do<br>runner &quot;MyModel.task_to_run_at_four_thirty_in_the_morning&quot;<br>end</pre><pre>every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot<br>runner &quot;SomeModel.ladeeda&quot;<br>end</pre><pre>every :sunday, :at =&gt; &#39;12pm&#39; do # Use any day of the week or :weekend, :weekday<br>runner &quot;Task.do_something_great&quot;<br>end</pre><pre>every &#39;0 0 27-31 * *&#39; do<br>command &quot;echo &#39;you can use raw cron syntax too&#39;&quot;<br>end</pre><pre># run this task only on servers with the :app role in Capistrano<br># see Capistrano roles section below<br>every :day, :at =&gt; &#39;12:20am&#39;, :roles =&gt; [:app] do<br>rake &quot;app_server:task&quot;<br>end</pre><pre>This way of specify our cron jobs is not only easier to understand, it also declares the cron jobs that are needed in the app clearly. Since cron jobs are also part of the whole app, it is important that we capture them in the app code base and also in our git repository.</pre><pre>If we manually write the cron jobs in the production server, the cron jobs will be hidden from our day-to-day work which creates unknown performance overheads or even time-bombs in new server deployment.</pre><pre>Hence, we prefer using Whenever over manually writing the cron job in the production server.</pre><pre>To generate the cron jobs, you simply run bundle exec whenever --update-crontab.<br>To clear the cron jobs, you can run bundle exec whenever --clear-crontab.<br>It is that easy!</pre><pre>What is mina</pre><pre><a href="https://github.com/mina-deploy/mina">Mina</a> is an alternative deployment gem to <a href="https://github.com/capistrano/capistrano">Capistrano</a>. It is much faster and easier to setup so we recommend it to many startups or web apps that do not require a complicated deployment process.</pre><pre>After you have bundled Mina and ran its installation, Mina will create a file at config/deploy.rb. Everything you need to know about how to deploy your app can be found there.</pre><pre>You can easily add custom tasks in your deployment like this:</pre><pre># config/deploy.rb<br>task :down do<br>invoke :maintenance_on<br>invoke :restart<br>end</pre><pre>task :maintenance_on<br>queue &#39;touch maintenance.txt&#39;<br>end</pre><pre>task :restart<br>queue &#39;sudo service restart apache&#39;<br>end</pre><pre>Main Purpose of a Deployment Script</pre><pre>The purpose of using Mina (or any other deployment gems) is to let us have pain-free deployment to server whenever we have new codes.<br>We want to just type mina deploy and our deployment script pushes all the new code to server and deploy everything for us without us remembering server login password, after deployment tasks like changing file permissions, etc, etc, etc.</pre><pre>This is not only painless and joyful for developers, it is also a much more productive and stable deployment process.</pre><pre>To make this a reality, all the knowledge of setting up or deploying to the server for the app to run properly must be captured in the deployment script. In this case, it&#39;s our Mina deployment script config/deploy.rb.</pre><pre>For the case of Whenever cron jobs, we want it to be such that every time we deploy to the server, Mina will automatically create the cron jobs using Whenever.<br>This will ensure that our cron jobs are always kept up to date and we will not &#39;forget&#39; to update the cron jobs if we make any changes in Whenever.</pre><pre>This is happy deployment thinking. :)</pre><pre>Adding Whenever Task to Mina Deployment</pre><pre>To let Mina create our cron jobs through Whenever, we need to create a custom task in config/deploy.rb.</pre><pre>Let&#39;s name this custom task :update_cron_jobs.</pre><pre>Why not name it :update_whenever_cron_jobs?<br>  By naming our methods by their function (ie. what they do), it will be easier to re-use or modify in the future.<br>  If we name the task as :update_whenever_cron_jobs, we have to change the name again if we use another gem instead of Whenever.<br>  Through naming by function, we won&#39;t have to change the task name even if we change the implementation.</pre><pre>Here&#39;s the :update_cron_jobs task:</pre><pre># Whenever tasks in config/deploy.rb<br>desc &quot;Update cron jobs&quot;<br>task :update_cron_jobs =&gt; :environment do<br>queue &quot;bundle exec whenever --update-crontab --set &#39;path=#{app_root_directory}/current/&#39;&quot;<br>queue %[echo &quot;-----&gt; Updated Whenever cron jobs.&quot;]<br>end</pre><pre>There are some booby traps here:</pre><pre>1) We need to set the identifier to a unique name (generally we choose our app name).<br>This is important as the default behavior of Whenever is to use the current path which, in the case of Mina deployment, is unique every time we deployed.<br>Therefore, if you did not set the identifier, each time you invoke :update_cron_jobs, there will be duplicated cron jobs created in the server because Whenever cannot identify its previously generated cron jobs. (One of our production servers died this way... :( )</pre><pre>Every time you deploy via Mina, Mina will push your code into a new folder /releases/ and then if the deployment is successful, Mina will symlink #{app_root_directory}/current to the new release folder.<br>  A symlink is like a shortcut or pointer that points to another location.</pre><pre>2) The Whenever command line is actually executed from the /releases/ folder so we want to explicitly set the path for the cron jobs generated (--set &#39;path=#{app_root_directory}/current/&#39;).<br>This generates a more consistent and stable cron jobs.</pre><pre>3) Make sure you set the #{app_root_directory} correctly in your Mina deploy script.</pre><pre>Once we have the task, we can easily add it into the Mina deploy script.<br>Just add the line invoke :update_cron_jobs in your config/deploy.rb like below:</pre><pre>desc &quot;Deploys the current version to the server.&quot;<br>task :deploy =&gt; :environment do<br>deploy do<br>invoke :&#39;git:clone&#39;<br>invoke :&#39;deploy:link_shared_paths&#39;<br>invoke :&#39;bundle:install&#39;<br>invoke :&#39;rails:db_migrate&#39;<br>invoke :&#39;rails:assets_precompile&#39;</pre><pre>invoke :update_cron_jobs</pre><pre>to :launch do<br>queue &quot;mkdir -p #{deploy_to}/#{current_path}/tmp&quot;<br>queue &quot;touch #{deploy_to}/#{current_path}/tmp/restart.txt&quot;<br>end<br>end<br>end</pre><pre>Now you can run mina deploy and the deployment script will run the :update_cron_jobs task to update your cron jobs automatically!<br>To double check that the cron jobs are created correctly, you can run crontab -l on your production server.</pre><pre>Conclusion</pre><pre>The purpose of using a deployment gem like Mina is to reduce our workload and potential mistakes in deployment. As shown in this post, it is very easy to add a custom task to Mina and make it execute automatically every time we deploy.</pre><pre>In building our app, we would want everything to be declared clearly and explicitly so that everyone&#39;s life will be easier for maintenance, bug hunting and ramping up another coder. Whenever gem helps our coding practice in this cron jobs aspect.</pre><pre><a href="https://en.wikipedia.org/wiki/Data_center">Image source</a></pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53da1995a0e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/agile-lab/managing-cron-jobs-with-mina-and-whenever-53da1995a0e3">Managing Cron Jobs with Mina and Whenever</a> was originally published in <a href="https://medium.com/agile-lab">Agile Lab Blog | Agile Process | Startups | Web + Mobile Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why We Build Your Web Applications and Startups Using Ruby on Rails]]></title>
            <link>https://medium.com/agile-lab/why-we-build-your-web-applications-and-startups-using-ruby-on-rails-489e5dc08afb?source=rss-d28fd398ffe1------2</link>
            <guid isPermaLink="false">https://medium.com/p/489e5dc08afb</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Steven Yap]]></dc:creator>
            <pubDate>Wed, 04 Nov 2015 09:53:27 GMT</pubDate>
            <atom:updated>2017-06-07T08:57:51.237Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*OPnpJQ4Qda0VYEctNvxGNg.jpeg" /></figure><p>People commonly asked us why we use Ruby on Rails and not other frameworks like Python Django, Java Spring, etc. Many people would expect a framework feature-by-feature comparison answer from us and sadly, we do not really provide that. What we usually share is the culture, community and thinking of the Ruby on Rails <a href="http://rubyonrails.org/community/">community</a> that makes it the winning combination for web applications and startups.</p><h4><strong>Rapid Development</strong></h4><p>First off, we need to understand that startups generally have lower budget and limited time. A startup has a new idea and normally it is not validated (at least not thoroughly yet). The startup would not want to spend more than 6 months to build the idea. That’s too long and too costly to do so. If the idea failed, the startup would have wasted a lot of time and resources. So a startup typically needed a way to develop their idea (or at least a prototype) fast that is good enough to go to the market.</p><p>Ruby on Rails fits in very nicely for rapid development because one of Rails’ principle is convention over configuration. This means that Rails will choose a lot of ‘common sense’ configuration by default so that the developer can quickly jump into coding the application instead of wasting hours setting it up. As an analogy, to create a website you would need to setup 20 different configurations before you can start coding your first homepage. Would you prefer to set 20 configurations manually one-by-one or use a default set of 20 configurations and just change the ones that are different from the defaults? Most of other frameworks would require the developer to setup all 20 configuration before the developer is ready to start coding on the real functions of the application. Rails lets the developer to just jump straight into coding and start doing the real work.</p><h4><strong>Convention Over Configuration</strong></h4><p>In a bigger picture, convention over configuration also helps tremendously in setting the development culture for the startup team. Every developer has his/her own style of coding. This makes working together on the same code base for more than one developer a nightmare. Over time, the different of style of coding by each developer will make the code base more and more fragmented — eventually reaching an unmaintainable state. Convention over configuration forces developers to keep to the same coding convention and makes the code base readable for any Rails developer to work on. This is essential for growing your own development team.</p><p>Through convention over configuration, Rails adopts many common best practices in every succeeding version of Rails. For example, Rails added the asset pipeline in Rails 3 which optimises the way static assets are delivered in production site. By making asset pipeline a default in Rails, all developers are “forced” to use this best practice. From a startup perspective, this is great because your application will be up-to-date with the latest best practices. In case you are wondering, there is always an option to turn off or change the default configuration of Rails.</p><p>Rails continues to adopt more best practices such as russian doll caching, secret keys management, etc. This continuous improvement in the framework translates to best practice adoption in your web application and development. Developers learn and improve along with Rails. This provides good continuous education to the developers to ensure that they are up-to-date with the world’s current trends and practices.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><h4><strong>Test Driven Development</strong></h4><p>Other than a limited budget and time, a startup is almost always changing and adjusting its strategies to fit to the market. Combine that with the nature of software development which by itself is a fluid, ever-changing and endless refinement process. And now your startup web application is constantly undergoing small refinements (at best) to major overhaul (at worst). To manage a constant evolving software, the code base itself must be able to adapt to changes. Is anyone familiar with the problem of “fix one bug, two more new bugs appear” whenever you are adding refinements to your web application?</p><p>To prevent bugs and issues from surfacing while maintaining an evolving code base, we need test cases to prevent regression bugs. Not manual test cases, automated test cases. Automated test cases are test cases that we can run it from a command and it will test the web application automatically, quickly and painlessly. Imagine it as a computer software that automatically tests your applications to tell you if it is working correctly. Test cases ensures that the additional code that the developer has added does not cause more bugs in the application. This allows the code base to evolve without suffering from previous bugs or issues. This also gives startups a great peace of mind especially during those times where they are launching their web application to the public.</p><p>We really think that test cases are cool and wonderful — the salvation to evolving softwares. We think that everyone in the world should adopt it. But in reality, it is not really adopted by many frameworks and developers. In this respect, Ruby community is one of the most staunch adopters of test cases. Ruby developers are testing fanatics. Ruby community has such a large number of different testing libraries that Ruby developers are arguing among themselves which testing libraries or styles are better while developers in other frameworks are still arguing whether they should have test cases or not.</p><blockquote><strong>“Writing tests for units that are small and do only one thing is a real pain and feels unnatural. On the other side, writing units that are not small and do more than one thing is very simple — only much later you will feel the pain. Thus, working test driven puts the pain up front, and therefore help you drive good design.”</strong></blockquote><blockquote><strong>- </strong><a href="https://twitter.com/manuelkiessling"><strong>Manuel Kiessling</strong></a></blockquote><p>A test-driven Ruby culture has 2 wonderful “side-effects” in the community: better code quality through code refactoring and more stable open source Ruby libraries. This creates a high quality coding standard among Ruby developers and better code products that the community can use. Startups benefit from this by leveraging high quality community-contributed Ruby code to quickly develop their application. Win-win for both startup and developer.</p><p>As a side note, Ruby on Rails is a 10 year old (since 2005) framework while Ruby is already 20 years old! Many people may think that Rails is just trendy now, they failed to see the real value beyond the hype from the media. Developers stayed with Ruby on Rails because it brings them real benefits such as test driven development, convention over configuration, etc. All these translates to better development for startups and web application.</p><h4><strong>Rails Framework</strong></h4><p>Last but certainly not the least of all, Rails is a framework that seeks to maximise developer’s happiness and sustain productivity. As a developer myself who is passionate about coding, I want to relish the challenge of writing great code and producing great work for the world to use. I do not want to work in a stressed-out environment, fighting bugs, reading ugly codes and having low satisfaction in my work produced. Coding should be happiness. Ruby on Rails embraces this. The community embraces this. Any startup will definitely want productive and efficient developers working on their web application. Happy developers are more productive and more efficient at solving difficult problems. They produce much better work than stressed out developers.</p><p>In conclusion, choosing Ruby on Rails is not about choosing a framework. It is about choosing the community, the culture and the best practices that you wish to adopt into your startup and web application. Ruby on Rails provides one of the best (if not the best) culture and development needs for startups and web applications. Try it. You will love it. We already do. :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=489e5dc08afb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/agile-lab/why-we-build-your-web-applications-and-startups-using-ruby-on-rails-489e5dc08afb">Why We Build Your Web Applications and Startups Using Ruby on Rails</a> was originally published in <a href="https://medium.com/agile-lab">Agile Lab Blog | Agile Process | Startups | Web + Mobile Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Project Specifications Might Jeopardise the Success of Your Software]]></title>
            <link>https://medium.com/agile-lab/how-project-specifications-might-jeopardise-the-success-of-your-software-42efd8f456e3?source=rss-d28fd398ffe1------2</link>
            <guid isPermaLink="false">https://medium.com/p/42efd8f456e3</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[agile-process]]></category>
            <category><![CDATA[business]]></category>
            <dc:creator><![CDATA[Steven Yap]]></dc:creator>
            <pubDate>Sun, 08 Mar 2015 14:08:24 GMT</pubDate>
            <atom:updated>2017-06-07T09:12:21.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*bAXf08xX5lhlRqK489DEKQ.jpeg" /></figure><p>What is a project specification? It is a document that defines exactly (note the word exactly) the requirements developing a system, from beginning to the end of a project. Project specification is used in almost all web and mobile development processes. Normally, it is a very long exhaustive document for clients to read. Its purpose is to ensure that all stakeholders such as end-users, clients, developers or designers know exactly what to do for the project and acts as a binding document between the client and the developer to deliver on the features stated in the document. A project specification can also be evolved to include functional specification, design specification, user acceptance testing, etc. Nevertheless, it is a “complete” documentation to capture all requirements of the project.</p><p>So what’s wrong with using a project specification? Shouldn’t we write out clearly first what we do before we do it? Is that all part of diligent planning? What is the problem with this document method that has been used for so many years?</p><p>There is no problem in due diligent planning. In fact, we should all do it. Planning ahead enables us to anticipate problems before it comes up so that we can reach our goal on target and on time. However, let’s ask ourselves very truthfully: when is the last time everything goes according to plan?</p><h4>Changes, Changes, Changes!</h4><p>When you are dealing with a complex system, you are inevitably creating new ways for end-users to use the system. At the beginning of the project, you seek to write down everything into a project specification document. You are actually trying to guess best way to build this system and for end-user to use the system. The more complex the system, the more guesses and assumptions you are making. Now, make a guess how likely everything is going to turn out exactly as you planned. If you are lucky or if the project is a simple one, you would probably get it all correct. However, most of the complex projects we have developed turned out at least 30% to 70% different from what we originally conceived with the clients. If we had bound our project specification with our clients on every complex project, the end-result would not be a satisfactory product or even worse, an un-usable system for the end-users.</p><p>“Hey, maybe you guys are just not experienced enough to handle it.” Ok I heard the question and here’s my humble answer: maybe we are not experienced enough. And here is what my own experience tells me: project specification works for simple projects but not for complex projects. There are very little variables to a simple project such as a simple corporate website or a pretty straightforward shopping cart system. However, faced with a complex projects such as creating a new backend system for large corporate employees to use, a project specification rarely fits the bill. We have spent countless hours with the client to nail down all the requirements but only to be changed later due to operation constraints, as a result of newly discovered requirements or even worse, differing political agendas between departments. End of the day, the more we assume we know everything exactly in the beginning, the more we are proven wrong by the project in the end.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><p>I can’t help but feel that a project specification is analogous to a business plan. A business plan seeks to nail down all the requirements to start and operate a new business to profitability. However, market forces eventually create changes in the business plan. Inevitably, one has to adapt the changes into the plan in order to continue moving forward. Imagine the owner of the business plan refuses to change any part of his plan and stubbornly moves on. How likely is that going to bring success to the business? In the same context, how likely will a system be useful if we always stick to the project specification document in the beginning? You decide for yourself.</p><p><strong>The Ugly Truth of Project Specifications</strong><br>Most clients feel at ease when a project specification is created and written down to the last detail of what they want. They think that the developer will now have to fulfil and give them exactly what they want without any excuse to fail. However, this is the false illusion web developers love to create in clients.</p><p>The real truth is that the project specification is a binding document in which web developers present, to prevent client from changing the requirements or adding more scope to the project. Changes in a project inevitably leads to more development hours and hence, more cost for the developers. Developers need to control the client from making too many changes (something known as scope creep). In the beginning of the project, everyone knows the least about the project so the amount of requirements needed are the least. If the client did not say they need this requirement in the beginning and it is not captured in the project specification document, it is considered out of the agreed scope of project when the client makes a request to change later. By binding the client down to the written requirements, developers ensure that they limit their development hours to the project and hence, make a profit out of it.</p><p>There is absolutely nothing wrong with web developers making a profit out of client. If we don’t, how can we feed our family? However, as a web developer, our end goal is also to ensure client gets a product they want through our services. Using a project specification limits this customer satisfaction greatly. Generally it leads client and developers into a contract renegotiation at the end. When it comes to contract renegotiation, e.g. “this statement in the project specification means this, not what you interpret as that”, no one wins and no one will leave the table happily. We need a better solution.</p><h4>Agile Manifesto</h4><p>In my humble opinion, one of the greatest breakthroughs in web development methodology is the agile process. Its principles are stated very clearly in <a href="http://agilemanifesto.org/">http://agilemanifesto.org/</a>. One of the agile principles is “Responding to change over following a plan”. So how can we respond to changes? Planning is still very important and it cannot be eliminated. We still do a project specification document for our client but we have changed the form of it into a card-like system using <a href="http://pivotaltracker.com/">http://pivotaltracker.com/</a>. In this card-like form, changes can be made easily while maintaining a clear overview on all the requirements. We don’t bind our clients to the project specification or requirements. Client suggests improvements or changes to the system. Heck, we even suggest changes to the client (more often than the client themselves!) so as to build an even better product. We moved from contract negotiation to collaboration with the client (which is also one of the principles of agile process). End of the day, our client gets what they want and we are happy with our work (and the paychecks of course).</p><p>There is inherently nothing wrong with writing a project specification document. The error comes in when we assume that it will not be changed and everything will be developed accordingly without fail. The assumption that we know everything even before we develop the product will eventually be corrected by end-users or the market itself. A development contract should not be binding to a project specification but rather to the end goal itself. Client should be prepared for changes and seek flexibility in the contract and development methodology with the developer in order to produce a great final product together.</p><p>Agile development process understands the changing nature of the software projects and seeks to accommodate it rather than locking it in a project specification. It encourages more collaboration over contract or requirements negotiation and responding to changes over following an outdated project specification plan. End result is a better product and greater customer satisfaction.</p><p>So the next time you start writing the requirements of your project, remember that you are just guessing how it should be and whatever you wrote, would be subjected to changes later on.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F6fec28%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F6fec28%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href">https://medium.com/media/a959cf0dd8a781bfdc086de99ae00c5a/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42efd8f456e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/agile-lab/how-project-specifications-might-jeopardise-the-success-of-your-software-42efd8f456e3">How Project Specifications Might Jeopardise the Success of Your Software</a> was originally published in <a href="https://medium.com/agile-lab">Agile Lab Blog | Agile Process | Startups | Web + Mobile Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>