<?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 James Ezeh on Medium]]></title>
        <description><![CDATA[Stories by James Ezeh on Medium]]></description>
        <link>https://medium.com/@jamesezeh?source=rss-faa78243bd3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*b9xOpoCK-KjjZTTp.</url>
            <title>Stories by James Ezeh on Medium</title>
            <link>https://medium.com/@jamesezeh?source=rss-faa78243bd3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 13:08:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jamesezeh/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[What does my customer want]]></title>
            <link>https://medium.com/@jamesezeh/what-does-my-customer-want-88837b1981a2?source=rss-faa78243bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/88837b1981a2</guid>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[customer-service]]></category>
            <dc:creator><![CDATA[James Ezeh]]></dc:creator>
            <pubDate>Wed, 16 Jan 2019 22:47:36 GMT</pubDate>
            <atom:updated>2019-01-16T22:47:36.653Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*i_cpuILoLJ8o5jmKNGQNXA.jpeg" /><figcaption>First this picture has nothing to do with this post(just the funny face)</figcaption></figure><p>What does my customer want</p><p>Running a business without customers is a nightmare for anyone , it&#39;s like having a product with no one to pay for it. Customers are very necessary and that justifies the question &#39; What does my customer want ?&#39;.</p><p>Every business is out to deliver a product, either physical or service based. Our customers come to us because they are interested in what we deliver, however to ensure they keep returning, we have to know what they really want and then make sure they get it.</p><p>People buy for different reasons, it&#39;s not entirely tired to the product. The value a customer receive when they do business with you is entirely based on what they consider as valuable. Value can mean different things to different people. We do not get to decide what they want, a customer&#39;s perception of value is entirely based on what him or her consider as important.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88837b1981a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TRANSACTIONS and CONSISTENCY]]></title>
            <link>https://medium.com/@jamesezeh/transactions-and-consistency-1b61fcba76f3?source=rss-faa78243bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b61fcba76f3</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[pdo]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[php-developers]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[James Ezeh]]></dc:creator>
            <pubDate>Sun, 15 Apr 2018 00:32:02 GMT</pubDate>
            <atom:updated>2018-04-15T00:38:48.019Z</atom:updated>
            <content:encoded><![CDATA[<p>ENSURING DATA INTEGRITY</p><p>There could be situations, mostly unforeseen scenarios when the safety of an application data can be compromised.</p><p>Assuming our application handles payment/transfer of fund from one account to another, usually this will require updating the balance record for both accounts, in other to reflect the transaction been carried out.</p><h4>WHAT IF ???????????</h4><p>What if, after updating the first account from which payment is been made from and just before processing the second update query, there happen to be a connection problem (i.e connection was lost), maybe a system shutdown or worst a server broke down.</p><h4>Analyse the situation</h4><p>We successfully withdrew and updated the payer’s account but as a result of an unexpected occurrence, the second account was not updated and money is lost, because our database will reflect that money was withdrawn but no one was paid.</p><h4>HOW TO AVOID THIS</h4><p>PDO Transactions protect data integrity by ensuring that a process is either completed (<em>hundred percent</em>) or does not happen at all. i.e, with the example above, if a problem occur before updating the second account, there will be a total rollback and no transaction will take place.</p><p><strong><em>PDO DATA OBJECT </em></strong>provides three methods for Transactions:</p><p>PDO :: beginTransaction();</p><p>PDO :: commit();</p><p>PDO :: rollBack();</p><p><em>And I hope you are familiar with PDO</em></p><p>Once we begin a transaction by calling the beginTransaction() method, should something go wrong before commit() method is reached, PDO will automatically roll back with the rollBack() method. Hence, There will be no inconsistency in data if the unexpected occur.</p><p><strong><em>Transaction handling strategy :</em></strong></p><p>1 Start transaction (i.e beginTransaction()).</p><p>2 Using a try and catch block, wrap the database related code.</p><p>3 Commit changes within try block after all the updates have been carried out.(Commit()).</p><p>4 Roll back transaction in catch block (rollback()).</p><p><em>Illustration — — —</em></p><p>/* begin Transaction */</p><p>// $pdo-&gt;beginTransaction();</p><p>try{</p><p>// code</p><p>//code</p><p>/* commit transaction */</p><p>// $pdo-&gt;commit();</p><p>}</p><p>catch(PDOException $e){</p><p>/* roll back transaction */</p><p>// $pdo-&gt;rollBack();</p><p>//Throw $e</p><p>}</p><p>It will be also important to point out that only codes that update database and codes that can break data integrity should be handled in a transaction.</p><p>Below is a simple example:</p><p>/** class AccountManager */</p><p>class AccountManager extends Account</p><p>{</p><p>private $acc_name;</p><p>private $acc_number;</p><p>private $link;</p><p>public function __construct(PDO $link, string $accName, int $accNumber){</p><p>$this-&gt;acc_name = $accName;</p><p>$this-&gt;acc_number = $accNumber;</p><p>$this-&gt;link = $link;</p><p>}</p><p>public function makeTranfser(int $securityId, int $recieverNumber, int $amount) : bool {</p><p>if (! $this-&gt;checkAccExist($recieverNumber)){</p><p>throw new Exception(‘Invalid account Number’);</p><p>}</p><p>if (! $this-&gt;checkSecurityId($securityId)){</p><p>throw new Exception(‘Invalid security Id’);</p><p>}</p><p>// get account Balance</p><p>if ( $this-&gt;getAccountBalance($this-&gt;acc_number) ≤= $amount){</p><p>throw new Exception(‘Insufficient account balance’);</p><p>}</p><p>// begin PDO transaction</p><p>$this-&gt;link-&gt;beegintransaction();</p><p>try{</p><p>$query = ‘UPDATE balance SET amount = (?) WHERE accNumber = (?)’;</p><p>$debit = $this-&gt;link-&gt;prepare($query);</p><p>$newBal = $this-&gt;getAccountBalance($this-&gt;acc_number)- $amount;</p><p>$debit-&gt;bindParam(1, $newBal);</p><p>$debit-&gt;bindParam(2, $this-&gt;acc_number);</p><p>if(!$debit-&gt;execute()){</p><p>return false;</p><p>}</p><p>$query2 = ‘UPDATE balance SET amount = (?) WHERE accNumber = (?)’;</p><p>$credit = $this-&gt;link-&gt;prepare($query2);</p><p>$newBal = $this-&gt;getAccBalance($recieverNumber) + $amount;</p><p>$credit-&gt;bindParam(1, $newBal);</p><p>$credit-&gt;bindParam(2, $receieverNumber);</p><p>if(!$credit-&gt;execute()){</p><p>return false;</p><p>}</p><p>$this-&gt;link-&gt;commit();</p><p>return true;</p><p>}</p><p>catch(PDOException $e){</p><p>$this-&gt;link-&gt;rollback();</p><p>throw $e;</p><p>}</p><p>}</p><p>}</p><p>Thank you for finding time to read this, kindly clap once or twice to help others see this post too, Thanks a lot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b61fcba76f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[KEEPING IT DRY WITH PHP TRAIT]]></title>
            <link>https://medium.com/@jamesezeh/keeping-it-dry-with-php-trait-4e6c73d13275?source=rss-faa78243bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e6c73d13275</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[James Ezeh]]></dc:creator>
            <pubDate>Wed, 21 Mar 2018 20:48:07 GMT</pubDate>
            <atom:updated>2018-03-21T20:48:07.415Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>KEEPING IT DRY WITH PHP TRAIT</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/148/1*aqWDFFbKE72Tp72E-iRi8Q.jpeg" /></figure><p>One fundamental advantage of Object Oriented Programming is the ability to build reusable, maintainable programs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/1*i8BLSO4lcjz0Arg7X8nydQ.png" /></figure><h3><strong>D-R-Y</strong></h3><p>Don’t repeat yourself.</p><p>Keeping a code DRY have proven to be a productive approach. Hence to achieve this productivity, writing a reusable code becomes a necessity.</p><p>PHP introduced a feature that facilitate code reuse known as Trait.</p><p>A trait looks like a class but written as:</p><p>&lt;?php</p><p>Trait myTrait {</p><p>}</p><p>?&gt;</p><p>A trait implement a method that can be reused in several classes. Hence we implement once and reuse any where.</p><p>Note. Unlike a class, a trait cannot be instantiated but can only be used in a class.</p><p>Here is a simple illustration :</p><p>&lt;?php</p><p>Trait MyTrait {</p><p>public function myMethod(){</p><p>// method implementation</p><p>}</p><p>}</p><p>?&gt;</p><p>Now lets use our Trait in a class:</p><p>&lt;?php</p><p>require ‘mytrait.php ’;</p><p>class MyClass{</p><p>//add trait to class</p><p>use myTrait ;</p><p>public function classMethod(){</p><p>// method implementation</p><p>}</p><p>}</p><p>So, how helpful is a Trait?</p><p>A Trait is very helpful when we have two or more classes that implement the same method.</p><p>Example:</p><p>A car and a store class are two different &amp; unrelated classes but both classes should be geocodable into latitude an longitude coordinates for display on a map. Hence, what a trait does is to implement this common functionality once and use it in both classes.</p><p>At first we may decide to write a geocodable interface and let both class implement it, but that would go against the principle of reuse. Because we ended up writing the same functionality twice.</p><p>We could also write a geocodable class and let both store and car class extend it, but that will be a bad design decision.Because both classes are entirely unrelated.</p><p>Hence, by using Trait. Php provides the best approach in handling the problem.</p><p>Geocodable.php</p><p>&lt;?php</p><p>Trait Geocodable{</p><p>public function setAddress(){</p><p>// implementation</p><p>}</p><p>public function getAddress(){</p><p>// implementation</p><p>}</p><p>}</p><p>?&gt;</p><p>store.php</p><p>&lt;?php</p><p>require ‘Geocodable.php’;</p><p>class Store</p><p>{</p><p>use Geocodable;</p><p>}</p><p>?&gt;</p><p>car.php</p><p>&lt;?php</p><p>require ‘Geocodable.php’;</p><p>class Car</p><p>{</p><p>use Geocodable;</p><p>}</p><p>?&gt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e6c73d13275" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TO THE PROGRAMMER WHO WANTS TO BE BETTER]]></title>
            <link>https://medium.com/@jamesezeh/to-the-programmer-who-wants-to-be-better-5f28b9f37078?source=rss-faa78243bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f28b9f37078</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[php-development]]></category>
            <category><![CDATA[computer-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[James Ezeh]]></dc:creator>
            <pubDate>Sun, 04 Mar 2018 07:51:20 GMT</pubDate>
            <atom:updated>2018-03-04T07:51:20.013Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>TO THE PROGRAMMER WHO WANTS TO BE BETTER</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTd7EM53jEk4s8fixjoimg.jpeg" /></figure><p>Being a programmer comes with many benefits but it doesn’t come easy, every week i take the challenge of writing programs most of which are very complex.</p><p>One thing about coding is that it’s just like the work of an artist, you will always get an empty page, what you do with it and what your application turns out to be depends on you.</p><p>Let me quickly share what i learnt :</p><p>1 Always take on new projects, but first finish the last one. Do not abandon it until it works.</p><p>2 Carry out projects that challenge your logical thinking.</p><p>3 Always learn something new and use it when you code.</p><p>4 Do not abandon a project because you finding it difficult to complete, remember you are not done until it works. Ask questions, take a break if you can.</p><p>Now this is what I want to say to you:</p><p>As a programmer who is dedicated to being good in what he/she does, consistent improvement in technical programming skills is necessary.</p><p>Strive to improve your knowledge base, Grow your portfolio, learn a new language if you must, learn a new thing about the language you already know and improve your logical thinking.</p><p>Practice your art daily, consistency is the force behind improvement, always practice and write codes using existing and newly acquired knowledge/skill.</p><p>Practice with MINDFULNESS, mindful practice involves writing codes, making mistakes and fixing them so as to improve.</p><p>And Finally, You practice to improve, find your weaknesses and work on them.</p><p>Thanks for finding time to read this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f28b9f37078" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>