<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>CoderOnCode</title>
    <description>Random ramblings about code, programming, and technology</description>
    <link>https://coderoncode.com/</link>
    <atom:link href="https://coderoncode.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 24 Dec 2017 14:25:13 -0500</pubDate>
    <lastBuildDate>Sun, 24 Dec 2017 14:25:13 -0500</lastBuildDate>
    <generator>Jekyll v3.0.1</generator>

    
      <item>
        <title>Ethereum Zero to Hero: Developing Our First Contract</title>
        <description>&lt;p&gt;This is the third part of our Ethereum Zero to Hero guide. If you have not read the previous post, I highly recommend checking it before moving forward.&lt;/p&gt;

&lt;p&gt;In this post we are going take were we left off and start developing a basic Smart Contract and learn more about solidity and how the contracts work.&lt;/p&gt;

&lt;p&gt;One of the most interesting qualities of the Ethereum blockchain is the &lt;strong&gt;ability create digital tokens&lt;/strong&gt;. Tokens are digital assets that can represent anything from &lt;strong&gt;coins&lt;/strong&gt;, &lt;strong&gt;loyalty points&lt;/strong&gt; to actual &lt;strong&gt;objects&lt;/strong&gt; in the physical world. Tokens can also be used to interact with other &lt;strong&gt;smart contracts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Tokens are sold and traded as a cryptocurrency inside the ethereum network and allows the user to pay for smart contract transactions fees, for our first contract we are going to create the &lt;strong&gt;minimum viable contract&lt;/strong&gt; needed to deploy on our private network.&lt;/p&gt;

&lt;h2 id=&quot;a-word-on-erc20&quot;&gt;A Word on ERC20&lt;/h2&gt;

&lt;p&gt;Often when dealing with Tokens, you will see the word ERC20 being referenced. &lt;strong&gt;ERC20&lt;/strong&gt; is a token standard that describes the functions and events that an Ethereum token contract has to implement, by following this standard we guarantee that tokens will be instantly compatible with the ethereum wallet and any other client or contract that uses the same &lt;strong&gt;standard&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In order for a token to be ERC20 complaint it must implement the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/74457e90bcdc3e2e650b0503458c4f07.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;For more details on ERC20 standard view the following links:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://theethereum.wiki/w/index.php/ERC20_Token_Standard&quot;&gt;ERC20 Token Standard&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md&quot;&gt;ERC20 Improvement Proposal (EIP)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-ethereum-wallet&quot;&gt;The Ethereum Wallet&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Ethereum Wallet is a gateway to decentralized applications on the Ethereum blockchain. It allows you to hold and secure ether and other crypto-assets built on Ethereum, as well as write, deploy and use smart contracts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Up to this point, we have worked directly on the &lt;strong&gt;Geth&lt;/strong&gt; console, and while I highly recommend &lt;strong&gt;Ethereum developers&lt;/strong&gt; to become familiar and acquainted with &lt;strong&gt;Geth&lt;/strong&gt; in order to understand some of the &lt;strong&gt;Ethereum&lt;/strong&gt; inner-workings in order to move faster and work smarter, we will switch to the official Ethereum wallet:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_01.png&quot; alt=&quot;Ethereum Wallet&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Make sure to &lt;a href=&quot;https://www.ethereum.org&quot;&gt;download&lt;/a&gt; and install the ethereum wallet before continuing.&lt;/p&gt;

&lt;h3 id=&quot;connecting-the-wallet-to-our-private-testnet&quot;&gt;Connecting the wallet to our private testnet&lt;/h3&gt;

&lt;p&gt;By default the &lt;strong&gt;Ethereum Wallet&lt;/strong&gt; will attempt to connect to the main network, as well it will allow you to connect to one of the test networks.&lt;/p&gt;

&lt;p&gt;For our purposes we want it to automatically start connected to our  testnet, so do the following before opening the wallet:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;DISCLAIMER&lt;/strong&gt;: The following operations will override any local information for the main network, this could potentially result in the loss of ether, be careful and understand the commands you are running.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
  &lt;li&gt;Stop the running geth node&lt;/li&gt;
  &lt;li&gt;Run the following command&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
geth --datadir ./TestNetData --identity &quot;HeroNode1&quot; --ipcpath ~/Library/Ethereum/geth.ipc  --networkid 24 --maxpeers 1 console
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we can open our ethereum wallet, and it should automatically connect to the test network, what we did was restarting our Geth node, and setting the IPC (Inter-process Communication) pipe in the same place the wallet has its default, by doing so the wallet will directly establish a connecting to our Geth node instead of creating one to the main network.&lt;/p&gt;

&lt;p&gt;Make sure the wallet is displaying the name of the network as &lt;strong&gt;Private-Net&lt;/strong&gt; before continuing.&lt;/p&gt;

&lt;h1 id=&quot;minimum-viable-token&quot;&gt;Minimum Viable Token&lt;/h1&gt;

&lt;p&gt;As we learned in the first post of this series, contracts are programmed using the &lt;strong&gt;Solidity&lt;/strong&gt; language; there are several tools available for &lt;strong&gt;compiling&lt;/strong&gt;, &lt;strong&gt;debugging&lt;/strong&gt; and &lt;strong&gt;writing&lt;/strong&gt; solidity contracts, for the time being, we are going to use solidity contract editor that is shipped with the ethereum wallet.&lt;/p&gt;

&lt;p&gt;Here is the code for our minium viable token:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/478e34db2acf1e7547a6c030c8296a03.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Now grab the source code from above and paste it in the &lt;strong&gt;Solidity Contract Source Code field&lt;/strong&gt;. The wallet will automatically check if the code &lt;strong&gt;compiles&lt;/strong&gt; and if it does, you will see a “pick a contract” dropdown on the right like so:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_02.png&quot; alt=&quot;Ethereum Wallet Contract&quot; /&gt;&lt;/p&gt;

&lt;p&gt;One interesting thing to notice is that there is also one constructor parameter, in this case, an initial supply of &lt;strong&gt;Hero Tokens&lt;/strong&gt;, that will be an issue on contract creation.&lt;/p&gt;

&lt;p&gt;If you keep scrolling down, you’ll see an &lt;strong&gt;estimate of the computation cost&lt;/strong&gt; of that contract, and you can select a fee on how much ether you are willing to pay for it. Don’t forget to set the initial number of tokens we will issue, now go ahead and click the “deploy” button.&lt;/p&gt;

&lt;p&gt;Next, you will see a confirmation dialog like the following:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_03.png&quot; alt=&quot;Ethereum Wallet Contract&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once the contract has been submitted, you should see it in the latest transactions below, waiting for confirmation. Usually, it should take around 30 seconds for the contract to be confirmed but, at this point, we could wait and wait, and nothing would happen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_04.png&quot; alt=&quot;Ethereum Wallet Contract&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is because there are no other nodes in the network and no one is mining, and ethereum much like Bitcoin right now works as a &lt;strong&gt;Proof of Work&lt;/strong&gt; network, I will not go into the details, but you can read the following article for a thorough explanation:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://keepingstock.net/explaining-blockchain-how-proof-of-work-enables-trustless-consensus-2abed27f0845&quot;&gt;Explaining blockchain — how proof of work enables trustless consensus&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s get our contract verified by jumping into our node console and typing:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
miner.start()
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It will take about 12 transactions for the contract to be confirmed, once that is done we can stop the miner by typing:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
miner.stop()
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Looking at the latest transactions our contract should be now verified, we can confirm that by going into the “&lt;strong&gt;Contracts&lt;/strong&gt;” tab and we should see our newly created contract.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_05.png&quot; alt=&quot;Ethereum Wallet Contract&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Click on it to go to its page. Click “copy address” and paste the contract address into a text editor, you will need it shortly.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_06.png&quot; alt=&quot;Ethereum Wallet Contract&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you click your wallet address, there is no indication of those tokens being there, did something went wrong? Well no, Wallets only track &lt;strong&gt;tokens&lt;/strong&gt; it knows about, and we have not told our wallet to track our brand new token.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_03_07.png&quot; alt=&quot;Ethereum Wallet Contract&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;tracking-tokens&quot;&gt;Tracking Tokens&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Go to the Contracts page&lt;/li&gt;
  &lt;li&gt;Click the Watch Token Button&lt;/li&gt;
  &lt;li&gt;A popup will show up, copy the address of the contract as well make sure to enter all the details&lt;/li&gt;
  &lt;li&gt;Click Ok&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now if you go back to your wallet you should see that is tracking tokens as the screenshot below.&lt;/p&gt;

&lt;p&gt;Congratulations! You successfully created your first token.&lt;/p&gt;

&lt;h1 id=&quot;next-steps&quot;&gt;Next Steps&lt;/h1&gt;

&lt;p&gt;While we successfully created a basic token, right now is not every useful. In the next post, we will improve our HeroToken contract and add more advanced functionality.&lt;/p&gt;
</description>
        <pubDate>Sun, 24 Dec 2017 14:21:37 -0500</pubDate>
        <link>https://coderoncode.com/blockchain/2017/12/24/ethereum-zero-to-hero-developing-our-first-contract.html</link>
        <guid isPermaLink="true">https://coderoncode.com/blockchain/2017/12/24/ethereum-zero-to-hero-developing-our-first-contract.html</guid>
      </item>
    
      <item>
        <title>Ethereum Zero to Hero: Setting a Development Environment</title>
        <description>&lt;p&gt;This is the second part of our Ethereum Zero to Hero guide. If you have not read part, I highly recommend it before jumping ahead.&lt;/p&gt;

&lt;p&gt;In this post, we are going to set up a basic private test-net environment for ethereum development and experimentation.&lt;/p&gt;

&lt;h1 id=&quot;step-0-requirements&quot;&gt;Step 0: Requirements&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;You are using &lt;strong&gt;MacOS&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;You have a basic understanding of software development&lt;/li&gt;
  &lt;li&gt;You know what Ethereum is and understand it is basic usage.&lt;/li&gt;
  &lt;li&gt;You have a basic understanding of &lt;strong&gt;MacOS Terminal usage&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;You have &lt;strong&gt;homebrew&lt;/strong&gt; installed&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;step-1-setting-test-net&quot;&gt;Step 1: Setting Test-Net&lt;/h1&gt;

&lt;p&gt;While we are learning the in’s and out’s of Ethereum development, we probably don’t want to test against the real production network with real ether.&lt;/p&gt;

&lt;p&gt;There are several Ethereum tests-nets out in the wild for this purpose &lt;strong&gt;Rinkeby&lt;/strong&gt; and &lt;strong&gt;Morden&lt;/strong&gt; for example; however interacting with this networks still requires for us to acquire ethereum either by mining, or getting ether from other users.&lt;/p&gt;

&lt;p&gt;While we will eventually work with the public test networks, for beginners like us that are just starting out, that is far from ideal, and it can be difficult to get significant amounts of ether.&lt;/p&gt;

&lt;p&gt;A better option is setting up our &lt;strong&gt;private testnet&lt;/strong&gt;, that we can bend and twist; as well it will allow us to gain a deeper understanding of the inner workings of the Ethereum network.&lt;/p&gt;

&lt;h3 id=&quot;lets-geth-going&quot;&gt;Let’s GETH Going&lt;/h3&gt;

&lt;p&gt;We will need to install the geth, a go CLI client that will allow us to run a full ethereum node locally.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
brew tap ethereum/ethereum
brew install ethereum
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We can verify that everything installed correctly by typing:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
geth version
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Which should give you an output similar to the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/82baa7aaeee50c1f20000474a569fc41.js&quot;&gt;&lt;/script&gt;

&lt;h1 id=&quot;step-2-genesis-block&quot;&gt;Step 2: Genesis Block&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/ethereum_01_genesis.jpg&quot; alt=&quot;Genesis Block&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To get our on private testnet started, we are going to need a Genesis Block. Every Blockchain requires a genesis block, which is essentially the configuration file for our blockchain.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The genesis block is the start of the blockchain - the first block, block 0, and the only block that does not point to a predecessor block. The protocol ensures that no other node will agree with your version of the blockchain unless they have the same genesis block, so you can make as many private testnet blockchains as you would like!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
  &lt;li&gt;Create a project directory, for example &lt;code class=&quot;highlighter-rouge&quot;&gt;ethereum_0hero&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Open your preferred editor and create a file named &lt;code class=&quot;highlighter-rouge&quot;&gt;HeroGenesis.json&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Copy the following contents and save the file:&lt;/li&gt;
&lt;/ol&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/bbdb2c3032ef4c6f33dde51275e127bb.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;As you can see the file contents are in json and for the most part self-explanatory, but let’s go over the each one of the parameters quickly to clarify their purpose.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;coinbase&lt;/strong&gt;: The 160-bit address to which all rewards (in Ether) collected from the successful mining of this block has been transferred. This can be anything in the Genesis Block since the value is set by the setting of the miner when a new block is created.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;timestamp&lt;/strong&gt;: A scalar value equal to the reasonable output of Unix time() function at this block inception. A smaller period between the last two blocks results in an increase in the difficulty level and thus additional computation required to find the next valid block.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;difficulty&lt;/strong&gt;: It defines the mining Target, which can be calculated from the previous block’s difficulty level and the timestamp. The higher the difficulty, the statistically more calculations a Miner must perform to discover a valid block. This value is used to control the Block generation time of a Blockchain, keeping the Block generation frequency within a target range. On the test network, we keep this value low to avoid waiting during tests, since the discovery of a valid Block is required to execute a transaction on the Blockchain.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;gasLimit&lt;/strong&gt;: A scalar value equal to the current chain-wide limit of Gas expenditure per block. High in our case to avoid being limited by this threshold during tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, the config parameters are there to ensure that certain &lt;strong&gt;protocol upgrades&lt;/strong&gt; are available from the get go.&lt;/p&gt;

&lt;p&gt;For a full explanation check this answer in &lt;a href=&quot;https://ethereum.stackexchange.com/questions/2376/what-does-each-genesis-json-parameter-mean&quot;&gt;stackexchange&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we will need to initialize our chain by running the following command:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
geth --datadir ./TestNetData init HeroGenesis.json
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Setting the data directory is important since otherwise we will override the default data directory for the &lt;strong&gt;real Ethereum network&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The output should return something similar to the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/f576f82eec2185d284d74fcaf6f6d5ba.js&quot;&gt;&lt;/script&gt;

&lt;h1 id=&quot;step-3-running-a-local-node&quot;&gt;Step 3: Running a Local Node&lt;/h1&gt;

&lt;p&gt;Now that we create our initial chain we can run it by executing the following command:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
geth --datadir ./TestNetData --identity &quot;HeroNode1&quot;  --rpc --rpcport &quot;8080&quot; --rpccorsdomain &quot;*&quot; --port &quot;30303&quot; --nodiscover --rpcapi &quot;db,eth,net,web3&quot; --maxpeers 0 --networkid 24 console
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command does a few things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Utilizes the &lt;strong&gt;Genesis block&lt;/strong&gt; we previously created&lt;/li&gt;
  &lt;li&gt;It uses a custom data directory instead of the default&lt;/li&gt;
  &lt;li&gt;Sets the network id to 24 to prevent us from talking from noes from the main network&lt;/li&gt;
  &lt;li&gt;Disables &lt;strong&gt;peer discovery&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Disables the network by setting up the maxpeers to 0&lt;/li&gt;
  &lt;li&gt;Launches the geth console so we can interact with the blockchain/node&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The output should be something similar to the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/ab86c647c3084a521478bddf9bd88b58.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;At this point, you should be up and running, and in the geth console ready to do something, but what?&lt;/p&gt;

&lt;p&gt;Well let’s switch attention to the following Warning:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;WARN No etherbase set and no accounts found as default&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We have node up and running, but it will not be much use without any accounts.&lt;/p&gt;

&lt;h1 id=&quot;step-4-creating-an-account&quot;&gt;Step 4: Creating an account&lt;/h1&gt;

&lt;p&gt;Since we are already in the Geth console is easier to ahead and create an account directly from there, in the terminal type the following:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
personal.newAccount()
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The console will ask for a passphrase &lt;strong&gt;DO NOT LOSE THIS!&lt;/strong&gt;, and return a has like the following:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
0xe857331e4e3354bb72b3751cce419c8444e89e17
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And let’s validate that the account exist by running:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
&amp;gt; eth.getBalance(&quot;0xe857331e4e3354bb72b3751cce419c8444e89e17&quot;)
0
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s put some ether into that account.&lt;/p&gt;

&lt;h1 id=&quot;step-5-lets-geth-mining&quot;&gt;Step 5: Let’s Geth Mining&lt;/h1&gt;

&lt;p&gt;Quick recap:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;We have a working private network with a single node running locally&lt;/li&gt;
  &lt;li&gt;We create a test account that on said private network&lt;/li&gt;
  &lt;li&gt;We do not have any ether in that account, and we need to fix that&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, while we could easily issue ether to our account using the &lt;strong&gt;Genesis block&lt;/strong&gt;, let’s have some fun and mine Ether on our private network.&lt;/p&gt;

&lt;p&gt;Open a new terminal tab and running the following command:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
get attach ./&amp;lt;DirectoryName&amp;gt;/geth.ipc
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will connect our second terminal to the existing geth instance and open the &lt;strong&gt;Javascript&lt;/strong&gt; console. Inside the console run the following:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
miner.setEtherbase(&quot;0xe857331e4e3354bb72b3751cce419c8444e89e17&quot;)
miner.start()
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If we go back to our first terminal we should see the following happening:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/fec3abd38afba4a80d87a23d3f2b17eb.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Let’s go back to the second terminal and stop the miner and check our balance:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
miner.stop()
eth.getBalance(&#39;0xe857331e4e3354bb72b3751cce419c8444e89e17&#39;)
75000000000000000000
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! We have now created our private network and mined our few amount of ether, and we have a valid network that we can use to developer our Smart Contracts and DApps.&lt;/p&gt;

&lt;p&gt;In the next post of the series, we will start developing with Solidity and Smart Contracts.&lt;/p&gt;

</description>
        <pubDate>Sun, 24 Dec 2017 14:21:31 -0500</pubDate>
        <link>https://coderoncode.com/blockchain/2017/12/24/ethereum-zero-to-hero-setting-a-development-environment.html</link>
        <guid isPermaLink="true">https://coderoncode.com/blockchain/2017/12/24/ethereum-zero-to-hero-setting-a-development-environment.html</guid>
      </item>
    
      <item>
        <title>Ethereum Zero to Hero: Introduction</title>
        <description>&lt;p&gt;2017 has arguably been the year of Cryptocurrency, with &lt;strong&gt;Bitcoin&lt;/strong&gt; being getting most of the spotlight; at the core of Bitcoin, we have the &lt;strong&gt;Blockchain&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Blockchain technology applications go way beyond digital currency, and one of the best examples is &lt;strong&gt;Ethereum&lt;/strong&gt; which is a decentralized platform that runs smart contracts.&lt;/p&gt;

&lt;p&gt;This allows developers to build enormously powerful decentralized applications, at this point there is still a lot of active development and innovation happening both around blockchain and ethereum.&lt;/p&gt;

&lt;p&gt;The downside of all this constant innovation and development is that tutorials, documentation, and resources go out of date quickly, this has made it difficult for developers like me (or you) to get a solid footing when getting started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This guide is not to mean to the end all or be all&lt;/strong&gt;, rather a quick introduction that can get you started quickly and hopefully agnostic enough that won’t go out of date too fast. With that said, let’s get started by reviewing some core concepts:&lt;/p&gt;

&lt;h3 id=&quot;smart-contracts&quot;&gt;Smart Contracts&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Contracts live on the blockchain in an Ethereum-specific binary format (EVM bytecode).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A smart contract is a piece of software that resides on the &lt;strong&gt;Ethereum&lt;/strong&gt; Blockchain. Like traditional contracts, smart contacts not only define the rules and penalties around an agreement but additionally the enforce those obligations.&lt;/p&gt;

&lt;h3 id=&quot;ethereum-virtual-machine&quot;&gt;Ethereum Virtual Machine&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;At the heart of it is the Ethereum Virtual Machine (“EVM”), which can execute code of arbitrary algorithmic complexity. In computer science terms, Ethereum is “Turing complete.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the core and primary innovation behind the Ethereum project. Each participant of the &lt;strong&gt;Ethereum&lt;/strong&gt; networks runs an instance of the virtual machine, and its purpose is to execute the smart contracts in a completely isolated environment, meaning no access to Network, Filesystem or other processes.&lt;/p&gt;

&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;/h3&gt;

&lt;p&gt;Gas is a concept unique to the ethereum platform and is way to limit the resources available to a given smart contract. For every instruction executed in the EVM, there is a fixed Gas cost associated with it.&lt;/p&gt;

&lt;h3 id=&quot;solidity&quot;&gt;Solidity&lt;/h3&gt;

&lt;p&gt;Solidity is a contact-oriented, high-level language for implementing smart contracts. The syntax resembles javascript and is influenced by languages like C++ and Python, and it compiles directly to EVM assembly.&lt;/p&gt;

&lt;h3 id=&quot;blockchain&quot;&gt;Blockchain&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;“The blockchain is an incorruptible digital ledger of economic transactions that can be programmed to record not just financial transactions but virtually everything of value.” - Don &amp;amp; Alex Tapscott, authors Blockchain Revolution (2016)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The best way to think about the blockchain is as decentralized &lt;strong&gt;immutable database&lt;/strong&gt; or ledger, that can permanently store any type data.&lt;/p&gt;

&lt;p&gt;The potential business applications for this technology are still being discovered and experimented with, but there are tons of examples online, to mention a few we have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Crowdfunding&lt;/li&gt;
  &lt;li&gt;Governance&lt;/li&gt;
  &lt;li&gt;File Storage&lt;/li&gt;
  &lt;li&gt;Protection of Intellectual Property&lt;/li&gt;
  &lt;li&gt;Identity Management&lt;/li&gt;
  &lt;li&gt;Property Registration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the next entry in this series we will set up a local development environment for creating our first &lt;strong&gt;smart contract.&lt;/strong&gt;&lt;/p&gt;

</description>
        <pubDate>Sun, 24 Dec 2017 14:21:20 -0500</pubDate>
        <link>https://coderoncode.com/blockchain/2017/12/24/ethereum-zero-to-hero-introduction.html</link>
        <guid isPermaLink="true">https://coderoncode.com/blockchain/2017/12/24/ethereum-zero-to-hero-introduction.html</guid>
      </item>
    
      <item>
        <title>5 Trends To Watch Out On 2018</title>
        <description>&lt;p&gt;With 2018 around the corner is prudent to take some time and see what new and existing trends will dominate 2018.&lt;/p&gt;

&lt;h2 id=&quot;blockchain&quot;&gt;Blockchain&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;In 2017 we saw many of the Silicon Valley giants experiment or even introducing their own blockchain implementations, IBM been the most significant one by collaborating with food distributors, government regulation agencies and banks for leveraging blockchain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;why-it-matters&quot;&gt;Why it matters&lt;/h4&gt;
&lt;p&gt;With applications ranging from cryptocurrency, to smart properties, to identity like passports; we have only started scratching the surface of what Blockchain technology can offer and in 2018 it won’t be a surprise if we see a rise in the creation and adoption of blockchain based application.&lt;/p&gt;

&lt;p&gt;In fact, in 2017 Amazon, Oracle, Microsoft and IBM all started experimenting and working on their own blockchain platforms, and in 2018 we will see more companies joining the bandwagon across a myriad of different fields.&lt;/p&gt;

&lt;h4 id=&quot;what-to-read-next&quot;&gt;What to Read Next&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/wtf-is-the-blockchain-1da89ba19348&quot;&gt;WTF is The Blockchain&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/learn-blockchains-by-building-one-117428612f46&quot;&gt;Learn Blockchains by Building One&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/your-company-will-use-blockchain-in-less-than-10-years-heres-how-6d9da452fa8d&quot;&gt;Every Company will use blockchain by 2027&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;

&lt;h2 id=&quot;conversational-interfaces&quot;&gt;Conversational Interfaces&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Conversational interfaces are nothing new, and while 2017 saw the birth of countless chatbots in all number of platforms, 2018 will be the year were conversational interfaces will continue growing and gain significant maturity.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;why-it-matters-1&quot;&gt;Why it matters&lt;/h4&gt;
&lt;p&gt;Conversation interfaces vary from voice recognition platforms like Siri, Alexa and Google Home; to hundreds of bots on platforms like Facebook, Telegram and Slack; but they all have one thing in common, they are slowly changing the way we interact with software.&lt;/p&gt;

&lt;p&gt;Regardless if its voice or text, in 2018 conversation interfaces will continue to provide an improved and more personalized user experience.&lt;/p&gt;

&lt;h4 id=&quot;what-to-read-next-1&quot;&gt;What to Read Next&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/the-promise-of-chatbots-personal-assistants-are-no-longer-just-for-the-rich-638da4b1444f&quot;&gt;The Promise of Chatbots&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://chatbotsmagazine.com/conversational-interfaces-the-future-of-chatbots-18975a91fe5a&quot;&gt;Conversational Interfaces: The Future of Chatbots&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;ai-will-take-over-&quot;&gt;AI will take over …&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;… but not in the way you think. In 2018 we will see a raise in solutions and applications augmented by the use Machine Learning/AI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;why-it-matters-2&quot;&gt;Why it matters&lt;/h4&gt;
&lt;p&gt;For many AI seems to be an all or nothing proposition, the reality is that AI is already here and contributing in unexpected ways. In 2018 we will see the transition from AI being somewhat of a buzzword and a nice to have, to an absolute necessity for startups and businesses.&lt;/p&gt;

&lt;p&gt;In 2017, there was a significant number of businesses using AI to drive financial and operation decisions, not only this trend will continue gaining steam but we will also see AI application in less obvious fields.&lt;/p&gt;

&lt;h4 id=&quot;what-to-read-next-2&quot;&gt;What to Read Next&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/artificial-intelligence-is-more-than-just-a-technology-26d87774c011&quot;&gt;Artificial Intelligence is More than “Just a Technology”&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/@humansforai/retail-d4ca38b4de3f&quot;&gt;The Changing Face of Retail — the AI Impact&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.forbes.com/sites/louiscolumbus/2017/09/10/how-artificial-intelligence-is-revolutionizing-business-in-2017/#22a83025463a&quot;&gt;How Artificial Intelligence Is Revolutionizing Business In 2017&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;the-rise-of-backends-as-a-service-baas&quot;&gt;The Rise of Backends As A Service (BaaS)&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Backend as a service, while typically is not reference by that name is a trend that has been on the rise in 2017 and will continue gaining steam during 2018.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;why-it-matters-3&quot;&gt;Why it matters&lt;/h4&gt;
&lt;p&gt;BaaS turns traditional parts of the backend into a third party service that is consumed by other applications, some good examples of BaaS are push notifications, file storage and sharing, integration with social networks and messaging and chat, just to mention a few.&lt;/p&gt;

&lt;p&gt;One trend that I’m expecting to see more of in 2018 is what Shopify is doing with its Storefront API, in which Shopify essentially becomes a headless backend for a fully customizable shopping experience.&lt;/p&gt;

&lt;h4 id=&quot;what-to-read-next-3&quot;&gt;What to Read Next&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/a-new-approach-to-the-backend-as-a-service-market-b441e5ab9e38&quot;&gt;A new Approach to the Backend as a Service Market&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.stamplay.com/the-age-of-bots-and-backend-as-a-service-c231cff897bb&quot;&gt;The Age of Bots and Backend-as-a-Service&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;augmented-reality&quot;&gt;Augmented Reality&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;AR and mobile seem to be the perfect marriage and with the release of ARKit by Apple and ARCore by Google, 2018 is poised to be the year where we will see mainstream adoption of AR.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;why-it-matters-4&quot;&gt;Why it matters&lt;/h4&gt;
&lt;p&gt;While there has been a lot of hype surrounding Virtual Reality in the past couple years, there is still ways to go before it becomes commonplace and widely adopted. On the other hand Augmented Reality, might become mainstream in 2018.&lt;/p&gt;

&lt;h4 id=&quot;what-to-read-next-4&quot;&gt;What to Read Next&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://hackernoon.com/why-im-not-completely-sold-on-the-arkit-revolution-2e2d261b73ed&quot;&gt;Why I’m not completely sold on the ARKit revolution&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/super-ventures-blog/arkit-and-arcore-will-not-usher-massive-adoption-of-mobile-ar-da3d87f7e5ad&quot;&gt;ARKit and ARCore will not usher massive adoption of mobile AR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Photo by Eddie Kopp on Unsplash&lt;/p&gt;
</description>
        <pubDate>Mon, 18 Dec 2017 20:13:44 -0500</pubDate>
        <link>https://coderoncode.com/technology/2017/12/18/5-trends-to-watchout-in-2018.html</link>
        <guid isPermaLink="true">https://coderoncode.com/technology/2017/12/18/5-trends-to-watchout-in-2018.html</guid>
      </item>
    
      <item>
        <title>You Should Learn Functional Programming in 2017</title>
        <description>&lt;p&gt;Functional programming has been around for a very long time, starting in the 50’s with the introduction of the &lt;strong&gt;Lisp&lt;/strong&gt; programming language; and if you been paying attention in the last two years languages like &lt;strong&gt;Clojure&lt;/strong&gt;, &lt;strong&gt;Scala&lt;/strong&gt;, &lt;strong&gt;Erlang&lt;/strong&gt;, &lt;strong&gt;Haskell&lt;/strong&gt; and &lt;strong&gt;Elixir&lt;/strong&gt; have been making a lot of noise and getting tons of attention.&lt;/p&gt;

&lt;p&gt;But what is &lt;strong&gt;functional programming&lt;/strong&gt;, why is everyone going crazy about it and why the heck are not more people using it? In this post, I will attempt to answer all of those questions and hopefully pique your interested on the idea of functional programming.&lt;/p&gt;

&lt;h2 id=&quot;a-brief-history-of-functional-programming&quot;&gt;A Brief History of Functional Programming&lt;/h2&gt;

&lt;p&gt;As we said before functional programming started back in the 50’s with the creation of Lisp to run in the &lt;strong&gt;IBM700/7000 series of scientific computers&lt;/strong&gt;. Lisp introduced many paradigms and features that we associate with functional programming now days, and while we can call &lt;strong&gt;Lisp&lt;/strong&gt; the granddaddy of functional programming we can even further to a common root between all functional programming languages, &lt;strong&gt;Lambda Calculus&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/b/b9/NASAComputerRoom7090.NARA.jpg&quot; alt=&quot;Ahh the good ole days&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is by far the most interesting aspect of functional programming; all functional programming languages are based on the same simple mathematical foundation, &lt;strong&gt;Lambda Calculus&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Lambda calculus is Turing complete, that is, it is a universal model of computation that can be used to simulate any single-taped Turing machine.[1] Its namesake, the Greek letter lambda (λ), is used in lambda expressions and lambda terms to denote binding a variable in a function. – &lt;a href=&quot;https://en.wikipedia.org/wiki/Lambda_calculus#Explanation_and_applications&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lambda Calculus is a surprisingly simple yet powerful concept. At the core of lambda calculus we have two concepts:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Function abstraction&lt;/strong&gt;, which is used to generalize expressions through the introduction of names (variables).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Function application&lt;/strong&gt;, which is used to evaluate the generalized expressions by giving names to particular values.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s take a look at an example, a single argument function &lt;em&gt;f&lt;/em&gt; that increments the argument by one:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
f = λ x. x+1
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let’s say we want to apply the function to the number 5; then the function can be read as follows:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
f(5) =&amp;gt; 5 + 1
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;functional-programming-fundamentals&quot;&gt;Functional Programming Fundamentals&lt;/h2&gt;

&lt;p&gt;Enough Math, for now, lets take a look at the features that make Functional programming a powerful concept:&lt;/p&gt;

&lt;h3 id=&quot;first-class-functions&quot;&gt;First-Class Functions&lt;/h3&gt;

&lt;p&gt;In functional languages, functions are first-class citizens this means that &lt;strong&gt;a functions can be stored in a variable&lt;/strong&gt;, for example in elixir that would look like this:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
double = fn(x) -&amp;gt; x * 2 end 
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And as such we can easily call the function as follows:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
double.(2)
&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;high-order-functions&quot;&gt;High-Order Functions&lt;/h3&gt;

&lt;p&gt;A high order function is defined as a function that takes one or more functions as arguments and/or that returns a new function. Let’s use our double function again to exemplify the concept:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
double = fn(x) -&amp;gt; x * 2 end 
Enum.map(1..10, double)
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In this case &lt;strong&gt;Enum.map&lt;/strong&gt; takes an enumerable –a list– as the first argument and the function we just defined as the second; and &lt;strong&gt;applies the function&lt;/strong&gt; to each element in the enumerable the result being:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
[2,4,6,8,10,12,14,16,18,20]
&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;immutable-state&quot;&gt;Immutable State&lt;/h3&gt;

&lt;p&gt;In functional programming languages state is immutable, this means that once a variable has been bound to &lt;strong&gt;a value they cannot be redefined&lt;/strong&gt;, this has the nice advantage of &lt;strong&gt;preventing side effects and race conditions&lt;/strong&gt;; making concurrent programming much much easier.&lt;/p&gt;

&lt;p&gt;As before let’s use Elixir to illustrate this concepts:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elixir&quot; data-lang=&quot;elixir&quot;&gt;&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tuple&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sd&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sd&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;put_elem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tuple&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sd&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;world&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sd&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;world&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;iex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tuple&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sd&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the example our tuple will never change values, in the third line put_elem is returning a completely new tuple without modifying the values of the original.&lt;/p&gt;

&lt;p&gt;I won’t go into further details because this post is not an introduction to lambda calculus, computing theory or even functional programming; if you would like me to dig deeper on either subject drop me a message on the comment section. For now our take away from this section is the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Functional Programming has been around for a long time (the early 50’s)&lt;/li&gt;
  &lt;li&gt;Functional Programming is based on mathematical concepts, specifically Lambda Calculus&lt;/li&gt;
  &lt;li&gt;Functional Programming was deemed too slow compared to imperative languages&lt;/li&gt;
  &lt;li&gt;Functional Programming is making a comeback.&lt;/li&gt;
&lt;/ul&gt;

&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display:block; text-align:center;&quot; data-ad-layout=&quot;in-article&quot; data-ad-format=&quot;fluid&quot; data-ad-client=&quot;ca-pub-6937861309533018&quot; data-ad-slot=&quot;9206842858&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/p&gt;

&lt;h2 id=&quot;functional-programming-applications&quot;&gt;Functional Programming Applications&lt;/h2&gt;

&lt;p&gt;As software developers we are living in exciting times, the promise of the cloud is finally here, and with it, an unprecedented amount of computer power is available to every single one of us. Unfortunately, with there also came demands of scalability, performance, and concurrency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Objected Oriented Programming&lt;/strong&gt; is simply not cutting it anymore, specially when it comes to &lt;strong&gt;concurrency&lt;/strong&gt; and &lt;strong&gt;parallelism&lt;/strong&gt;; trying to add concurrency and parallelism to this languages adds lots of complexity and more often than not leads to &lt;strong&gt;over engineering and poor performance.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Functional programming in the other hand is already well suited for these challenges, &lt;strong&gt;Immutable state, Closures, and High order functions&lt;/strong&gt;, concepts that lend themselves very well for writing highly concurrent and distributed applications.&lt;/p&gt;

&lt;p&gt;But don’t take my word for it, you can find enough proof by looking at the technological feeds of startups like WhatsApp and Discord:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.wired.com/2015/09/whatsapp-serves-900-million-users-50-engineers/&quot;&gt;WhatsApp&lt;/a&gt; was able to support 900 million users with only &lt;strong&gt;50 engineers&lt;/strong&gt; in their team by using &lt;strong&gt;Erlang&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.discordapp.com/how-discord-handles-push-request-bursts-of-over-a-million-per-minute-with-elixirs-genstage-8f899f0221b4&quot;&gt;Discord&lt;/a&gt; in similar fashion handles over a &lt;strong&gt;million requests per minute&lt;/strong&gt; using &lt;strong&gt;Elixir&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These companies and teams are capable of handling this massive growth thanks to the advantages of functional programming, and as functional programming gains more and more traction; I strongly believe this stories like the WhatsApp and Discord will become more and more common.&lt;/p&gt;

&lt;p&gt;For that reason functional programming needs to be a must on every developer’s toolbox of knowledge, you need to be ready to build the &lt;strong&gt;next generation of applications&lt;/strong&gt; that will serve the &lt;strong&gt;next billion of users&lt;/strong&gt;; and heck if that wasn’t enough trust me functional programming is really fun, just take a look at &lt;strong&gt;Elixir&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://elixir-lang.org/getting-started/introduction.html&quot;&gt;Introduction to Elixir&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://rob.conery.io/2016/01/04/learn-elixir-while-having-fun/&quot;&gt;Learn Elixir the fun way&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://teamgaslight.com/blog/4-reasons-were-having-fun-programming-elixir&quot;&gt;4 Reasons We’re Having Fun Programming Elixir&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, If you have any comments, corrections or would you like to know more about the subject don’t hesitate to leave a comment just below.&lt;/p&gt;
</description>
        <pubDate>Sun, 23 Apr 2017 16:53:15 -0400</pubDate>
        <link>https://coderoncode.com/functional-programming/2017/04/23/you-should-learn-functional-programming-in-2017.html</link>
        <guid isPermaLink="true">https://coderoncode.com/functional-programming/2017/04/23/you-should-learn-functional-programming-in-2017.html</guid>
      </item>
    
      <item>
        <title>Neural Networks Without a PhD: Topologies</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;Topology of a neural network refers to the way the Neurons are connected, and it is an important factor in network functioning and learning. A common topology in unsupervised learning is a direct mapping of inputs to a collection of units that represents categories (e.g., Self-organizing maps).
– &lt;a href=&quot;http://link.springer.com/referenceworkentry/10.1007%2F978-0-387-30164-8_837&quot;&gt;Springer&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In our previous post we learned about the components that form a neural network:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Input Nodes&lt;/li&gt;
  &lt;li&gt;Neurons&lt;/li&gt;
  &lt;li&gt;Output Nodes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;as well that those elements will be organized in the following layers:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Input Layer&lt;/li&gt;
  &lt;li&gt;Hidden Layers&lt;/li&gt;
  &lt;li&gt;Output Layer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, it still not very clear what the process for organizing and connecting those neural networks is; how do we determine how many hidden layers we need to create? How do we connect those neurons to the inputs, outputs and to each other? How do we know how many output nodes we need to create?&lt;/p&gt;

&lt;h2 id=&quot;how-to-organize-our-neural-network&quot;&gt;How to organize our Neural Network&lt;/h2&gt;

&lt;p&gt;What we need is a way to represent how neurons are connected in order to form a network, a &lt;strong&gt;Neural Network Topology&lt;/strong&gt;. The topology of a neural network plays an essential role in its function and performance.&lt;/p&gt;

&lt;p&gt;An important thing to notice is that &lt;strong&gt;multiple topologies&lt;/strong&gt; can be used to learn the same set of data, and they are even likely to produce similar results; and as such there is not ‘best’ topology for a single neural network; that being said topology can greatly impact the amount of time required for a neural network to learn data as well its accuracy when classifying new data.&lt;/p&gt;

&lt;p&gt;One a approach to topology selection is to simply make it a trial and error process, where we manually tweak the Neural network by modifying things like the number of &lt;strong&gt;hidden layers&lt;/strong&gt;, &lt;strong&gt;connections between nodes,&lt;/strong&gt; and so on. Taking this approach would limit us greatly as there are many possible permutations even for a &lt;strong&gt;simple neural network&lt;/strong&gt;; to complicate matters even further, Neural networks are not limited to the relatively simple &lt;strong&gt;Feed-Forward&lt;/strong&gt; layout we have seen before, to mention a few:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Feed-forward&lt;/li&gt;
  &lt;li&gt;Recurrent&lt;/li&gt;
  &lt;li&gt;Long Short Term Memory&lt;/li&gt;
  &lt;li&gt;Jordan&lt;/li&gt;
  &lt;li&gt;Elman&lt;/li&gt;
  &lt;li&gt;Hopfield&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;http://www.turingfinance.com/wp-content/uploads/2014/04/Recurrent-Neural-Network-Architectures.png&quot; alt=&quot;Network types - Source: turingfinance.com&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So outside of very simple applications, known problems or learning exercises &lt;strong&gt;manual topology selection&lt;/strong&gt; is not a viable option, in order to find the ideal topology we have to let our neural network to learn the topology from the training data as well. The goal is to find a topology for our neural network that **minimizes the the error on new data. **&lt;/p&gt;

&lt;p&gt;One of most novel approaches for this objective is the use of genetic programming.&lt;/p&gt;

&lt;h2 id=&quot;genetic-programming-and-neuro-evolution&quot;&gt;Genetic Programming and Neuro Evolution&lt;/h2&gt;

&lt;p&gt;Genetic algorithms are based on the evolutionary principles of the &lt;strong&gt;natural selection&lt;/strong&gt;, &lt;strong&gt;mutation&lt;/strong&gt; and &lt;strong&gt;survival of the fittest&lt;/strong&gt;; a genetic algorithm will approach a particular problem by generating a large number of potential solutions and finding the solutions with the best &lt;strong&gt;fitness score&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Without going too deep into the weeds, a &lt;strong&gt;fitness score&lt;/strong&gt; is a method to measure how close was the solution to known result or to a expected metric; in the case of a neural network where we have training data that we can use as reference point.&lt;/p&gt;

&lt;p&gt;The Genetic algorithm will tweak and mutate our neural network generation after generation until the desired fitness score is achieved or until we reach the maximum number of iterations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disclaimer: The above is a oversimplified description of how genetic algorithms work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I highly recommend, &lt;a href=&quot;https://link.springer.com/book/10.1007/978-1-4614-4463-3&quot;&gt;The Handbook of Neuroevolution through Erlang&lt;/a&gt; for an amazing breakdown of the subject, even if you are not into Erlang the author makes a terrific job on breaking down the concepts and introduction genetic algorithms.&lt;/p&gt;

&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;/h1&gt;

&lt;p&gt;I’m important that we understand how topology, that is the &lt;strong&gt;number of layers and how they are connect&lt;/strong&gt; of our neural networks can impact their effectiveness; there are many existing types of artificial neural networks some best suited to particular tasks of applications, and is important to familiarize ourselves with the most common types.&lt;/p&gt;

&lt;p&gt;Additional, in order to find the optimal topology one can use &lt;strong&gt;Genetic algorithms&lt;/strong&gt; in order to try to evolve the &lt;strong&gt;‘perfect’&lt;/strong&gt; topology for a given application.&lt;/p&gt;

&lt;p&gt;There is still a lot more to learn and go, but feel free to &lt;strong&gt;leave a comment&lt;/strong&gt; if you find any factual errors or if you think something &lt;strong&gt;needs more clarification&lt;/strong&gt;.&lt;/p&gt;
</description>
        <pubDate>Sun, 16 Apr 2017 15:25:04 -0400</pubDate>
        <link>https://coderoncode.com/machine-learning/2017/04/16/neural-networks-without-a-phd-part3.html</link>
        <guid isPermaLink="true">https://coderoncode.com/machine-learning/2017/04/16/neural-networks-without-a-phd-part3.html</guid>
      </item>
    
      <item>
        <title>Vim Is The Perfect IDE</title>
        <description>&lt;p&gt;Over the years I’ve jumped back and forth between many code editors, &lt;strong&gt;IDEs&lt;/strong&gt; and &lt;strong&gt;tools&lt;/strong&gt;; but it seems that somehow I always end up coming right back to VIM, and not only for programming – guess which markdown editor I’m using to write this post.&lt;/p&gt;

&lt;p&gt;I’ve have tried Atom, SublimeText, TextMate, Eclipse, Visual Studio, and most of the Jetbrains products, I’m constantly &lt;strong&gt;tweaking and looking for a better setup&lt;/strong&gt;, however Vim always feels like home to me; and I’m to the point now where I rarely use IDEs – exception being messy and complex projects where IDEs can do a lot of heavily lifting (yes, Magento I’m talking about you.)&lt;/p&gt;

&lt;p&gt;But other than that Vim is my default Ruby, Elixir, Python, PHP IDE and as well the main tool that I use for writing drafts and books.&lt;/p&gt;

&lt;h2 id=&quot;what-it-look-like&quot;&gt;What it look like&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://imgur.com/AQSIXwj&quot;&gt;&lt;img src=&quot;http://i.imgur.com/AQSIXwj.gif&quot; title=&quot;source: imgur.com&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-setup&quot;&gt;The Setup&lt;/h2&gt;

&lt;p&gt;So how does this magical tool work? Is all out of the box right? right? Well no, as with all the worthwhile things in life there is a bit of effort involved on getting the Vim setup just like I wanted it. Fortunately, is far from custom and is mostly the right combination of plugins.&lt;/p&gt;

&lt;p&gt;You can find my current Vim configuration and dot files in its corresponding &lt;a href=&quot;https://github.com/amacgregor/dot-files&quot;&gt;Github repository&lt;/a&gt; feel free to fork it and give a shot.&lt;/p&gt;

&lt;p&gt;We are in particular interested in the vimrc file, let’s break it down:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/0467f99e0e75725f57682ccd1f2189fb.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Each plugin in this setup is separated in the following categories:&lt;/p&gt;

&lt;h3 id=&quot;utility&quot;&gt;Utility&lt;/h3&gt;
&lt;p&gt;This kind of a miscellaneous category and is comprised of plugins used to enhance or change the behaivour of core vim; the most useful important ones are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Nerdtree&lt;/strong&gt;: It gives you easy access to the file system in the form of a directory tree on the left side of the screen, as well provides shortcuts for filesystem manipulation(create, delete, move files and directories)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Tagbar&lt;/strong&gt;: Quick tag browser for the current file, a must have if you are using any kind of &lt;strong&gt;ctags&lt;/strong&gt; like exuberant-tags.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;FZF&lt;/strong&gt;: Fuzzy finder, another handy utility for finding files and commands.&lt;/li&gt;
  &lt;li&gt;Neocomplete: Vim Autocomplete on steroids.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;generic-programming-support&quot;&gt;Generic Programming Support&lt;/h3&gt;
&lt;p&gt;These plugins fall directly on the category of programming and are used my all or most of the &lt;strong&gt;programming languages&lt;/strong&gt; that I currently have setup:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Exuberant-Ctags&lt;/strong&gt;: tags are named definitions of classes, functions, abstract types and so on; adding support to Vim gives you some of that ‘magic’ IDE code navigation functionality.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Syntastic&lt;/strong&gt;: THE syntax checking plugin for Vim, if you are familiar with the way that code inspections work on Jetbrains and similar IDEs, syntastic will make feel right at home.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Vim-autoclose&lt;/strong&gt;: Automatically closes a character that could/should have a matching closing counterpart, like () “” [] {} and so on.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;markdownwriting&quot;&gt;Markdown/Writing&lt;/h3&gt;
&lt;p&gt;As I mentioned Vim is my go to editor for drafting new posts be it books, blogs or random angry letters. From this particular section only language tools deservers a special shot-out as it makes for a great Grammar checker directly from inside Vim.&lt;/p&gt;

&lt;h3 id=&quot;erlangelixirphpelm-support&quot;&gt;Erlang/Elixir/PHP/Elm Support&lt;/h3&gt;

&lt;p&gt;When it comes down to the &lt;strong&gt;individual language support&lt;/strong&gt; there isn’t really much to highlight other than I’ve tried (and somewhat failed) to keep the plugins to a minimum and focus only on the &lt;strong&gt;essential language support&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So far elixir is winning the battle in terms of plugins as I’ve added additional functionality like the ability to run tests and generate content from inside Vim, I have yet to decide if I’m keeping all the plugins for it.&lt;/p&gt;

&lt;h3 id=&quot;git-support&quot;&gt;Git Support&lt;/h3&gt;
&lt;p&gt;Standard git support that I’m afraid I rarely use, I find myself going directly back to the &lt;strong&gt;shell&lt;/strong&gt; and doing the &lt;strong&gt;git workflow&lt;/strong&gt; outside of Vim, so I’m open to suggestions and to hear what everyone else is using in terms of setup.&lt;/p&gt;

&lt;h3 id=&quot;themes-and-interfaces&quot;&gt;Themes and Interfaces&lt;/h3&gt;
&lt;p&gt;Ok this is a big one but mostly because I keep forgetting to remove unused themes and colorschemes, let’s highlight the important ones:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Vimarline&lt;/strong&gt;: Lean and mean status/tabline for Vim; it also looks cool as fuck.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Vim-Devicons&lt;/strong&gt;: Because not only atom gets all the fancy icons on the sidebar, highly recommended to if you are using nerdtree.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The remaining parts of the configuration file are either plugin configuration or personal key re-mappings that I use for quality of like; I’ve done my best to document and segment each section so it should be easy enough to understand what each setting is doing.&lt;/p&gt;

&lt;p&gt;For anyone getting starting with Vim, I do want to bring special attention to the following:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
&quot; Disable arrow movement, resize splits instead.
if get(g:, &#39;elite_mode&#39;)
	nnoremap &amp;lt;Up&amp;gt;    :resize +2&amp;lt;CR&amp;gt;
	nnoremap &amp;lt;Down&amp;gt;  :resize -2&amp;lt;CR&amp;gt;
	nnoremap &amp;lt;Left&amp;gt;  :vertical resize +2&amp;lt;CR&amp;gt;
	nnoremap &amp;lt;Right&amp;gt; :vertical resize -2&amp;lt;CR&amp;gt;
endif
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As there is no quickest way to force one-self to use the home row for navigation.&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display:block; text-align:center;&quot; data-ad-layout=&quot;in-article&quot; data-ad-format=&quot;fluid&quot; data-ad-client=&quot;ca-pub-6937861309533018&quot; data-ad-slot=&quot;9206842858&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/p&gt;

&lt;h1 id=&quot;final-remarks&quot;&gt;Final Remarks&lt;/h1&gt;

&lt;p&gt;I hope that for some of you this post has been helpful for some, and I’m far from done with my current setup, in that sense this is &lt;strong&gt;very much a toy&lt;/strong&gt; that I continue playing on a nearly daily basis; now that being said and in order to get back to the original premise of the post; it is indeed a very powerful toy, specially when combined with other tools like &lt;strong&gt;Tmux&lt;/strong&gt;, here is a sneak peak of my &lt;strong&gt;Elixir&lt;/strong&gt; ‘IDE’ powered by &lt;strong&gt;Vim&lt;/strong&gt; and &lt;strong&gt;Tmux&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://imgur.com/vI0KjXB&quot;&gt;&lt;img src=&quot;http://i.imgur.com/vI0KjXB.gif&quot; title=&quot;source: imgur.com&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to know more about my setup, or want to &lt;strong&gt;share yours&lt;/strong&gt; please leave a comment below.&lt;/p&gt;
</description>
        <pubDate>Sun, 16 Apr 2017 11:55:59 -0400</pubDate>
        <link>https://coderoncode.com/tools/2017/04/16/vim-the-perfect-ide.html</link>
        <guid isPermaLink="true">https://coderoncode.com/tools/2017/04/16/vim-the-perfect-ide.html</guid>
      </item>
    
      <item>
        <title>Neural Networks Without a PhD: Components of a Neural Network</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;Neural networks (also referred to as connectionist systems) are a computational approach, which is based on a large collection of neural units (AKA artificial neurons), loosely modelling the way a biological brain solves problems with large clusters of biological neurons connected by axons.
– &lt;a href=&quot;https://en.wikipedia.org/wiki/Artificial_neural_network&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In essence &lt;strong&gt;Neural networks&lt;/strong&gt; are digital representations of their biological counterparts, and while that sounds intimidating – unless you have a strong background in statistics or cognitive science – NN are not that complicated once you understand the individual building blocks for a Neural Net.&lt;/p&gt;

&lt;p&gt;For illustration purposes let’s take a look at the simplest possible Neural Network, the &lt;strong&gt;perceptron&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://natureofcode.com/book/imgs/chapter10/ch10_03.png&quot; alt=&quot;The Perceptron - Source: natureofcode.com&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The perceptron is a computational model of a single neuron, and as we can see it consists of 3 basic neural nodes, each of the with a unique function:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Inputs&lt;/strong&gt;: Also referred to as sensors are in charge of communicating with either software or hardware and passing signals(data) to the Neural network, for example data sources in the case of software or a webcam in the case of hardware.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Neurons&lt;/strong&gt;: A basic unit of computation, it takes input from other nodes(sensors) and computes and output.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Output&lt;/strong&gt;: Also referred to as actuators, allow our NN to interact with its environment, outputs can be hardware or software, for example return a true or false value or activating a stepper motor.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;layers&quot;&gt;Layers&lt;/h1&gt;

&lt;p&gt;Each node type will be typically arranged in a single layer, with the exception of Neurons which can have many more layers, to clarify let’s take a look at a more complex Neural Network type, a &lt;strong&gt;Feed-Forward Neural Network&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://technobium.com/wordpress/wp-content/uploads/2015/04/MultiLayerNeuralNetwork.png&quot; alt=&quot;MultiLayer Neural Network - Source: technobium.com&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The input and output layers are self-explanatory, but what is a &lt;strong&gt;hidden layer&lt;/strong&gt;?&lt;/p&gt;

&lt;h2 id=&quot;hidden-layers&quot;&gt;Hidden Layers&lt;/h2&gt;

&lt;p&gt;The hidden layer(s) is the collection of one or more layers of &lt;strong&gt;artificial neurons&lt;/strong&gt; that are in charge of doing the computation, transforming the inputs into something the output layer can use. In order to understand what happens inside this hidden layer, we need to first understand the concept of emergence:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In philosophy, systems theory, science, and art, emergence is a phenomenon whereby larger entities arise through interactions among smaller or simpler entities such that the larger entities exhibit properties the smaller/simpler entities do not exhibit.
– &lt;a href=&quot;https://en.wikipedia.org/wiki/Emergence&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each hidden layer neuron has an internal mechanism that governs if the neuron becomes active and sends a signal of its own to the next layer – which can be another hidden layer or the output layer itself.&lt;/p&gt;

&lt;p&gt;If we want to break it down, we can then say that a Neural network takes one or more inputs, &lt;strong&gt;performs some sort of computation&lt;/strong&gt; and returns a value – often in the form a vector – that can be used for further processing.&lt;/p&gt;

&lt;h1 id=&quot;how-neurons-make-decisions&quot;&gt;How Neurons Make Decisions&lt;/h1&gt;

&lt;p&gt;In order to understand how neurons compute the input values and in turn make decisions – aka return an output – we need to add two more elements to our neural network understanding.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Connections&lt;/strong&gt;: The individual connections between each node (inputs, neurons, outputs).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Connection Weights&lt;/strong&gt;: Each individual weight represents the strength of the connections between nodes. Another way of thinking about it is how much each ‘neuron’ cares about a particular input value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With those two new components let’s review our original perceptron diagram:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://natureofcode.com/book/imgs/chapter10/ch10_05.png&quot; alt=&quot;The Perceptron Weights - Source: natureofcode.com&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Alright, now that we have expanded our knowledge about how neurons are connected let’s take a look at how they make a decision based on their inputs.&lt;/p&gt;

&lt;h2 id=&quot;the-activation-function&quot;&gt;The Activation Function&lt;/h2&gt;

&lt;p&gt;Each neuron will take all the connected inputs with their corresponding weights and apply what is called an activation function and return a single output value.&lt;/p&gt;

&lt;p&gt;Now, here is where we could start going into the &lt;strong&gt;mathematics behind neural networks&lt;/strong&gt;; but as promise but for now we wont; all we need to know is that there are a number of common activation functions that can be used with Neural networks. To mention a few:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Step Function&lt;/li&gt;
  &lt;li&gt;Sigmoid&lt;/li&gt;
  &lt;li&gt;Linear&lt;/li&gt;
  &lt;li&gt;Gaussian&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the case of our perceptron will be using a &lt;strong&gt;step function&lt;/strong&gt;, will return one of two values &lt;strong&gt;0 (OFF) or 1 (ON)&lt;/strong&gt;, this means our neuron will always a &lt;strong&gt;binary value&lt;/strong&gt; – that is, the neuron is either firing or not, and the graph representation of that function looks something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/HardLimitFunction.png/400px-HardLimitFunction.png&quot; alt=&quot;Step Function - Source: wikibooks.org&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;putting-it-all-together&quot;&gt;Putting it all together&lt;/h1&gt;

&lt;p&gt;Let’s quickly put all we learned together and write a simple perceptron:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/48343d13097f1b4963dd6b064f90204b.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;This python perceptron is doing a couple of things we haven’t covered yet, like &lt;strong&gt;training&lt;/strong&gt;, and adjusting the connection weights based on the error. For now, the only important thing to understand is that our perceptron takes 3 inputs, applies a step function to such values and attempts to predict the output value.&lt;/p&gt;

&lt;p&gt;Running the perceptron will return something like this:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
Training Perceptron for 1000 iterations
Starting weights: [ 0.90185083  0.75965753  0.10658775]
.......................................................
Training completed
Weights after training: [ 0.90185083  0.35965753 -0.49341225]
Running trained Network against Test Data
[0 0 0]: 0.0 -&amp;gt; 0
[0 1 0]: 0.359657525652 -&amp;gt; 1
[1 1 1]: 0.768096100245 -&amp;gt; 1
[0 0 1]: -0.49341225179 -&amp;gt; 0
[1 0 0]: 0.901850826383 -&amp;gt; 1
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-result&quot;&gt;The result&lt;/h2&gt;
&lt;p&gt;Can you spot the pattern that the Neural Network is supposed to predict? Leave a comment if you think you figure out the pattern and how well our perceptron did.&lt;/p&gt;

&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;/h1&gt;
&lt;p&gt;We covered a lot of content in this second post of the series and we now have a much &lt;strong&gt;better understanding&lt;/strong&gt; of the individual elements in neural networks, next we are going to cover &lt;strong&gt;ANN topology&lt;/strong&gt; or how to put organize and connect all of our Neurons.&lt;/p&gt;
</description>
        <pubDate>Sun, 26 Mar 2017 07:38:13 -0400</pubDate>
        <link>https://coderoncode.com/machine-learning/2017/03/26/neural-networks-without-a-phd-part2.html</link>
        <guid isPermaLink="true">https://coderoncode.com/machine-learning/2017/03/26/neural-networks-without-a-phd-part2.html</guid>
      </item>
    
      <item>
        <title>Neural Networks Without a PhD: Introduction</title>
        <description>&lt;!---
Recently, anything and everything **Artificial Intelligence** has seen a resurgence in focus and interest by not only the academic community but also the large corporate ecosystem and hobbyist developer community. 
--&gt;

&lt;p&gt;There is arguably nothing more exciting happening right now in software development than all the new research, and advances in &lt;strong&gt;Artificial Intelligence&lt;/strong&gt;, terms like Machine learning, Deep Learning and of course Artificial Neural Networks have become more common in the developers vernacular.&lt;/p&gt;

&lt;p&gt;These are exciting times for AI and not without reasons, as the technology continues to advance at an unprecedented pace and becoming more embedded on our daily lives, with more novel applications reaching the news on almost a weekly basis.&lt;/p&gt;

&lt;p&gt;In the last year, I got hooked into machine learning and AI; and I’m firm believer that AI will drastically impact how our relationship with technology in almost every single market and niche you can imagine.&lt;/p&gt;

&lt;p&gt;One particular aspect of AI that has caught my attention is the development and application of Artificial Neural Networks or ANN. Personally, I find the concept of emulating the organic brain processes not only interesting but also quite promising; on top of that ANN is one of the technologies that has seen a lot of progress in the last few years.&lt;/p&gt;

&lt;p&gt;However, we are nowhere near to reaching the point of democratization of this technology, that is to say that the barrier of entry is still fairly high – albeit consistently dropping. For many developers, and enthusiast this means that many aspects of AI are still far from reach.&lt;/p&gt;

&lt;p&gt;If you are like me, you are a software developer with potentially a Computer Science background or maybe a self thought developer with years of experience as a professional developer; and yet when looking at AI programming like Neural Networks, you feel fairly out of your depth and with what seems an insurmountable knowledge gap ahead of you.&lt;/p&gt;

&lt;h2 id=&quot;this-series&quot;&gt;This Series&lt;/h2&gt;

&lt;p&gt;The objective of this series is twofold, first: Become a sort of learning notebook for my own learning into the basic and essential knowledges required to work with artificial neural networks and second: make my notes available and structure in a way that are available for any other developers that are faced the same challenges as I currently do.&lt;/p&gt;

&lt;p&gt;The topics I have selected to focus on are the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Part 1: Introduction&lt;/li&gt;
  &lt;li&gt;Part 2: Components of a Neural Network&lt;/li&gt;
  &lt;li&gt;Part 3: Topologies&lt;/li&gt;
  &lt;li&gt;Part 4: Supervised Learning&lt;/li&gt;
  &lt;li&gt;Part 5: Unsupervised Learning&lt;/li&gt;
  &lt;li&gt;Part 6: Gradient Descent&lt;/li&gt;
  &lt;li&gt;Part 7: Back-propagation&lt;/li&gt;
  &lt;li&gt;Part 8: Building a Simple Neural Net&lt;/li&gt;
  &lt;li&gt;Part 9: Adding Some Bias&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep in mind that this series is by no means a comprehensive breakdown of each of the topics mentioned above, rather enough of a breakdown in a way that is useful and allows me and you to apply and work with said concepts when working with Neural Networks, so don’t expect a deep dive in math or theory; rather I’m keeping math and theory as light as possible – within reason.&lt;/p&gt;

&lt;p&gt;Finally, as I approach this series from the perspective of a student and without the formal academic background there is plenty of room for inaccuracies and errors, so if you find one don’t hesitate to leave a comment or contact me directly.&lt;/p&gt;

&lt;p&gt;Happy Learning!!&lt;/p&gt;
</description>
        <pubDate>Sun, 26 Mar 2017 07:38:09 -0400</pubDate>
        <link>https://coderoncode.com/machine-learning/2017/03/26/neural-networks-without-a-phd-part1.html</link>
        <guid isPermaLink="true">https://coderoncode.com/machine-learning/2017/03/26/neural-networks-without-a-phd-part1.html</guid>
      </item>
    
      <item>
        <title>2017: Simplifying and Regaining Focus</title>
        <description>&lt;p&gt;Another year done and over, and as is tradition there needs to be a new year-end blog post, clarifying how I’m going to start doing everything right on 2017 and be a 10x human being, yes 2017 is the year to optimize, simplify, achieve all our goals and wildest dreams …. except all those blogpost are frankly bullshit.&lt;/p&gt;

&lt;p&gt;Personally, 2016 was a rough year full of stress, problems and an overall feeling of dissatisfaction; I got close to fully burning out more than a few times.&lt;/p&gt;

&lt;p&gt;Now, not all was negative or doom and gloom plenty of good things happened on 2016; looking at the big picture 2016 doesn’t feel like a loss but it doesn’t feel like a win either.&lt;/p&gt;

&lt;p&gt;For many a change in the calendar represents an opportunity to change, simplify and fix what they perceive wrong with their jobs, relationship and overall in their lifes.&lt;/p&gt;

&lt;p&gt;However one doesn’t need to wait for a random calendar date in order to make meaninful change, change can start at any moment.&lt;/p&gt;

&lt;p&gt;Finally, 2017 for me is the year to slowdown and simplify; the biggest mistake that I made on 2016 was trying to do way to much and as result I ended up spread too thin, so I’m slowly working only a few things at the time before moving to the next project.&lt;/p&gt;

&lt;p&gt;To all of you, make 2017 about what matters to you; slowdown and focus and really work on the things you conside important, chase your passion and above all take care of yourself.&lt;/p&gt;
</description>
        <pubDate>Fri, 06 Jan 2017 05:14:40 -0500</pubDate>
        <link>https://coderoncode.com/health,/life,/productivity/2017/01/06/2017-simplifying-and-regaining-focus.html</link>
        <guid isPermaLink="true">https://coderoncode.com/health,/life,/productivity/2017/01/06/2017-simplifying-and-regaining-focus.html</guid>
      </item>
    
      <item>
        <title>Machine Learning: A Simple Neural Network</title>
        <description>&lt;p&gt;For the last few months I’ve been slowly getting my head around the concepts of machine learning, artificial intelligence and neural networks. The impact that machine learning could potentially have on everyday tasks and the way we develop and interact with applications is incredibly exciting; for that reason I been slowly trying to spend as much of my free time as possible trying to learn this big and complex field.&lt;/p&gt;

&lt;p&gt;As part of that learning process I been get a better understanding of what neural networks are, how they work and what kind of applications they can be given, in this first blog post I’ll start by creating a simple Neural network and in further post build up on this simple neural network.&lt;/p&gt;

&lt;h1 id=&quot;what-are-neural-networks&quot;&gt;What are neural networks?&lt;/h1&gt;

&lt;p&gt;Artificial Neural Networks(ANN) or simple referred as neural networks are at it simplest definition is a computational systems conformed of highly interconnected components which capture and represent complex input-output relationships. In essence ANN are a rough attempt to emulate the functionality of biological neural networks.&lt;/p&gt;

&lt;p&gt;Typically neural networks are comprised by multiple layers of “neurons” or nodes, as well there are many variations and combinations of ANN like Convolutional Neural Networks(CNN) and Recurrent Neural Networks(RNN); in our case we are going to create the simplest example possible, a single layer, single neuron Neural network.&lt;/p&gt;

&lt;h1 id=&quot;a-simple-neural-network&quot;&gt;A simple Neural Network&lt;/h1&gt;

&lt;p&gt;Let’s start by defining the problem our network will be trained to solve:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/sigmoid_examples.png&quot; alt=&quot;problem examples&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We are trying to find the value of the last example, know for anyone paying enough attention, the output value will match the value of the input left-most column; let’s see if we can make our neural network answer the question correctly.&lt;/p&gt;

&lt;p&gt;Based on the examples inputs and outputs our neuron will need to take 3 inputs and return a single output.&lt;/p&gt;

&lt;h2 id=&quot;how-does-training-work&quot;&gt;How does Training work?&lt;/h2&gt;

&lt;p&gt;We have a training dataset, so now is time to train our neuron based on the known examples, but how does this process work? are we really teaching a computer to think?&lt;/p&gt;

&lt;p&gt;Well no, not really the process could be more accurately described as an educated guess by the computer. In order to train neuron we are going use a technique called backpropagation, which according to Wikipedia is:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Backpropagation, an abbreviation for “backward propagation of errors”, is a common method of training artificial neural networks used in conjunction with an optimization method such as gradient descent. The method calculates the gradient of a loss function with respect to all the weights in the network.
– &lt;a href=&quot;https://en.wikipedia.org/wiki/Backpropagation&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Clear right?, yeah no worries I got stumped as this point as well; let’s dig a little into another concept of our neural network in order to understand what’s happening during the training a little better.&lt;/p&gt;

&lt;p&gt;As we mentioned before our neuron will take three inputs per example, each of this inputs is connected to our neuron by a “synapse” the way training works is by assigning each input synapse a weight that can go from a positive to a negative number.&lt;/p&gt;

&lt;p&gt;In our case we will be training against a know dataset, so the process will roughly look as follows:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Load the training set from the known examples.&lt;/li&gt;
  &lt;li&gt;Set random weights for each input.&lt;/li&gt;
  &lt;li&gt;Pass the input and the weight to a mathematical formula to calculate the output.&lt;/li&gt;
  &lt;li&gt;Calculate the error, that is to say the different between the neuron’s output and the known value.&lt;/li&gt;
  &lt;li&gt;Based on the error adjust the weights slightly.&lt;/li&gt;
  &lt;li&gt;Rinse and repeat, 10,000 times&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By doing this will eventually come to an optimal set of weights for our training set; assuming that our unknown examples follow the same patter then the neuron should be able to make an accurate prediction. This in a nutshell is what we call backpropagation.&lt;/p&gt;

&lt;h2 id=&quot;the-math&quot;&gt;The Math&lt;/h2&gt;

&lt;p&gt;Now, you might be wondering how the actual output values are calculated; in this case we are using a Sigmoid function to calculate the output values. Let’s quickly take a look at the math involved.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A sigmoid function is a bounded differentiable real function that is defined for all real input values and has a positive derivative at each point.
– &lt;a href=&quot;https://www.wikiwand.com/en/Sigmoid_function&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don’t want to go to deep in the math of how and why this kind of logistic function is better suited for what we are currently trying to do, for now its enough to know that a sigmoid function will work for use case and it has an easy derivative to calculate.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/sigmoid_01.png&quot; alt=&quot;sigmoid function&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The plotted result of the above function will look like the following curve:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Logistic-curve.svg/640px-Logistic-curve.svg.png?1463949421625&quot; alt=&quot;sigmoid curve&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Keep in mind that this is not the only type of neuron, and depending on the kind of neural network and job we are giving it we might use other kinds of functions to calculated the output.&lt;/p&gt;

&lt;h3 id=&quot;adjusting-the-weights&quot;&gt;Adjusting the weights&lt;/h3&gt;

&lt;p&gt;The second part to this neuron code is to be able to adjust the synaptic weights during training, in order to do that we need to provide a second function that will calculate the adjustment.&lt;/p&gt;

&lt;p&gt;In this case we will make use of another machine learning formula “Error Weighted Derivative” or delta rule.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/sigmoid_02.png&quot; alt=&quot;adjustment function&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Or better represent by:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/sigmoid_03.png&quot; alt=&quot;adjustment function with derivative&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This formula will adjust the weight proportionally to the output of neuron; by using the original sigmoid curve as part of the calculation, we make sure that the more confident the neuron is the smaller the adjustment will be.&lt;/p&gt;

&lt;h2 id=&quot;show-me-the-code&quot;&gt;Show me the code&lt;/h2&gt;

&lt;p&gt;Ok enough math and theory, let’s go ahead and write some python. First and foremost we will need to include the following methods from the numpy library:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;array: used to create matrices&lt;/li&gt;
  &lt;li&gt;random: generates a random number&lt;/li&gt;
  &lt;li&gt;exp: calculates the natural exponential&lt;/li&gt;
  &lt;li&gt;dot: used to multiply matrices&lt;/li&gt;
&lt;/ul&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/916a0e211c69a137493715b24c8d1c2c.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Next we will need to define the training set inputs and outputs, for that we can split them into 2 separate matrices:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/d7cdba726b322a6640b4e4706f68290e.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Following that we will need a variable to hold the unknown input:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/ec63927f29f79342aadcc561a5df5b6e.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;As well we need to generate the set of weights for each one of our inputs:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/7b0198cdeb3b2f8cfa14c901d4db93c0.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The code above sets the seed for the random number generator, doing so will return the same random numbers between runs. Let’s print the synapse_weights to see the results:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/aaec0a817cec1d97c1d4705e349cc547.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Which should generated something like the following:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
[[-0.16595599]
 [ 0.44064899]
 [-0.99977125]]
&lt;/code&gt;
It doesn’t matter how many times we run our example our initial weights will always be the same.&lt;/p&gt;

&lt;p&gt;Now, what would happen if we where to run our neural network without training? What do you think would happen? Would be get an accurate result?&lt;/p&gt;

&lt;p&gt;Let’s find out:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/71dcadac981216621321f8034e76c02a.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Let’s look at the last line we just added, take a few seconds to read the code. All that function is doing is translating our sigmoid function into code, which will always return a value between -1 or 1.&lt;/p&gt;

&lt;p&gt;Go ahead and run the code above, you can expect to see something like the following output:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
[ 0.45860596]
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And as you can see that value is not terrible accurate, I guess we kinda, coulda, maybe say the value is close to 0 but that won’t do it, we are looking for a value as close as possible to either 1 or 0.&lt;/p&gt;

&lt;p&gt;With that said the only remaining step is to train our ANN before actually calculating the output, and we will do that by running the sigmoid function 10,000 times and tweaking the weights on each iteration.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/87e62dab1c21edde35cecd1f42a2cbe5.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The code above will let us take a peak at the trained synapse weights, which look like the following in my case:&lt;/p&gt;

&lt;p&gt;```
# Before training
[[-0.16595599]
 [ 0.44064899]
 [-0.99977125]]&lt;/p&gt;

&lt;h1 id=&quot;after-training&quot;&gt;After training&lt;/h1&gt;
&lt;p&gt;[[ 9.67299303]
 [-0.2078435 ]
 [-4.62963669]]
```&lt;/p&gt;

&lt;p&gt;That’s some difference, but will that result in any improvement? Let’s find out by running the following and final snippet:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/18ea629211951f48ddedc52e56ccbdd9.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Resulting in;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
[ 0.99993704]
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Bam! I would said that is a pretty accurate result. Experiment tweaking some of the values or trying to calculate a different example.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;You made it to the end of the post!! Congratulations! This one was a long one and by no means a necessarily easy one to follow. However, keep in mind we are just scratching the surface, I skimmed on a lot of concepts and theory, the math alone could take several posts to start from scratch.&lt;/p&gt;

&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1#.nspy1l25s&quot;&gt;How to build a simple neural network in 9 lines of Python code&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/technology-invention-and-more/how-to-build-a-multi-layered-neural-network-in-python-53ec3d1d326a#.yw71u0sno&quot;&gt;How to build a multi-layered neural network in Python&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://iamtrask.github.io/2015/07/12/basic-python-network/&quot;&gt;A Neural Network in 11 lines of Python&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 06 Jun 2016 08:31:46 -0400</pubDate>
        <link>https://coderoncode.com/machine/learning/2016/06/06/machine-learning-a-simple-neural-network.html</link>
        <guid isPermaLink="true">https://coderoncode.com/machine/learning/2016/06/06/machine-learning-a-simple-neural-network.html</guid>
      </item>
    
      <item>
        <title>Functional Programming: The Paradigm for the Next Generation</title>
        <description>&lt;p&gt;Functional programming is often treated as the fad of hipster mustachioed programmers, and more often is dismissed without much consideration; after all Object Oriented Programming is superior. Well, at least that use to be the trend but in recent years Functional programming has experienced a renaissance and as result functional programming languages are gaining more and more adoption.&lt;/p&gt;

&lt;p&gt;But although functional programming is becoming more popular there is still a lot of friction and resistance to change specially when it comes to well seasoned OOP developers that are trying to make the transition, probably one of the best examples is the article titled &lt;a href=&quot;http://probablydance.com/2016/02/27/functional-programming-is-not-popular-because-it-is-weird/&quot;&gt;Functional Programming Is Not Popular Because It Is Weird.&lt;/a&gt; which starts with the following paragraph:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Writing functional code is often backwards and can feel more like solving puzzles than like explaining a process to the computer. In functional languages I often know what I want to say, but it feels like I have to solve a puzzle in order to express it to the language. – Malte Skarupke&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As programmers we are trained to conceptualize and abstract problems in a certain way, our first instinct is to try and frame the problem using objects a concept all to familiar both inside and outside of programming.&lt;/p&gt;

&lt;p&gt;Functional programming takes a different approach, one that might feel alien, strange and backwards to most programmers; one that forces us to leave state behind and embrace immutability, to favour recursion instead of loops, to leave what we know and adopt new patterns to solve old problems.&lt;/p&gt;

&lt;p&gt;For some developers this is a huge change, one of herculean proportions; but I’m happy to say that is not a pointless one, quite the opposite there are many rewards and benefits to discover once you fully switch your mindset to think in a functional way.&lt;/p&gt;

&lt;h2 id=&quot;functional-thinking&quot;&gt;Functional Thinking&lt;/h2&gt;

&lt;p&gt;Functional Thinking? What do we mean by that exactly? Well, I could go into detail about what functional thinking is how writing &lt;em&gt;functional&lt;/em&gt; code is more than just the selection of the programming language but also affects how we design our code, how we structure reusable blocks of code, what trade-offs we accept and so on.&lt;/p&gt;

&lt;p&gt;However, I believe the simplest way to clarify the concepts of functional programming and thinking is by comparing two solutions to the same problem, one solution using an imperative language and the other one using a functional language.&lt;/p&gt;

&lt;p&gt;In this case I’ve selected two languages that I’m familiar with for the imperative language we will be using &lt;strong&gt;PHP&lt;/strong&gt; and on the functional side we will use &lt;strong&gt;Elixir&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let’s start with a simple example, iterating through an array, adding each of the values and returning the sum. Let’s start with the solution in PHP:&lt;/p&gt;

&lt;iframe src=&quot;https://glot.io/snippets/ee2f163epo/embed&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; sandbox=&quot;allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts&quot; width=&quot;100%&quot; height=&quot;450&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Simple enough, by using the foreach loop we iterate across every single item in the array added to the sum integer and return the total, when its done. Let’s take a look at the &lt;strong&gt;Elixir&lt;/strong&gt; equivalent:&lt;/p&gt;

&lt;iframe src=&quot;https://glot.io/snippets/ee2hjw0uer/embed&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; sandbox=&quot;allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts&quot; width=&quot;100%&quot; height=&quot;450&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Now, your initial reaction might be something like &lt;strong&gt;&lt;em&gt;What in Knuts name is that?!&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;Why are there two declarations of the same function?!&lt;/em&gt;&lt;/strong&gt;. If this is your first time seeing any &lt;strong&gt;Elixir&lt;/strong&gt; code the above snippet might look awfully confusing and hardly making any sense.&lt;/p&gt;

&lt;p&gt;But in reality it’s actually very simple code, taking advantage of a common patter in FP and one of Elixir strongest features; pattern matching. Let’s start by breaking down the code:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;elixir
defmodule SumModule do
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Ok, nothing new to see here; this code might look familiar for anyone with previous experience with the Ruby programming which shouldn’t be surprising considering the creator of the Elixir language was a long time contributor to the Ruby language.&lt;/p&gt;

&lt;p&gt;Moving to the next two lines:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;elixir
def sum_list([]), do: 0
def sum_list([head|tail]), do: sum_list(tail) + head
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here is where the magic happens and where developers with no exposure to functional programming will get confused, how is it possible that we have 2 definition for the same function.&lt;/p&gt;

&lt;p&gt;In elixir this technique is called pattern matching, and the code would read as follows:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;When function &lt;strong&gt;sum_list()&lt;/strong&gt; is called with an empty list, return 0&lt;/li&gt;
  &lt;li&gt;When function &lt;strong&gt;sum_list()&lt;/strong&gt; is called with a non empty list, grab the first element of the list, call &lt;strong&gt;sum_list()&lt;/strong&gt; with the remaining of the list, finally add the head value to the result&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This technique is extremely common in elixir, handle each edge case in a separate function head. No need to worry about complicated control structures.&lt;/p&gt;

&lt;p&gt;Now, I could argue the resulting code is cleaner and I dare to say more elegant, but before making statements like that, let’s make our example more interesting, and change the array to the following values:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;php
$sumList = [5,&#39;four&#39;,2,&#39;ten&#39;,&#39;one&#39;,28,6,&#39;five&#39;];
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Perfect, so now our code has to check if the value is a string or an integer and then convert the string representation into an integer for addition. To make things a little easier we are going add another array with integer values so we don’t have to worry about the conversion.&lt;/p&gt;

&lt;iframe src=&quot;https://glot.io/snippets/ee2f86mgj5/embed&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; sandbox=&quot;allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts&quot; width=&quot;100%&quot; height=&quot;450&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Well that does the trick but the code is definitively getting more complex and is no longer that easy to follow; let’s take the same problem and solve it using elixir:&lt;/p&gt;

&lt;iframe src=&quot;https://glot.io/snippets/ee37d6qn7u/embed&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; sandbox=&quot;allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts&quot; width=&quot;100%&quot; height=&quot;450&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;In both cases the results are the same however, with elixir and pattern matching we get more compact code that doesn’t rely on state, and instead used recursion with strong, well defined conditions. While the examples might not look overly complex and I’m sure they don’t illustrate each language strongest features; they do serve the purpose of illustrating the difference in thinking methodologies and how each the paradigms approach a specific problem.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;In my opinion the benefits of functional programming are very real and valuable if only for the fact that introducing new paradigms to your problem solving toolbox can make you a better programmer; even if in the end you continue using an imperative language.&lt;/p&gt;
</description>
        <pubDate>Mon, 02 May 2016 13:05:11 -0400</pubDate>
        <link>https://coderoncode.com/functional/programming/2016/05/02/functional-programming-the-paradigm-for-the-next-generation.html</link>
        <guid isPermaLink="true">https://coderoncode.com/functional/programming/2016/05/02/functional-programming-the-paradigm-for-the-next-generation.html</guid>
      </item>
    
      <item>
        <title>Back in the Saddle Again</title>
        <description>&lt;p&gt;It has been over 4 months since I posted anything online, in the meantime the world has kept spinning and there are many updates, changes and news to talk about; so why did I suddenly decided to go silent? Well there are a myriad of reasons but primarily it was due to my change in role at Demac Media, for the last 5 months I been operating as the &lt;strong&gt;Director of Engineering&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The title might sound fancy but in essence is the same responsibilities that I been executing officially and unofficially, which include taking care of the developers training and education, code quality, server and infrastructure and developer tools and methodologies.&lt;/p&gt;

&lt;p&gt;So far is a role that I enjoy immensely but that said it’s not without its challenges, more than anything is the scope and size of some of the tasks and how time consuming they can be. Time, there never seems to be enough, right?&lt;/p&gt;

&lt;p&gt;The regrettable side effect of this transition was felt by my personal projects, my writing and overall hobbies and activities outside office related work. Thankfully things have started to stabilize and I’ve gotten better at managing my time and priorities; and with that it only felt right to get back into the saddle and start putting some time and energy back into this blog and other related side projects.&lt;/p&gt;

&lt;p&gt;I’m glad and really looking forward to putting some useful content out and now specially that there are so many new topics to talk about from &lt;strong&gt;Magento2&lt;/strong&gt; to my new obsession &lt;strong&gt;Machine Learning&lt;/strong&gt; and &lt;strong&gt;AI&lt;/strong&gt;.&lt;/p&gt;
</description>
        <pubDate>Sun, 24 Apr 2016 11:55:50 -0400</pubDate>
        <link>https://coderoncode.com/2016/04/24/back-in-the-saddle-again.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2016/04/24/back-in-the-saddle-again.html</guid>
      </item>
    
      <item>
        <title>On Codes on Conduct</title>
        <description>&lt;p&gt;Recently, there has been a lot of controversy and discussion surrounding the adoption of a code of conduct for the PHP project; there has been endless back and forth between proponents and opponents of the motion. I’ve debated if I should publish my opinions on the subject or simply remain quite and hope for the best; however as emails from the internals list continued to flood my inbox, I found it harder and harder to just sit idly silent.&lt;/p&gt;

&lt;p&gt;The following article(s) are heavily opinionated and there is a very good chance that you will disagree with my position and my arguments, the topic by is very nature is extremely contentious and of a sensitive nature. However, they say that &lt;strong&gt;disagreement fosters communication and the exchange of ideas&lt;/strong&gt;; and I’m hoping that is true in this case. With that said, let’s jump into the topic at hand and start talking about code of conduct.&lt;/p&gt;

&lt;h2 id=&quot;codes-of-conduct&quot;&gt;Codes of Conduct&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;A code of conduct is a set of rules outlining the social norms and rules and responsibilities of, or proper practices for, an individual, party or organization. Related concepts include ethical, honour, moral codes and religious laws. – wikipedia&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Albeit general the definition above does a good job of describing the main goal of a code of conduct. Simply speaking, codes of conduct &lt;strong&gt;dictate the way individuals should act and communicate with each other&lt;/strong&gt; in what is deemed a relevant space for a project. Now, inherently there is nothing wrong with the concept of code of conduct as we all can agree that we should strive to provide a welcoming and respectful space.&lt;/p&gt;

&lt;p&gt;Unfortunately, as most things in the real world &lt;strong&gt;it is not as simple as it sounds&lt;/strong&gt; and we need to at least be aware of the consequences, side effects, and political baggage documents like a code of conduct can have.&lt;/p&gt;

&lt;p&gt;Let’s start by taking a closer look to the Code of Conduct original proposed for the PHP project:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/1fb019c5a275d0ae7e38.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;That document is called the &lt;a href=&quot;http://contributor-covenant.org&quot;&gt;contributors covenant&lt;/a&gt;, a template for the code of conduct currently &lt;strong&gt;in use by around 10,000 open source projects&lt;/strong&gt; — impressive number, specially considering some of them are quite large. Before I jump into some of my more controversial opinions about this document, let’s analyze the language and the document itself solely based on its content.&lt;/p&gt;

&lt;p&gt;Let’s break it down paragraph by paragraph.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok so far so good, there is nothing wrong or arguable with the first paragraph; striving to make &lt;strong&gt;our community more open and welcoming is something all of us can agree with.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here the waters start to get a little bit muddy, while at first glance everything seems reasonable enough, by taking a look at the language we can see a couple of issues; those mainly being that the &lt;strong&gt;list of harassment topics is not wide enough&lt;/strong&gt; as well as the fact that the paragraph &lt;strong&gt;doesn’t set the scope&lt;/strong&gt; on which the project maintainers are supposed to act on.&lt;/p&gt;

&lt;p&gt;Think about for a second, under the current covenant any comment, retweet, blog post, etc., could be taken in consideration for a harassment or discrimination complain; even if it has nothing to do with the PHP project.&lt;/p&gt;

&lt;p&gt;Let me present a better version of the second paragraph:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;We are committed to evaluating contributions &lt;strong&gt;within project channels&lt;/strong&gt; (such as reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other project activities) without regard to the contributor’s &lt;strong&gt;level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, politics, or activity outside of project channels.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On it we limit the scope to only the project channels — which should be clearly defined in a later section — as well it accounts for political opinions and views of the contributors and defends them from discrimination. Let’s move on to the next paragraph:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Examples of unacceptable behaviour by participants include:&lt;/p&gt;

  &lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other&#39;s private information, such as physical or electronic addresses, without explicit permission
- Other unethical or unprofessional conduct
&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;Another paragraph that at first glance is hard to disagree with, but reading carefully we need to define what is considered personal attacks, trolling or unprofessional conduct.&lt;/p&gt;

&lt;p&gt;Again open and &lt;strong&gt;vague language can lend itself to abuse&lt;/strong&gt;, specially on a document that calls for drastic punitive action like this one does.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviours that they deem inappropriate, threatening, offensive, or harmful.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And now we get to the part that causes me the most concern, the paragraph above describe the list of sanctions and punitive action that must be taken for anyone that is found violating the CoC.&lt;/p&gt;

&lt;p&gt;Regardless if is temporary or permanent the act of banning someone from the project &lt;strong&gt;can have real world consequences and affect people’s livelihood&lt;/strong&gt;. I’ll clarify what I mean with real world consequences and why I believe that whole idea of punitive actions is highly misguided further down the article.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I kept re-reading this paragraph, and it keep bothering; as a project maintainer you are not only bound to make the project fair and welcoming but you are bound to follow the covenant to the letter or get permanently banned yourself.&lt;/p&gt;

&lt;p&gt;Again, the emphasis is in the punitive action; follow our rules or else!&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Finally, a mention of scope  and limits … but no wait that’s it ? Correct, again &lt;strong&gt;extremely open ended and vague language;&lt;/strong&gt; you could argue that you are always representing the language in public and private, there are no boundaries; not for your own point of views, nor for personal life.&lt;/p&gt;

&lt;p&gt;Vagueness can lead to situations where people get easily banned for comments, views or postings that are completely unrelated to the actual project; &lt;strong&gt;it doesn’t matter if you say that your tweets are ‘performance art’;&lt;/strong&gt; if someone deems them offensive you run the risk of getting labeled and thrown away from the project.&lt;/p&gt;

&lt;p&gt;This exposes another weakness or oversight in the contributors covenant code of conduct, &lt;strong&gt;it doesn’t account for intent&lt;/strong&gt;, nor it takes provisions to restrict who can and can’t report issues. Brandon Savage brought this point masterfully on the PHP mailing list — you can read the &lt;a href=&quot;http://news.php.net/php.internals/90850&quot;&gt;full email here&lt;/a&gt;—.&lt;/p&gt;

&lt;p&gt;I won’t cover the full extend of the issue as presented by &lt;strong&gt;Brandon&lt;/strong&gt;, but here are his proposed  inclusions and corrections to the CoC:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The Code of Conduct should specifically state that a person who is not a direct party to the alleged incident is not permitted to make a complaint.&lt;/li&gt;
  &lt;li&gt;We should require that any person who is accused of violating the Code of Conduct clearly have intent to do so. This is a harder standard to prove, but one that should help us from having to deal with edge cases. A death threat is a clear-cut case of intent, for example.&lt;/li&gt;
  &lt;li&gt;The Code of Conduct should be modified so that abiding or not abiding by it is demonstrable with evidence, taking “feelings” out of it entirely. For example, a person shouldn’t be in violation of the code because someone “feels harassed/trolled/etc”, it should be because they’re ACTUALLY harassed/trolled/etc.&lt;/li&gt;
  &lt;li&gt;The Code of Conduct should bar filing a claim of harassment if harassment from both parties towards one another can be demonstrated. This avoids a race to the courthouse by one side to punish the other in an argument.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All &lt;strong&gt;worthy additions&lt;/strong&gt; to the code of conduct to prevent abuse and limit the number of edge cases and people affected by them.&lt;/p&gt;

&lt;h2 id=&quot;punitive-action-and-the-real-world&quot;&gt;Punitive action and the real world&lt;/h2&gt;

&lt;p&gt;Many of the concerns that have been voiced regarding this CoC are related to the apparent focus on punitive action; this CoC is at its core a &lt;strong&gt;laundry list of forbidden behaviour&lt;/strong&gt; that people are required to avoid and to ensure compliance the threat of the perma-ban hammer hangs over their heads.&lt;/p&gt;

&lt;p&gt;Unfortunately, this will likely not end with just one person getting banned from the PHP project but it could &lt;strong&gt;potentially end up having more serious repercussions&lt;/strong&gt;. So far we have discussed the CoC in the PHP context; but let’s remember that the current CoC is based and following the Contributors Covenant, which has the issues I listed above.&lt;/p&gt;

&lt;p&gt;Currently, over 10,000 projects follow this contributors covenant as it’s currently provisioned and enforced, &lt;strong&gt;the following scenario is not outside of the realm of possibility:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once a developer is deemed in violation of the Contributors Covenant what stops any of the other covenant projects from saying &lt;strong&gt;‘Well he/her was labelled as an harasser/bigot/sexist by X project why should we allow him to do the same thing here in project Y less ban him/her before they can cause any harm’.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, before I get accused of &lt;strong&gt;fabricating straw-man&lt;/strong&gt; arguments or exaggerating let me clarify there is no indication or record that the scenario has occurred nor that there are any plans to do something of that nature.&lt;/p&gt;

&lt;p&gt;Recently, I listened to a prominent figure inside the &lt;strong&gt;PHP community talk&lt;/strong&gt; about the subject, all I can say is it was disappointing to hear said person take such a dismissive attitude towards the concerns of people that oppose to the current CoC.&lt;/p&gt;

&lt;p&gt;If we are truly talking about creating a welcoming and open community, then we need to listen and address the concerns of &lt;strong&gt;detractors&lt;/strong&gt; as much as we do for the proponents of the CoC; after all, the goal is equality and fairness; &lt;strong&gt;is it not?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even without accounting for this scenario, getting banned from contribution under the &lt;strong&gt;accusation of misconduct&lt;/strong&gt; could cause problems in the real world and their work; you could get you banned from conferences, affect publishing deals, in short, it could royally mess up with your career.&lt;/p&gt;

&lt;h2 id=&quot;next-steps-forward&quot;&gt;Next steps forward&lt;/h2&gt;

&lt;p&gt;As it stands, the current proposal for the Code of Conduct has hit an impasse; the more the discussion seems to go on, the more it seems that the proposal is attempting to &lt;strong&gt;setup a mini-judicial system;&lt;/strong&gt; and speaking candidly, the &lt;strong&gt;PHP community is not capable of pulling this off.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are so many variables and processes, not to mention, the &lt;strong&gt;balances and checks&lt;/strong&gt; that there would need to be in place in order for this to be successful. For that reason, I would like to put forward my own version of a code of conduct that I feel would be a better fit for the PHP Community, if anything at all, take it as a source of ideas coming from a different perspective.&lt;/p&gt;

&lt;p&gt;I call it &lt;a href=&quot;https://github.com/amacgregor/Pragmatists-Code-of-Conduct/blob/master/Prag-Code-of-Conduct.md&quot;&gt;The Pragmatist Code of Conduct&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Sun, 24 Jan 2016 19:41:40 -0500</pubDate>
        <link>https://coderoncode.com/community/2016/01/24/on-codes-on-conduct.html</link>
        <guid isPermaLink="true">https://coderoncode.com/community/2016/01/24/on-codes-on-conduct.html</guid>
      </item>
    
      <item>
        <title>Exploring Elixir Recursion and Lists</title>
        <description>&lt;p&gt;Recently, I’ve been playing with a new language called &lt;a href=&quot;http://elixir-lang.org/&quot;&gt;Elixir&lt;/a&gt;. Elixir is a &lt;strong&gt;functional programming language&lt;/strong&gt; specifically designed with the intention of creating scalable and maintainable applications.&lt;/p&gt;

&lt;p&gt;As many developers my main experience with programming languages and paradigms has been with &lt;strong&gt;object oriented programming&lt;/strong&gt;; functional programming is a completely different beast and as I explore and learn more, the more fascinating I find the promises and ideas behind functional programming.&lt;/p&gt;

&lt;p&gt;One of the things that has been messing with my head considerably is the fact that functional programming relies heavily on recursion. Now, technically speaking elixir is not a purely functionaly language and the way they implement &lt;strong&gt;immutability&lt;/strong&gt; is a bit different; that being said in elxir as in any other functional programming language &lt;strong&gt;there are no loops&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;No loops!? no &lt;strong&gt;foreach&lt;/strong&gt;, no &lt;strong&gt;for&lt;/strong&gt;, no &lt;strong&gt;while&lt;/strong&gt; instead we get recursion; where a function gets called recursively until a condition is reached that stops the recursive action from ocurring again — for example processing each element in a list until the list is empty.&lt;/p&gt;

&lt;p&gt;Sounds confusing right? Let’s look at an example:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/93b23d7260b62a0b72e5.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The previous code is part of an exercise I did for &lt;a href=&quot;http://exercism.io&quot;&gt;Exercism.io&lt;/a&gt; that required to reimplement the functionality of the native List module; the count function will take a list of numbers and return a count of the elements inside the list.&lt;/p&gt;

&lt;p&gt;If this is the first time you look at elixir the first thing to jump at you is that it seems we are defining the count function twice; this is not a mistake and is one of the most amazing features of the elixir language, it’s called &lt;strong&gt;pattern matching&lt;/strong&gt; I won’t into detail on how that works on this post but suffice to say that the first definition will only be called if we recieve an empty list.&lt;/p&gt;

&lt;p&gt;Back to recursion, let’s take a look at the second defintion of the function:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;elixir
  def count([_|tail]) do
    count(tail) + 1
  end
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;All we are doing at this point is taking out the first element of the list passing it to the count function and returning the &lt;strong&gt;result + 1&lt;/strong&gt; on every single instance, but how does that work exactly let’s break it down assuming we pass &lt;strong&gt;[1,2,3,4,5]&lt;/strong&gt; as parameter:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;elixir
count([1,2,3,4,5])                           #returns 4 + 1
  &quot;this in turn calls&quot; -&amp;gt; count([2,3,4,5])   #returns 3 + 1 
  &quot;this in turn calls&quot; -&amp;gt; count([3,4,5])     #returns 2 + 1
  &quot;this in turn calls&quot; -&amp;gt; count([4,5])       #returns 1 + 1
  &quot;this in turn calls&quot; -&amp;gt; count([5])         #returns 0 + 1
  &quot;this in turn calls&quot; -&amp;gt; count([])          #returns 0
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is a very simple example of the power of recursion but illustrates the concept very well. For now the most imporant thing about recursion is that we don’t need mutable state while iterating through a list of values — a.k.a solving a problem.&lt;/p&gt;
</description>
        <pubDate>Sun, 17 Jan 2016 15:46:54 -0500</pubDate>
        <link>https://coderoncode.com/elixir/2016/01/17/exploring-elixir-recursion-and-lists.html</link>
        <guid isPermaLink="true">https://coderoncode.com/elixir/2016/01/17/exploring-elixir-recursion-and-lists.html</guid>
      </item>
    
      <item>
        <title>2016 the Year of Quantified Self</title>
        <description>&lt;p&gt;Quantified self and self-improvement have been on my radar for a few years now, and with a new year starting I finally decided to give it a serious try and see what outcomes I get from it.&lt;/p&gt;

&lt;p&gt;For anyone not familiar with the concept, quantified self is a movement to incorporate data acquisition technologies on aspects of a person’s daily life; for example mood over time, food consumed, weight, heart rate, etc.&lt;/p&gt;

&lt;div style=&quot;font-size:60px; text-align:center&quot;&gt;You Can&#39;t Improve What You Don&#39;t Measure&lt;/div&gt;

&lt;p&gt;Quantified-self focus on tracking three principal categories:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Inputs: Food consumed, water intake, etc&lt;/li&gt;
  &lt;li&gt;States: Mood, heart rate, blood oxygen levels, stress levels&lt;/li&gt;
  &lt;li&gt;Performance: Mental and physical&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Self-monitoring is already more common than what people realized, just take a look at their wrists chances are you or someone you know uses a fitness tracker already.&lt;/p&gt;

&lt;p&gt;Fitness trackers like the Fitbit or Up are what I would call entry level self-monitoring devices; since they are often limited to simple fitness tracking like steps walked, calories burned and in some case basic heart rate.&lt;/p&gt;

&lt;p&gt;However, in term of quantified self, data is king and the more of it we have, the better, right? Well, that is true to some degree —we can always drown in meaningless data— when thinking about what kind of data we should collect we need first to consider the outcomes. That is to say what information can I get from the data collected? Will it give me actionable items?&lt;/p&gt;

&lt;p&gt;More often than not, a single metric won’t give you the full picture when you look at it in isolation, but when look in correlation with another data is where we might start learning interesting things about ourselves, for example, a correlation between poor sleep and the number of coffee consumed on a given day, or water consumption vs. daily mood.&lt;/p&gt;

&lt;p&gt;This is to me the fascinating part of self-monitoring; it’s not enough to have healthy habits if we don’t understand how those habits affect the big picture and our overall enjoyment of life.&lt;/p&gt;

&lt;p&gt;In that sense I’m starting 2016 with self-monitoring as one of my top priorities; trying to track as much as possible but making it as easy and low effort as possible; automating where I can and reducing friction where possible.&lt;/p&gt;

&lt;p&gt;I’ll go into more detail on the tools and software that I’m planning to use in a future post; as I’m still playing and tweaking my setup.&lt;/p&gt;
</description>
        <pubDate>Sun, 03 Jan 2016 11:10:06 -0500</pubDate>
        <link>https://coderoncode.com/health/2016/01/03/2016-the-year-of-quantified-self.html</link>
        <guid isPermaLink="true">https://coderoncode.com/health/2016/01/03/2016-the-year-of-quantified-self.html</guid>
      </item>
    
      <item>
        <title>On New Year&#39;s Resolutions</title>
        <description>&lt;p&gt;Another year came and went, and as we do every year we are expected setup new resolutions and new goals for the upcoming year. It’s the usual thing to do that society expects of every single one of us.&lt;/p&gt;

&lt;p&gt;I can almost hear family and coworkers asking — So, Any new year resolutions?— And like every year I’m tempted to answer yes and list some of the many things on my ever-growing todo list:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Learn guitar&lt;/li&gt;
  &lt;li&gt;Finish that book I been working on for months&lt;/li&gt;
  &lt;li&gt;Do more exercises&lt;/li&gt;
  &lt;li&gt;etc. etc. etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But this year I’m done deluding myself and setting up goals that I know I won’t follow, my only resolution for 2016 is simple:&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Be Happy&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;Being happy means I will spend more time on the things that bring me joy and happiness and less worrying and suffering on doing things I don’t like; it’s as simple as that, do more of what I like and less of what I dislike.&lt;/p&gt;

&lt;p&gt;On &lt;em&gt;2016&lt;/em&gt; what will you do to be happy?&lt;/p&gt;
</description>
        <pubDate>Fri, 01 Jan 2016 10:41:30 -0500</pubDate>
        <link>https://coderoncode.com/productivity/2016/01/01/on-new-years-resolutions.html</link>
        <guid isPermaLink="true">https://coderoncode.com/productivity/2016/01/01/on-new-years-resolutions.html</guid>
      </item>
    
      <item>
        <title>TDD is not Dead</title>
        <description>&lt;p&gt;So, where does this whole &lt;strong&gt;TDD is DEAD&lt;/strong&gt; thing came from? Well, it all started with let’s say a provocative talk and follow up blog post by David Heinemeier Hansson (@DHH) where he expressed his frustration with testing and put into question the value of TDD.&lt;/p&gt;

&lt;p&gt;To break down DHH’s points and concerns against TDD:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Developers make you feel like your code is dirty if you don’t practice TDD.&lt;/li&gt;
  &lt;li&gt;Driving design from unit tests is not a good idea.&lt;/li&gt;
  &lt;li&gt;TDD notion of “fast tests” is shortsighted.&lt;/li&gt;
  &lt;li&gt;100% coverage is silly.&lt;/li&gt;
  &lt;li&gt;TDD created test-induced design damage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TDD is not dead, not really. And it won’t really ever be dead, it will change or be replaced with something better; in fact it already has, and in my &lt;a href=&quot;http://magetdd.com&quot;&gt;Magento Extension Test Driven Development&lt;/a&gt; book we focus on Behavior Driven Development, an approach that emerged from the original TDD methodology.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development. – &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Behavior-driven_development&quot;&gt;Wikipedia&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’ll quickly address each of DHH’s points:&lt;/p&gt;

&lt;h4 id=&quot;developers-make-you-feel-like-your-is-dirty-if-you-dont-practice-tdd&quot;&gt;1.- Developers make you feel like your is dirty if you don’t practice TDD&lt;/h4&gt;
&lt;p&gt;I agree, this sucks! &lt;strong&gt;Developer shaming is never a good thing.&lt;/strong&gt; Rather than shaming a developer that doesn’t do TDD or testing; teach and share. That’s the best way to help the community grow.&lt;/p&gt;

&lt;h4 id=&quot;driving-design-from-unit-tests-is-not-a-good-idea&quot;&gt;2.- Driving design from unit tests is not a good idea&lt;/h4&gt;
&lt;p&gt;I don’t agree. Tools like &lt;strong&gt;PHPSpec&lt;/strong&gt; do an incredible job helping us not only to test our code, but to drive our design and produce cleaner code.&lt;/p&gt;

&lt;h4 id=&quot;tdd-notion-of-fast-tests-is-shortsighted&quot;&gt;3.- TDD notion of “fast tests” is shortsighted&lt;/h4&gt;
&lt;p&gt;Well, not true at all. When working on a TDD cycle, you want your test to &lt;strong&gt;run as fast as possible&lt;/strong&gt; (within reason) to get that constant feedback and validate your code.&lt;/p&gt;

&lt;h4 id=&quot;coverage-is-silly&quot;&gt;4.- 100% coverage is silly.&lt;/h4&gt;
&lt;p&gt;I have to agree on this one. Be pragmatic about your testing. Test only when it matters and think twice to see if your test is adding value.&lt;/p&gt;

&lt;h4 id=&quot;tdd-created-test-induced-design-damage&quot;&gt;5.- TDD created test-induced design damage.&lt;/h4&gt;
&lt;p&gt;Again, I have to disagree. Properly used &lt;strong&gt;TDD/BDD&lt;/strong&gt; can lead to clean, maintainable, and easy to understand designs. Blaming TDD for poor design is like blaming your IDE for poor code indentation; be pragmatic with your tools.&lt;/p&gt;

&lt;h3 id=&quot;testing-sounds-like-too-much-work--testing-will-make-my-development-slower&quot;&gt;Testing sounds like too much work / Testing will make my development slower&lt;/h3&gt;

&lt;p&gt;TDD does add a bit more overhead, specially while you are still getting familiar with the tools and the process. So I won’t lie to you, chances are that your process will get slower in the beginning, but as you get better with the tools and more accustomed to the testing process, you’ll become faster.&lt;/p&gt;

&lt;div style=&quot;font-size:50px; text-align:left&quot;&gt;
Think about writing tests as an investment account; you will see a greater return of your investment with time.
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Also with &lt;strong&gt;Phpspec&lt;/strong&gt;, our tests are thorough code examples and a form of living documentation. But how does all that apply to Magento?&lt;/p&gt;

&lt;h3 id=&quot;magento-1x-is-not-testable-it-is-impossible-to-write-tests-for-it&quot;&gt;Magento 1.x is not testable, it is impossible to write tests for it.&lt;/h3&gt;

&lt;p&gt;Testing Magento 1.x has always been a difficult topic; Magento (at least in its current iteration) doesn’t lend itself too well to testing.&lt;/p&gt;

&lt;p&gt;Over the years, there have been several attempts at providing some degree of testing to the platform: from the official &lt;strong&gt;MTAF&lt;/strong&gt; (Magento Testing Automation Framework) to the community-driven tools like &lt;strong&gt;Ecomdev’s PHPUnit&lt;/strong&gt; extension.&lt;/p&gt;

&lt;p&gt;For the longest time, testing was something that wasn’t discussed that much in the Magento community, and honestly it is not surprising, since building proper tests for Magento extensions can be difficult even for seasoned veterans; let’s not say the junior developer just getting started with Magento.&lt;/p&gt;

&lt;h3 id=&quot;magento-2-and-the-grail-of-testing&quot;&gt;Magento 2 and the Grail of Testing&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Magento 2&lt;/strong&gt; is changing that for the better by using design patterns like dependency injection and by having a massive test suite from the start. As with any change, you can see some resistance and skepticism among the community members. To be honest, it’s not without reason, I for one find the concept of &lt;strong&gt;100% code coverage misleading&lt;/strong&gt;. After all, useless tests do exist. With all that being said, I’m hopeful of the changes that Magento2 is introducing both to codebase and the developer community. I truly believe that for the most part they are positive ones.&lt;/p&gt;

&lt;p&gt;At the end of the day, it is the community’s opinion what matters, so what do you think? Is Magento2 overusing dependency injection? Is the test suite useful? How will the introduction of all these new paradigms change the way you develop Magento extensions? Don’t hesitate to leave a comment below.&lt;/p&gt;

&lt;p&gt;P.D: Parts of this post were taken from my new book &lt;a href=&quot;http://magetdd.com&quot;&gt;Magento Test Driven Extension Development&lt;/a&gt; if you are interested to learn more about TDD/BDD development in Magento go ahead and click the link!&lt;/p&gt;
</description>
        <pubDate>Thu, 03 Sep 2015 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/testing/magento/2015/09/03/tdd-is-not-dead.html</link>
        <guid isPermaLink="true">https://coderoncode.com/testing/magento/2015/09/03/tdd-is-not-dead.html</guid>
      </item>
    
      <item>
        <title>Manfred Macx and the Problem of Information Overload</title>
        <description>&lt;p&gt;I’ve always been fascinated with the technology concepts presented on &lt;strong&gt;Charles Stross&lt;/strong&gt; book &lt;em&gt;Accelerando&lt;/em&gt;, artificial cats, downloads of consciousness, nanotechnology, etc. but of all of them one got my particular attention; Manfred Marcx glasses.&lt;/p&gt;

&lt;p&gt;Glasses? What’s so special about the glasses? Well this are not an ordinary pair of glasses, they are in fact augmented reality glasses, informing Manfred about recent news, results from search agents, phone calls, navigation instructions and what ever information he desires.&lt;/p&gt;

&lt;p&gt;We could call them &lt;strong&gt;smart glasses&lt;/strong&gt;, in the book this glasses allow Manfred to be on the bleeding age of technology and information; to the extreme without them he is incapable of functioning.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In Charles Stross’ Accelerando, the arrival of the technological singularity is prefaced in the first section of the novel with the story of Manfred Macx, a hyper-connected, post-economic entrepreneur who relies on reputation and good-will rather than traditional monetary wealth.
– &lt;strong&gt;Source: &lt;a href=&quot;http://www.academia.edu/1247436/Post-human_post-memory_Mnemotechnology_in_Charles_Stross_Accelerando&quot;&gt;Post-human, post-memory: Mnemotechnology in Charles Stross’ Accelerando&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The attractive part here is not the augment reality glasses themselves but system that powers them, an exocortex.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;An EXOcortex can best be described as the portion of a trans- or posthuman entity’s brain (or cortex) which exists outside of that entity’s primary computing structure, usually the brain inhabiting a person’s “meatbody.” For example, a person’s exocortex could very well be composed of all the external memory modules, processor, and devices that the person’s biological brain interacts with on a realtime basis, thereby in effect making those external devices a functional part of the individual’s “mind.” – &lt;strong&gt;Source: &lt;a href=&quot;https://en.wikibooks.org/wiki/Accelerando_Technical_Companion&quot;&gt;Wikibooks&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While we are still years if not decades away of being able to directly enhance our biological brain with help of external hardware, current technology should be more than sufficient for creating at least an early version of the software an exocortex system would need.&lt;/p&gt;

&lt;h2 id=&quot;defining-the-implementation&quot;&gt;Defining the implementation&lt;/h2&gt;

&lt;p&gt;The first instinct for a project like this would be to go and develop a complex architecture, maybe a multi-agent system; yes that would be cool …. and also extremely complicated. But, what if switch the concept a little bit, what if instead of having a swarm of intelligent agents, we use a micro-service architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Could that work?&lt;/strong&gt; Will that architecture work or fail miserably due to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;network latency&lt;/li&gt;
  &lt;li&gt;message formats&lt;/li&gt;
  &lt;li&gt;fault tolerance&lt;/li&gt;
  &lt;li&gt;deployment complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The system should not only help with data consumption and processing but also with information generation.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If we’re not doing something with the information we’re taking in, then we’re just pigs at the media trough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is where the challenge comes in, I can build a system that feeds me information, sure. But can I build a system that, helps me to generate content faster and more efficiently.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The metacortex is the Web — our growing global network of information, people, sensors, and computing devices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Also would that be considered an exocortex or more akin to a metacortex, all relevant questions but besides the point of an initial prototype implementation.&lt;/p&gt;

&lt;p&gt;More interesting are the advantages of a distributed system like this, and the mailability it could offer. A system that is comprised of microservices wouldn’t care about the implementation of each service; as long as they respect the common contract for communication.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Web is literally a new layer of the human brain that transcends any individual brain. It is a global brain that connects all our brains together. It is intelligent. It is perhaps humanity’s greatest invention.  It collectively senses, reacts, interprets, learns, thinks, and acts in ways that we as individuals can barely comprehend or predict, and this activity comprises an emerging global mind. – &lt;strong&gt;Source: &lt;a href=&quot;http://www.novaspivack.com/web-3-0/a-new-layer-of-the-brain-is-evolving-the-metacortex&quot;&gt;Nova Spivak&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Although even in a distributed service architecture there has to be a central point of orchestration, a system or process that is in charge of defining and running the tasks.&lt;/p&gt;

&lt;h1 id=&quot;option-1&quot;&gt;Option 1&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Create a chain of events and services&lt;/li&gt;
  &lt;li&gt;Each service in the chain calls back to the next service in line&lt;/li&gt;
  &lt;li&gt;The task runner is only concerned about starting the chain of events&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;option-2&quot;&gt;Option 2&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Decoupled services&lt;/li&gt;
  &lt;li&gt;Central system implements adapter for each&lt;/li&gt;
  &lt;li&gt;Runs each step of the task passing the relevant data&lt;/li&gt;
  &lt;li&gt;Can track the progress of each task.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point in time Option 2 seems more attractive, it also gives me the flexibility to integrate third party services into this structure without having to code the service myself. And I can leverage sites like &lt;a href=&quot;http://www.mashape.com&quot;&gt;mashape.com&lt;/a&gt; to help me with at least the initial implementation.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;An exocortex is a theoretical artificial external information processing system that would augment a brain’s biological high-level cognitive processes.
An individual’s exocortex would be composed of external memory modules, processors, IO devices and software systems that would interact with, and augment, a person’s biological brain. Typically this interaction is described as being conducted through a direct brain-computer interface, making these extensions functionally part of the individual’s mind. – &lt;strong&gt;Source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Exocortex&quot;&gt;Wikipedia&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;narrowing-the-scope&quot;&gt;Narrowing the Scope&lt;/h2&gt;

&lt;p&gt;To measure progress and success, I need to define achievable goals first, in order to do that I have to narrow the scope and define what I want to gain from my “exocortex”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Do I want …&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Better &lt;strong&gt;memory&lt;/strong&gt; and indexation&lt;/li&gt;
  &lt;li&gt;Help with &lt;strong&gt;data&lt;/strong&gt; consumption&lt;/li&gt;
  &lt;li&gt;Improve my content &lt;strong&gt;output&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Automated&lt;/strong&gt; tedious tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Well, yes to all the above; but which one(s) would help me the most right now? Based on my current goals, and the current challenges I’m facing; data consumption and subsequently content output would be extremely handy.&lt;/p&gt;

&lt;p&gt;Still, the scope seems to wide; we can narrow it further if we set an example use case.&lt;/p&gt;

&lt;h3 id=&quot;example-1&quot;&gt;Example 1&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
EVERY [30min]
	GET [rss_feeds] OF [www.joelonsoftware.com,blog.cleancoder.com]
		AND GET [subreddit] OF [programming,coding,php]
		AND GET [hnews]
THEN
	DO [categorization] of {title}
WHEN
  {categories} HAVE_ONE_OF [tdd,bdd,agile]
  POST_TO [Summarizer Queue]
&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;example-2&quot;&gt;Example 2&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
EVERY [30 minutes]
	GET [RSS feeds] OF [www.joelonsoftware.com, blog.cleancoder.com]
		AND GET [Subreddit feeds] OF [programming, coding, php]
		AND GET [HNews New]
	THEN
		DO [Categorization] OF {title}
		DO [Classification] OF {title}
WHEN
	{score} GREATER THAN &amp;gt; [0.7]
	POST TO [Direct Email]
WHEN
  {categories} HAVE ONE OF [tdd,bdd,agile]
  POST TO [Summarizer Queue]
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next?&lt;/h2&gt;

&lt;p&gt;Sounds good so far, I been working on the architecture for this project for the last year or so, and already have a working prototype for data collection. Here is where the fun part begins since I can collect reasonable amounts of data what should I do with them?&lt;/p&gt;

&lt;p&gt;I’ll go over the details of the data collection implementation on the next post.&lt;/p&gt;
</description>
        <pubDate>Fri, 17 Jul 2015 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/technology/futurism/2015/07/17/manfred-macx-and-the-problem-of-information-overload.html</link>
        <guid isPermaLink="true">https://coderoncode.com/technology/futurism/2015/07/17/manfred-macx-and-the-problem-of-information-overload.html</guid>
      </item>
    
      <item>
        <title>On Encrypting Magento Extensions</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;The opinions expressed here represent my own and not those of my employer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Recently there has been much debate over if Magento Connect should allow encrypted extensions and if so in what shape and form. The following post is my honest, uncensored opinion about the whole situation, please read the whole thing you might be surprised by my conclusions.&lt;/p&gt;

&lt;h1 id=&quot;its-rant-time&quot;&gt;Its Rant time&lt;/h1&gt;

&lt;p&gt;Let me start by saying that &lt;strong&gt;I absolutely detest encrypted extensions&lt;/strong&gt; and find IonCube encrypted code abhorrent. Let’s leave aside the philosophical argument about open source and
openness.&lt;/p&gt;

&lt;p&gt;My reasons for hating obfuscated/encrypted code are much more practical and mundane, it all comes down to having control over the code is running on a specific project, having the flexibility to change it, trusting the code follows certain standards.&lt;/p&gt;

&lt;h2 id=&quot;control&quot;&gt;Control&lt;/h2&gt;

&lt;p&gt;As developer any third party extension paid or not that goes into any of my projects has to go through several tools like php-metrics, php-codesniffer, php-messdetector and so on to make  sure that the code meets certain standards. Code quality, stability and adherence to standards  are things that I consider important and the lack off quality in Connect extensions was my main motivator to create &lt;a href=&quot;http://www.triplecheck.io&quot;&gt;triplecheck.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Encryption puts code whatever quality it might be on a black box where we cannot check, test or fix it; worse comes to worse we are still responsible for supporting an maintaining the sites running said extension. Moreover, believe me, not every merchant is going to be understanding enough when you tell them&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“Well there is nothing I can do to fix the extension, I  have to wait for the extension developer to answer back; with luck it will be in a week.
Please close your business for the meantime.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;flexibility&quot;&gt;Flexibility&lt;/h2&gt;

&lt;p&gt;Now don’t get me wrong there are some really good extensions in the market and some exceptional extension providers out there, but that being the case sometimes we need a to add functionality to a third party extension that get us 3/4 of the way to where we need to be.&lt;/p&gt;

&lt;p&gt;With an encrypted codebase, that is not an option you get what you paid for and sometimes even less, as a developer I cannot debug or extend a third party extension. I am confined to a little black box of obfuscation, and complete powerless to change it.&lt;/p&gt;

&lt;h2 id=&quot;security-and-trust&quot;&gt;Security and Trust&lt;/h2&gt;

&lt;p&gt;Encrypting code even if is part of the overall extension is asking for merchants and developers to trust on that extension provider, and Big Time. There could be anything hiding inside that encrypted file.&lt;/p&gt;

&lt;p&gt;And no, I am not playing with scare tactics here, let put a little code snippet as an
example:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
    public function validate()
    {
        return $this;
        parent::validate();
        $currency_code = $this-&amp;gt;getOrderData()-&amp;gt;getBaseCurrencyCode();
        if (!in_array($currency_code,$this-&amp;gt;_allowCurrencyCode)) {
            Mage::throwException(Mage::helper(‘extensionname’)-&amp;gt;__(‘Selected currency
code (‘.$currency_code.’) is not compatible with extensionname’));
        }
        //mage::log(“Validate “);
        return $this;
    }
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Yes, this charming piece of code goes for around &lt;strong&gt;$300USD&lt;/strong&gt; the code was taken as it is but the name removed. Good luck trying to figure what was happening if the code was encrypted; extensions like this one are why encryption also becomes a trust problem; can you trust the extension developer not to take shortcuts, follow best practices and not do stupid code like the one above?&lt;/p&gt;

&lt;h1 id=&quot;time-for-a-sensible-argument&quot;&gt;Time for a sensible argument&lt;/h1&gt;

&lt;p&gt;By know I have established my complete dislike of encrypted code, and if that is true the only logical conclusion can be that Magento Connect should not allow encrypted extension on its market place, right?&lt;/p&gt;

&lt;p&gt;Well no, after a lot of though and consideration, I do believe that encrypted extensions should be allowed into Connect, and you are probably thinking. &lt;strong&gt;Wtf?! after that rant!? you are saying yes to encrypted code!!!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am and for a very simple reason, Magento Connect should be a platform open to everyone wanting to sell and promote their extensions; is up to the extension developer to decide if they want go that route, and is up to the merchant to decide if they want to deal with the possible drawbacks.&lt;/p&gt;

&lt;p&gt;In the end, regardless my or anyone else personal preferences the market will speak. &lt;strong&gt;Will encrypted extensions thrive or wither&lt;/strong&gt;? Is up to the ecosystem and the market to decide.&lt;/p&gt;
</description>
        <pubDate>Thu, 09 Jul 2015 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/programming/magento/magento-connect/ethics/coding/2015/07/09/on-encrypting-magento-extensions.html</link>
        <guid isPermaLink="true">https://coderoncode.com/programming/magento/magento-connect/ethics/coding/2015/07/09/on-encrypting-magento-extensions.html</guid>
      </item>
    
      <item>
        <title>Git Tips and Tricks</title>
        <description>&lt;p&gt;Recently I’ve been collecting a large collection of git shortcuts, tips and tricks. The following
commands have been tested on linux and some of them will required a recent version of git.&lt;/p&gt;

&lt;p&gt;I expect that many of you will find them useful as much as I do. So let’s get started with some
simple but helpful commands to search and review your git repository history.&lt;/p&gt;

&lt;h2 id=&quot;show-log-for-only-a-specific-branch&quot;&gt;Show log for only a specific branch&lt;/h2&gt;

&lt;p&gt;The following command can be used if you are working on a project with a particular dirty history or
a log of branches&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
git log --first-parent {branch_name}
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;show-the-log-as-a-single-line&quot;&gt;Show the log as a single line&lt;/h2&gt;

&lt;p&gt;The following command will show the commit has and the first line of the commit comment.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
git log --pretty=oneline --abbrev-commit
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A more advanced and nicer version of the command above is:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
git log --graph --pretty=oneline --abbrev-commit --date=relative
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;search-for-a-string-in-all-commits-across-the-entire-git-history&quot;&gt;Search for a string in all commits across the entire git history&lt;/h2&gt;

&lt;p&gt;This can be really useful when looking for a particular piece of code to see when it was
added/removed:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
git log -S{text_to_search}
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;shows-branches-that-are-all-merged-in-to-your-current-branch&quot;&gt;Shows branches that are all merged in to your current branch&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
git branch --merged
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And in the same way we can see all the branches that haven’t yet been merged.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
git branch --no-merged
&lt;/code&gt;&lt;/p&gt;
</description>
        <pubDate>Sat, 04 Apr 2015 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/git/github/linux/tips/programming/2015/04/04/git-tips-and-tricks.html</link>
        <guid isPermaLink="true">https://coderoncode.com/git/github/linux/tips/programming/2015/04/04/git-tips-and-tricks.html</guid>
      </item>
    
      <item>
        <title>Getting Started With Magento and Docker for Development</title>
        <description>&lt;p&gt;Docker has taken the DevOps community by storm and is rapidly changing the ecosystem towards distributed architectures, and in case you haven’t heard about Docker here is the quick definition:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And while Docker brings amazing things to the table in terms of application architecture, scalability and so on, in this post we are going to use docker to streamline the development pipeline.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;

&lt;p&gt;If you are reading this article, chances are that you work for a Magento Agency and likely your development flow looks something like this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Developers work on local versions of the site and make frequent changes&lt;/li&gt;
  &lt;li&gt;Code is pushed to an staging environment for testing&lt;/li&gt;
  &lt;li&gt;The staging site is tested, and code is reviewed&lt;/li&gt;
  &lt;li&gt;On Approval, the code is merged into a production branch and deployed to production&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Based on the flow above, we can say we have at least three environments:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Local Development&lt;/li&gt;
  &lt;li&gt;Staging&lt;/li&gt;
  &lt;li&gt;Production&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, this is an oversimplified workflow, and as soon you start adding CI systems, UAT servers, etc. things start to get more complicated. For now let’s stick to our three environments.&lt;/p&gt;

&lt;p&gt;Ideally local development and staging should be as close as possible to production as we can, in practice, however, more often than not; there will be big differences.&lt;/p&gt;

&lt;p&gt;For example, a large chunk of your developers might be using a solution like MAMP or WAMP, each with its own set of quirks, will likely not match your staging/production. This is where problems start happening, if you ever heard the dreaded phrase “It works on my local” then you know what I’m talking about.&lt;/p&gt;

&lt;p&gt;In addition keeping staging in parity with production can have a large overhead, especially if you run multiple architectures, or if your sites have different requirements like php-versions or installing something like IonCube.&lt;/p&gt;

&lt;h2 id=&quot;the-solution&quot;&gt;The Solution&lt;/h2&gt;

&lt;p&gt;This is what adding docker to our development pipeline is all about, being able to have a consistent environment for development, staging, qa and production. For now I will only talk about the first step on our development pipeline, local development.&lt;/p&gt;

&lt;p&gt;Running Docker is very much like running virtual machines for local development but with the following advantages:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Faster creation and initialization&lt;/li&gt;
  &lt;li&gt;Lower system footprint&lt;/li&gt;
  &lt;li&gt;Easily shareable between developer and environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To facilitate things, I’ve created a base docker image that runs a simplified version of server stack I run at &lt;strong&gt;Demac Media&lt;/strong&gt; you can find the link at &lt;a href=&quot;https://registry.hub.docker.com/u/amacgregor/base/&quot;&gt;Docker Hub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The image will setup apache2.4, php-fpm and and the 4 major versions of Php (5.3,5.4,5.5,5.6) as well create vhost macros for easy setup. Let’s take a peak:&lt;/p&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;https://asciinema.org/a/17314.js&quot; id=&quot;asciicast-17314&quot; async=&quot;&quot;&gt;&lt;/script&gt;

&lt;p&gt;This image is not really meant to be used directly but rather as a base for your projects. The way I would recommend using it is as follows:&lt;/p&gt;

&lt;p&gt;In your project base create a folder named docker and add the following file:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filename:&lt;/strong&gt; Dockerfile
&lt;script src=&quot;https://gist.github.com/amacgregor/867b858fafe6b9ab1358.js&quot;&gt;&lt;/script&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A Dockerfile is a text document that contains all the commands you would normally execute manually in order to build a Docker image. By calling docker build from your terminal, you can have Docker build your image step by step, executing the instructions successively.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All we are doing above is setting up the vhost for our current project, speaking of which we will need to create said vhost file inside our docker/vhost folder, since we are copying it to our newly created image in the following line&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
COPY config/vhosts/ /etc/apache2/sites-available
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So let’s go ahead and create the file&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filename:&lt;/strong&gt; config/vhosts/localhost.com.conf
&lt;script src=&quot;https://gist.github.com/amacgregor/1112523b865211e79240.js&quot;&gt;&lt;/script&gt;&lt;/p&gt;

&lt;p&gt;Wait, that’s it? Yes, it’s that simple; the example above is using one of the coolest Apache2.4 features, Macros.&lt;/p&gt;

&lt;p&gt;The base image has a macro for each of the php versions and as you can see is the first thing we are telling our vhost file to use&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
Use VHost-PHP5.4
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The values after that are variables to be used by our macro file, in this case:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;$host&lt;/li&gt;
  &lt;li&gt;$ip&lt;/li&gt;
  &lt;li&gt;$port&lt;/li&gt;
  &lt;li&gt;$dir&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And while right now we are not using all of them directly, it opens an interesting set of possibilities. We are now ready to build and run our project docker image, but wait what about the project files, well I’m getting to that actually let’s go ahead and create a simple test file for our example:&lt;/p&gt;

&lt;p&gt;In my case I will create a folder and file example project, in practice we would use our project local repository copy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filename:&lt;/strong&gt; ../demac-docker-example/public/index.php&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
&amp;lt;?php phpinfo(); ?&amp;gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We will also need to create an empty file inside the public folder called &lt;strong&gt;.htaccess-combined&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And now we build our project image:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
docker build -t amacgregor/localhost_com .
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally we can go ahead and run our newly created image using the following command:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/b391628b2f8aea902a2a.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The above might look intimidating at first but let’s break it down:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
-v /home/amacgregor/Projects/DemacMedia/demac-docker-example/public:/srv/www/localhost.com/public_html
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With this option we are telling Docker to mount a directory from the host filesystem (the one that we just created) into the vhost root directory, this way we can reuse our local project files and test changes on the fly.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
-p 127.0.0.1:80:80
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;All we are doing here is exposing the port 80 to our host machine port 80, please note that if you have any software like MAMP or Apache already running this won’t work and you will need to change the host port.&lt;/p&gt;

&lt;p&gt;Finally, we can verify everything is working by loading localhost.com in our browser, if everything worked correctly we should see the PHP information page.&lt;/p&gt;

&lt;h2 id=&quot;feedback&quot;&gt;Feedback&lt;/h2&gt;

&lt;p&gt;This is the first time I ever worked with docker. Feedback and hints on how to improve are more than welcome. And if you find this useful let me know.&lt;/p&gt;
</description>
        <pubDate>Thu, 05 Mar 2015 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/docker/magento/programming/devops/2015/03/05/getting-started-with-magento-and-docker.html</link>
        <guid isPermaLink="true">https://coderoncode.com/docker/magento/programming/devops/2015/03/05/getting-started-with-magento-and-docker.html</guid>
      </item>
    
      <item>
        <title>Design Patterns in PHP: Adapters</title>
        <description>&lt;p&gt;The &lt;strong&gt;adapter pattern&lt;/strong&gt; also referred as the wrapper pattern, I find that wrapper is a more fitting name since it describes clearly what this pattern does; it encapsulates the functionality of a class or object into a class with a common public interfaces.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used for another interface.[1] It is often used to make existing classes work with others without modifying their source code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Adapters are one of the easiest patterns to comprehend and at the same time one of the most useful ones. Strangely enough documentation and examples for this particular pattern seems to be somewhat lacking in the &lt;strong&gt;PHP world&lt;/strong&gt; (at least as far as the research for this article took me) so I’ll try to provide examples that are closer to real world usages.&lt;/p&gt;

&lt;p&gt;But first, we need to go over some basic concepts about this pattern. As with any pattern, the adapter pattern has multiple participants:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Client:&lt;/strong&gt; The client is a class or object that wants to consume the Adaptee public API.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Adapter:&lt;/strong&gt; The adapter provides a common interface between the adaptee and its clients.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Adaptee:&lt;/strong&gt; The adaptee is an object from a different module or library.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another advantage of the adapter pattern is that allows us to &lt;strong&gt;decouple our client code from the adaptee implementations&lt;/strong&gt;. Let’s see what that means in the following example:&lt;/p&gt;

&lt;p&gt;In our example we will work with a notification manager class:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/170d1b99e12bd3b12ca6.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Although the previous example is oversimplified, it illustrates clearly were adapters can be useful, so let’s breakdown the problems with the notificationManager class.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The class knows too much about each notification type implementation.&lt;/li&gt;
  &lt;li&gt;If any of the notification classes change, we have to change our NotificationManager class code.&lt;/li&gt;
  &lt;li&gt;Adding a new notification type requires modifying the NotificationManager class code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regardless of the notification service being used we know that our notification class should do two things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Accept the data from the NotificationManager&lt;/li&gt;
  &lt;li&gt;Send a notification&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How the data is parsed, and the notification send is completely up to the service implementation; so based on that we can start by creating a &lt;strong&gt;NotificationInterface&lt;/strong&gt; class:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/894ee4e24975c537a191.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The notification interface will be implemented by each and one of our notification adapters:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/85108283f3ca51156bdd.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Based on the code above we can now rewrite our NotificationManager class in the following way:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/27e6048d8f969ec59d30.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Doesn’t that look better? As long as the notification services implement the &lt;em&gt;NotificationInterface&lt;/em&gt; the notification manager doesn’t need worry about the specifics of each implementation.&lt;/p&gt;

&lt;p&gt;However, there is still a problem with the &lt;em&gt;NotificationManager&lt;/em&gt; class:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Adding a new notification type requires modifying the NotificationManager class code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fortunately, this can be solve easily if we use the &lt;strong&gt;Dependency Inversion Principle&lt;/strong&gt; and since this is a bit out of the scope of this article, I won’t go into much detail about the specifics of this principle.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In object-oriented programming, the dependency inversion principle refers to a specific form of decoupling software modules.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/0fc56114ea4fba62d9e1.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Thanks to the use of adapters for the notification services, we can decouple of the notificationManager even more.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Adapters are extremely useful when combined with &lt;strong&gt;SOLID design principles&lt;/strong&gt; and help developers to write cleaner and more maintainable code.&lt;/p&gt;
</description>
        <pubDate>Sun, 25 Jan 2015 09:53:16 -0500</pubDate>
        <link>https://coderoncode.com/php/programming/design/patterns/coding/2015/01/25/design-patterns-in-php-adapters.html</link>
        <guid isPermaLink="true">https://coderoncode.com/php/programming/design/patterns/coding/2015/01/25/design-patterns-in-php-adapters.html</guid>
      </item>
    
      <item>
        <title>WTF are: Service Contracts (Magento 2 Edition)</title>
        <description>&lt;p&gt;Now that Magento2 beta has been officially released, you are probably wondering
what the hell are &lt;strong&gt;Service Contracts&lt;/strong&gt; and more importantly why the hell do you
need them.&lt;/p&gt;

&lt;p&gt;But before we jump into the nitty-gritty of service contracts let’s get this out
of the way:&lt;/p&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;img style=&quot;display:inline-block&quot; src=&quot;http://i.imgur.com/m7oagqw.jpg&quot; width=&quot;100%&quot; alt=&quot;Magento Service Contracts
is people&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Yes, Service contracts are nothing more than a set of interfaces used to define
the public api of a module.&lt;/p&gt;

&lt;p&gt;Now, is important to clarify that by API we are talking about the set of
interfaces that a module provides to other modules to access their
implementations.&lt;/p&gt;

&lt;h1 id=&quot;service-contract-architecture&quot;&gt;Service Contract Architecture&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;In Magento the service layer provides a formal contract between a client and
the service provider. This form of contact allows evolution of a service
implementation without affecting the client.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Service layer allows modules to provide a well-defined public API and
effectively hiding the business logic and preserving data integrity.&lt;/p&gt;

&lt;p&gt;Magento 2 service layer is comprised of two types of interfaces, Data Interfaces
and Service Interfaces. Data Interfaces are immutable data objects that allow to
preserve data integrity by implementing the following patterns:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;They define only constants and/or getters, meaning they are read-only.&lt;/li&gt;
  &lt;li&gt;Getter functions &lt;strong&gt;must&lt;/strong&gt; have no parameters.&lt;/li&gt;
  &lt;li&gt;A getter function &lt;strong&gt;must&lt;/strong&gt; only return one of the following objects types:
    &lt;ul&gt;
      &lt;li&gt;A simple type (integer, string, boolean)&lt;/li&gt;
      &lt;li&gt;An Array of a simple type&lt;/li&gt;
      &lt;li&gt;Another Data interface&lt;/li&gt;
      &lt;li&gt;Getter functions cannot return mixed types.&lt;/li&gt;
      &lt;li&gt;Data interfaces can only be populated or modified by using data entity builders.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Service Interfaces, on the other hand, are in charge of providing a
stable set of public methods that can be used with by the clients
regardless of the kind (controller, the web service, other Magento
modules)&lt;/p&gt;

&lt;p&gt;Service interfaces differ a bit from their Data counter parts; we have
three subtypes of service interfaces:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Repository Interfaces&lt;/li&gt;
  &lt;li&gt;Management Interfaces&lt;/li&gt;
  &lt;li&gt;Metadata Interfaces&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;repository-interfaces&quot;&gt;Repository Interfaces&lt;/h3&gt;

&lt;p&gt;Repository interfaces are used to provide access to the persistent data
entities, all this means is that they provide a specific set of methods interact
with the data objects.&lt;/p&gt;

&lt;p&gt;Repositories abstract the way data is mapped out to an object, this way the data
storage(database) could be anything, and could change without affecting the
clients (other modules).&lt;/p&gt;

&lt;p&gt;Repository interfaces should implement the following methods:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;save&lt;/li&gt;
  &lt;li&gt;get&lt;/li&gt;
  &lt;li&gt;getList&lt;/li&gt;
  &lt;li&gt;delete&lt;/li&gt;
  &lt;li&gt;deleteById&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each data entity, we have a corresponding data interface. But, if that
wasn’t
clear enough, let’s go ahead and see a couple of examples of how Magento2 makes
use of Repository interfaces.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/dec3eab91cc7858189dc.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Ok, so that the interface definition but how is used? Let’s take a
look at another class from the customer module.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/ca2a9a1f93e062998b31.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;For now let’s not worry about how the customerRepository object is instantiated
(we will deal with that later on another post about the objectManager)
but how is being used, in particular we want to look at the
following function:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/497d247b9d34b47e487a.js&quot;&gt;&lt;/script&gt;

&lt;h3 id=&quot;why-is-it-great&quot;&gt;Why is it Great?&lt;/h3&gt;

&lt;p&gt;With Magento 2 use of the repository pattern, we could add a new customer
extension, that changes the model and the resource model, to let’s, say save
customer date into a MongoDB and as long that new customer model implements the
necessary service interfaces we can be certain that we are not breaking the res
of the application.&lt;/p&gt;

&lt;p&gt;I will cover the rest of the interface types once the Magento2 documentation is
updated and there are more details on their specific responsibilities.&lt;/p&gt;
</description>
        <pubDate>Mon, 12 Jan 2015 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/magento2/magento/design/patterns/programming/php/2015/01/12/wtf-are-service-contracts.html</link>
        <guid isPermaLink="true">https://coderoncode.com/magento2/magento/design/patterns/programming/php/2015/01/12/wtf-are-service-contracts.html</guid>
      </item>
    
      <item>
        <title>Watch: We Strongly Recommend You Write Best Practices</title>
        <description>&lt;p&gt;What to watch this week, &lt;strong&gt;Lauren Rother&lt;/strong&gt; from &lt;a href=&quot;http://puppetlabs.com/&quot;&gt;PuppetLabs&lt;/a&gt; give us their best practices to write best practices. A great set of recommendations for
writing and mantaining your best practice documentation.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Writing best practices documentation is definitely an art, but that doesn’t mean a little science can’t help us along. Through some trial and
error, I’ve uncovered some tenets of writing engaging, readable best practices docs. I’ll walk through a bit of my path to discovery as I highlight
and give examples of successful and (enthusiastic) reader-approved best practices documents.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;style&gt;.bt-video-container iframe,.bt-video-container object,.bt-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;margin-top:0}&lt;/style&gt;

&lt;div class=&quot;bt-video-container&quot; style=&quot;position:relative;padding-bottom:75.00%;padding-top:30px;height:0;overflow:hidden&quot;&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/tKssFJJw6h0?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;

</description>
        <pubDate>Wed, 01 Oct 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2014/10/01/watch-write-best-practices.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2014/10/01/watch-write-best-practices.html</guid>
      </item>
    
      <item>
        <title>The Async Software Development Manifesto Revised</title>
        <description>&lt;p&gt;The &lt;a href=&quot;http://asyncmanifesto.org/&quot;&gt;‘Async Software Development Manifesto’&lt;/a&gt; has been making the rounds on sites like HackerNews and /r/programming; and while I don’t agree entirely with all that is proposed, some of the points made by the author made so much sense that I felt motivated to break them down and make some contributions of my own.&lt;/p&gt;

&lt;h2 id=&quot;async-software-development-manifesto&quot;&gt;Async Software Development Manifesto&lt;/h2&gt;

&lt;p&gt;The manifesto appears to be inspired by the &lt;a href=&quot;http://agilemanifesto.org/&quot;&gt;‘Agile Manifesto’&lt;/a&gt; and it advocates for a different approach and tools, in direct opposition with the Agile methodology. The following principles are emphasized:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Use Modern tools&lt;/li&gt;
  &lt;li&gt;Meetings only as a last resort&lt;/li&gt;
  &lt;li&gt;Flexible work environments&lt;/li&gt;
  &lt;li&gt;Document everything&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, even as principles some of those are very generic and to be honest quite vague; so in order to understand what the author meant by each of those principles we need to break them down further:&lt;/p&gt;

&lt;h3 id=&quot;use-modern-tools&quot;&gt;Use Modern tools&lt;/h3&gt;

&lt;p&gt;On this point the &lt;strong&gt;Async Software Development Manifesto&lt;/strong&gt;, which from now I will refer as the &lt;strong&gt;ASDM&lt;/strong&gt; (since I’m getting tired of typing the whole thing) advocates for the use of modern tools like Bitbucket, Github, or Gitlab. The reasoning behind this is that those tools posses the following qualities:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Each deeply integrates version control with issue tracking.&lt;/li&gt;
  &lt;li&gt;Each offers rich prioritizing and assignment features.&lt;/li&gt;
  &lt;li&gt;Each wraps all that up into a slick user experience that anyone on the team can use, including nontechnical people.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The point that seems to be made is the importance of having tools that integrate with work-flow and reduce the friction for the developers and everyone involved. In that sense tools like Bitbucket or Github certainly are effective at integrating and issue tracking system, and a version control system all tied together by a common interface that technical and non-technical people can share.&lt;/p&gt;

&lt;p&gt;However, the argument needs to be made against using a single tool like these; not every company follows the same work-flow and not all the clients are willing to learn how to use issue tracking systems like the ones mentioned before.&lt;/p&gt;

&lt;p&gt;In some cases letting clients directly raise issues, without any kind of filter can be contra-productive and generate unnecessary work for everyone involved.&lt;/p&gt;

&lt;p&gt;The second point that I want to make is the use of the word modern, old or new, trendy or not; those should not be a factor when selecting tools and methodologies to use for your team and work-flow.&lt;/p&gt;

&lt;p&gt;Modern also implies that any tools that have been lying around for a few years are obsolete and to be avoided, but that is hardly the case some popular tools like VIM have been around for a few decades and it’s not showing signs of going away any time soon.&lt;/p&gt;

&lt;p&gt;So in this case, I think the principle should be revised to:&lt;/p&gt;

&lt;div style=&quot;font-size:60px; text-align:center&quot;&gt;Use tools that work for you&lt;/div&gt;

&lt;h3 id=&quot;meetings-only-as-a-last-resort&quot;&gt;Meetings only as a last resort&lt;/h3&gt;

&lt;p&gt;According to the ASDM &lt;strong&gt;“meetings are very costly to your business”&lt;/strong&gt; due the time that they take away from developers and the cost of constant interruptions, several articles like &lt;a href=&quot;http://blog.ninlabs.com/2013/01/programmer-interrupted/&quot;&gt;programmer interrupted&lt;/a&gt;, &lt;a href=&quot;http://heeris.id.au/2013/this-is-why-you-shouldnt-interrupt-a-programmer&quot;&gt;why you shouldn’t interrupt developers&lt;/a&gt; and &lt;a href=&quot;http://www.infoq.com/news/2013/01/Interruptions&quot;&gt;the high cost of interruptions&lt;/a&gt; deal with the same concept; there is a cost that hidden when interrupting developers; so I agree with this part of the principle.&lt;/p&gt;

&lt;p&gt;However, meetings specially the quick kind like daily stand-ups still have place, meetings shouldn’t be the last resort however meetings must be use smartly:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Interruptions should be minimized.&lt;/li&gt;
  &lt;li&gt;Meetings should be meaninful and to the point.&lt;/li&gt;
  &lt;li&gt;People should be hold longer than needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example at &lt;a href=&quot;http://www.demacmedia.com/&quot;&gt;Demac Media&lt;/a&gt; we apply this principle by doing morning stand-ups, but only on Mondays, Wednesdays and Fridays; meetings are also kept sort usually under 15min and developers are not hold longer as soon as they are done they can leave the meeting.&lt;/p&gt;

&lt;p&gt;The main point is to provide a quick checkpoint for the team, make sure everyone is on track, and giving an opportunity for jr developers to raise any issues or problems they might be thus avoiding miscommunication. There is value to be found on effective meetings, when meetings have a clear purpose they can actually minimize and prevent problems.&lt;/p&gt;

&lt;p&gt;There is however a valuable point to be made about constant interruptions and their attached cost, I have found that the following measures are effective to minimize interruptions while still following the concept of &lt;strong&gt;Async Software Development&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Instead of walking over to another developer to ask a ‘5min’ question, write an email. Writing an email forces you to think about the problem and what you have done to try solving it. This is basically ‘Async Rubber Ducking’ chances are that the asking developer already knows the answer to the problem, but is needs to change the way he is looking/thinking about the problem.&lt;/li&gt;
  &lt;li&gt;Define core hours, during core hours you should avoid interruptions (meetings, walking over, etc) the core hours should be a large chunk of interrupted time during the day. Define core hours will help developers to have a guaranteed and predefined period of time, that they can use to get complicated tasks done.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So in this case, I think the principle should be revised to:&lt;/p&gt;

&lt;div style=&quot;font-size:60px; text-align:center&quot;&gt;Use meetings wisely&lt;/div&gt;

&lt;h3 id=&quot;flexible-work-environments&quot;&gt;Flexible work environments&lt;/h3&gt;

&lt;p&gt;Here the original ASDM goes into a few points of what does it mean to have a flexible work environment:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Adopt a hotelling policy at your office.&lt;/li&gt;
  &lt;li&gt;Don’t assign desks to anyone by default.&lt;/li&gt;
  &lt;li&gt;Anyone who requests an assigned desk should get to choose whether it’s a private office or in a communal space.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And while I wholeheartedly agree with all those points, I think we have to be careful of how much flexibility is allowed. Some developers will completely isolate themselves if allowed to; and writing code in isolation is never a good thing.&lt;/p&gt;

&lt;div style=&quot;font-size:60px; text-align:center&quot;&gt;Be flexible with your process&lt;/div&gt;

&lt;p&gt;Be mindful about any process or policy, if the process gets in the way of actually getting work done then the process needs to change.&lt;/p&gt;

&lt;h3 id=&quot;document-everything&quot;&gt;Document everything&lt;/h3&gt;

&lt;p&gt;The original manifesto doesn’t go into much detail on this last point:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The better documented your work-flow, the less your workers will need to interrupt each other to seek out tribal knowledge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And I must say I don’t disagree, having proper documentation is always positive, however is how you generate and maintain this documentation what can cause problems.&lt;/p&gt;

&lt;p&gt;It all comes down to making the documentation process unobtrusive and frictionless, this will help the developers to feel more comfortable while writing documentation and it won’t interrupt their work-flow, that been said there is no better documentation than well written code.&lt;/p&gt;
</description>
        <pubDate>Mon, 29 Sep 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/productivity/programming/development/2014/09/29/async-office.html</link>
        <guid isPermaLink="true">https://coderoncode.com/productivity/programming/development/2014/09/29/async-office.html</guid>
      </item>
    
      <item>
        <title>Watch: Funny Tech Support</title>
        <description>&lt;p&gt;What to watch this week,  Let’s have a laugh watching &lt;strong&gt;Wes Borg&lt;/strong&gt; and his fanstatic routine on the perils of tech support.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;This Is Why I never got into Tech Support.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;style&gt;.bt-video-container iframe,.bt-video-container object,.bt-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;margin-top:0}&lt;/style&gt;

&lt;div class=&quot;bt-video-container&quot; style=&quot;position:relative;padding-bottom:75.00%;padding-top:30px;height:0;overflow:hidden&quot;&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/Wp-uKlhXvmo?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
</description>
        <pubDate>Wed, 24 Sep 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2014/09/24/watch-funny-tech-support.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2014/09/24/watch-funny-tech-support.html</guid>
      </item>
    
      <item>
        <title>Watch: The Myth of the Genius Programmer</title>
        <description>&lt;p&gt;What to watch this week, In this week video &lt;strong&gt;Brian Fitzpatrick&lt;/strong&gt; and &lt;strong&gt;Ben Collins-sussman&lt;/strong&gt; talk about the pervasive myth of the uber-programmer the
know it all genius; why everyone secretly wants to be considerad a genius and how this can affect the collaboration and behavior.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A pervasive elitism hovers in the background of collaborative software development: everyone secretly wants to be seen as a genius. In this talk,
we discuss how to avoid this trap and gracefully exchange personal ego for personal growth and super-charged collaboration. We’ll also examine how
software tools affect social behaviors, and how to successfully manage the growth of new ideas.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;style&gt;.bt-video-container iframe,.bt-video-container object,.bt-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;margin-top:0}&lt;/style&gt;

&lt;div class=&quot;bt-video-container&quot; style=&quot;position:relative;padding-bottom:75.00%;padding-top:30px;height:0;overflow:hidden&quot;&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/0SARbwvhupQ?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
</description>
        <pubDate>Wed, 17 Sep 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2014/09/17/watch-genius-programmer.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2014/09/17/watch-genius-programmer.html</guid>
      </item>
    
      <item>
        <title>Watch: What is Docker?</title>
        <description>&lt;p&gt;What to watch this week, &lt;strong&gt;Solomon Hykes&lt;/strong&gt; explains the docker platform and how it can help developers to build and deploy apps more easily. Great for
those that want to understand more about the docker platform.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;style&gt;.bt-video-container iframe,.bt-video-container object,.bt-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;margin-top:0}&lt;/style&gt;

&lt;div class=&quot;bt-video-container&quot; style=&quot;position:relative;padding-bottom:75.00%;padding-top:30px;height:0;overflow:hidden&quot;&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/ZzQfxoMFH0U?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
</description>
        <pubDate>Wed, 10 Sep 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2014/09/10/what-is-docker.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2014/09/10/what-is-docker.html</guid>
      </item>
    
      <item>
        <title>Watch: Magento Fireside Chats on Testing</title>
        <description>&lt;p&gt;What to watch this week, the &lt;strong&gt;Magento Fireside Chats&lt;/strong&gt; on testing. On this series of hangouts Magento developers come together to discuss their
different approaches to testing, covering a variety of tools like &lt;strong&gt;Selenium, PHPUnit, PHPSpec, Menta&lt;/strong&gt; and more.&lt;/p&gt;

&lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;//www.youtube-nocookie.com/embed/videoseries?list=PLTmla7LfXY9EmhsA9P955giIvlFzCetjb&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;episode-list&quot;&gt;Episode List&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Episode 1:&lt;/strong&gt; In this episode &lt;a href=&quot;https://twitter.com/VinaiKopp&quot;&gt;Vinai Kopp&lt;/a&gt; will show how to mock objects in your test cases and &lt;a href=&quot;https://twitter.com/fbrnc&quot;&gt;Fabrizio Branca&lt;/a&gt; will give an introduction into
Selenium testing with Menta.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episode 2:&lt;/strong&gt; In this episode &lt;a href=&quot;https://twitter.com/allanmacgregor&quot;&gt;Allan MacGregor&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/jcowie&quot;&gt;James Cowie&lt;/a&gt; will tell us about MageTest suite, BehatMage and MageSpec.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episode 3:&lt;/strong&gt; In this episode &lt;a href=&quot;https://twitter.com/max_pronko&quot;&gt;Max Pronko&lt;/a&gt; will talk about the Magento Testing Framework (MTF) and &lt;a href=&quot;https://twitter.com/LeeSaferite&quot;&gt;Lee Saferite&lt;/a&gt;  will show us how to write unit tests
with fixtures using EcomDev_Phpunit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episode 4:&lt;/strong&gt; In this episode &lt;a href=&quot;ihttps://twitter.com/d_rbn&quot;&gt;David Robinson&lt;/a&gt; will show us how to work with the advanced screenshot features of the Menta Selenium Testing Framework
and &lt;a href=&quot;https://twitter.com/b_ike&quot;&gt;Bastian Ike&lt;/a&gt; how to use Jenkins’ multi-configuration job to test Magento modules with multiple Magento versions.&lt;/p&gt;
</description>
        <pubDate>Mon, 08 Sep 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2014/09/08/magento-fireside-chats-testing.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2014/09/08/magento-fireside-chats-testing.html</guid>
      </item>
    
      <item>
        <title>Watch: How to Build a Framework</title>
        <description>&lt;p&gt;What to watch this week, an amazing talk by &lt;a href=&quot;http://maxlynch.com/&quot;&gt;Max Lynch&lt;/a&gt; from &lt;strong&gt;Ionic&lt;/strong&gt;, where we recalls his experiences while creating the &lt;a href=&quot;http://ionicframework.com/&quot;&gt;Ionic framework&lt;/a&gt;. Great Insights
for anyone looking to start an open source project regardless if is a framework or not.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Max Lynch presents at the 2014 Midwest Mobile Summit on how to build a successful open source framework.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;style&gt;.bt-video-container iframe,.bt-video-container object,.bt-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;margin-top:0}&lt;/style&gt;

&lt;div class=&quot;bt-video-container&quot; style=&quot;position:relative;padding-bottom:75.00%;padding-top:30px;height:0;overflow:hidden&quot;&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/Wnb50RafHVA?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
</description>
        <pubDate>Sun, 07 Sep 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2014/09/07/video-how-to-build-a-framework.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2014/09/07/video-how-to-build-a-framework.html</guid>
      </item>
    
      <item>
        <title>Exploring Hack: Building a MicroFramework</title>
        <description>&lt;p&gt;As a full-time &lt;strong&gt;Magento Developer&lt;/strong&gt; I deal with a very specific kind of &lt;strong&gt;PHP&lt;/strong&gt; every single day; this can at time get rather boring since rarely one can apply
new technologies or programming concepts. One of the new languages that keeps grabbing my attention is &lt;strong&gt;HACK&lt;/strong&gt;, which is almost identical to &lt;strong&gt;PHP&lt;/strong&gt; in
terms of syntax but at the same time implements some of the more attractive features from statically typed languages.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Hack&lt;/strong&gt; is a language for HHVM that interopates seamlessly with &lt;strong&gt;PHP&lt;/strong&gt;. The barrier to entry for Hack is low. To get started, all that is needed is to
generally understand the features that &lt;strong&gt;Hack&lt;/strong&gt; provides and how to call the Hack type checker (hh_client invokes the type checker at the command line)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have covered &lt;strong&gt;Hack&lt;/strong&gt; previously on the following articles:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.coderoncode.com/2014/03/23/hello-hack.html&quot;&gt;Hello Hack&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.coderoncode.com/2014/04/08/hhvm-hack-new-php.html&quot;&gt;Is HHVM/Hack the new face of PHP?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;learn-by-doing&quot;&gt;Learn by Doing&lt;/h2&gt;

&lt;p&gt;I honestly believe the best way to learn something is to get your hands dirty and make mistakes; so instead of writing dozens of post on
the many new features of &lt;strong&gt;Hack&lt;/strong&gt; and why they are awesome (in theory) let’s build something useful.&lt;/p&gt;

&lt;p&gt;So to get started I’ve decided to build a micro-framework using &lt;strong&gt;HACK&lt;/strong&gt; and &lt;strong&gt;HHVM&lt;/strong&gt;, building a simple microframework should be a challenging enough task
to illustrate some of the more interesting features of the language and at the same time it has an achievable goal so we don’t end on a never ending
development cycle.&lt;/p&gt;

&lt;p&gt;Let’s call our new framework something clever:&lt;/p&gt;

&lt;h2 id=&quot;meet-slash&quot;&gt;Meet Slash&lt;/h2&gt;

&lt;p&gt;Get it? &lt;strong&gt;Hack&lt;/strong&gt;, Slash (it’s a clever name, shut up). Before we start writing any code let’s think a little about what kind of micro-framework we want
to build. There are many amazing &lt;strong&gt;PHP&lt;/strong&gt; micro-frameworks out there, just to mention a few:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.slimframework.com/&quot;&gt;Slim&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://silex.sensiolabs.org/&quot;&gt;Silex&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://phalconphp.com/&quot;&gt;Phalcon&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://bulletphp.com/&quot;&gt;BulletPHP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.recessframework.org/&quot;&gt;Recess&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://limonade-php.github.io/&quot;&gt;Limonade&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Outside of the &lt;strong&gt;PHP&lt;/strong&gt; world, there is &lt;strong&gt;Sinatra&lt;/strong&gt; which is Ruby based and excellent example of a powerful micro-framework. Curiously enough Sinatra seems to
be the source of inspiraton for many of these frameworks; so let’s not break tradition and use Sinatra as our main source of inspiration.&lt;/p&gt;

&lt;p&gt;That means that Slash main purpose will to create &lt;strong&gt;RESTful applications&lt;/strong&gt;, and as such the main component for a framework like this will be its router.&lt;/p&gt;

&lt;p&gt;In the next post of this series we will go through the creating of the routing and the general structure of new microframework.&lt;/p&gt;
</description>
        <pubDate>Wed, 06 Aug 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/hack/hhvm/programming/hacklang/coding/2014/08/06/exploring-hack-part1.html</link>
        <guid isPermaLink="true">https://coderoncode.com/hack/hhvm/programming/hacklang/coding/2014/08/06/exploring-hack-part1.html</guid>
      </item>
    
      <item>
        <title>Swiss Army Knife Syndrome</title>
        <description>&lt;!--
  We need more chef knives and less swiss army knifes
  Good software is like a chef&#39;s knife sharp and with purpose
--&gt;

&lt;p&gt;I apologize beforehand if this article is more of a &lt;strong&gt;rant&lt;/strong&gt; than usual. The inspiration for the &lt;strong&gt;“Swiss Army Knife Syndrome”&lt;/strong&gt; came from my frustration in dealing with project managers, clients, and even other developers, that think in too much of a narrow, particular way. I call it the “Swiss Army Knife Syndrome”.&lt;/p&gt;

&lt;h2 id=&quot;the-swiss-army-knife&quot;&gt;The Swiss Army Knife&lt;/h2&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;img style=&quot;display:inline-block&quot; src=&quot;http://digital.hammacher.com/Items/74670/74670_1000x1000.jpg&quot; width=&quot;500&quot; alt=&quot;Largest swiss army knife in the world&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The term ‘Swiss Army Knife’ is often used to describe a collection of useful items or tools that are able to perform well in multiple scenarios.&lt;/p&gt;

&lt;p&gt;While this may be useful, there are &lt;strong&gt;risks to be aware&lt;/strong&gt; of as well. A tool with too many moving parts can end up being completely useless! By trying to do everything, said tool might be great at nothing.&lt;/p&gt;

&lt;p&gt;In my experience, the same problem can apply to software. More often than not, developers try to include a feature or piece of code just &lt;strong&gt;because it is “cool”&lt;/strong&gt;; project managers will try to modify the scope in the middle of a project because “X” or “Y” feature will add more value; customers will request extra features or functionality because they read or heard they were “critical” to their business.&lt;/p&gt;

&lt;p&gt;This ‘Swiss Army Knife Syndrome’ can take many shapes: &lt;strong&gt;scope creep, early optimization, and so on&lt;/strong&gt;. But the root of the problem is how we perceive and value software, work, and the value attached to it:&lt;/p&gt;

&lt;div style=&quot;font-size:60px; text-align:center&quot;&gt;More Features&lt;br /&gt;=&lt;br /&gt; More Value&lt;/div&gt;

&lt;p&gt;In reality, and for most cases, &lt;strong&gt;the opposite is true&lt;/strong&gt;. The more complex a piece of code or software gets, the less value it provides. A personal example that illustrates this concept was a simple, pivotal dashboard for Demac Media internal use.&lt;/p&gt;

&lt;p&gt;The original application was simple: we needed a way of (1) seeing all the tasks assigned to a particular team and (2) to filter them by the current week or two week sprint-basically, a task aggregator with basic filtering.&lt;/p&gt;

&lt;p&gt;I coded the simple concept over the course of one weekend. Upon showing this to my team’s project manager the following Monday, he deemed the application useful.&lt;/p&gt;

&lt;div style=&quot;font-size:50px; text-align:left&quot;&gt;
 ... but it would be so much better if ...
&lt;/div&gt;

&lt;p&gt;And that’s how &lt;strong&gt;Swiss Army Knife Syndrome&lt;/strong&gt; begins: with a ‘but’. The tool was shared with other teams. Before they even started using it, we had a list of half a dozen features that were ‘needed’ or would add more value to the application. Suddenly, we had a number of requests well beyond the initial scope of the application.&lt;/p&gt;

&lt;h2 id=&quot;clear-purpose&quot;&gt;Clear Purpose&lt;/h2&gt;

&lt;!-- INSERT A CHEF&#39;S KNIFE IMAGE --&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;img style=&quot;display:inline-block&quot; src=&quot;http://www.euro-knife.com/sub/euro-noze.sk/images/shop-active-images/kuchynske-noze-victorinox-kucharsky-noz-7.7403.20..jpg&quot; width=&quot;750&quot; alt=&quot;Largest swiss army knife in the world&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software needs to be as clean and as simple as it can practically be.&lt;/strong&gt; To follow the knife analogy, good code should be like a chef’s knife. A chef’s knife has a clear and defined set of uses. A professional chef will use the right kind of knife for the job. This is how we should think about our code.&lt;/p&gt;

&lt;div style=&quot;font-size:60px; text-align:center&quot;&gt;
Do one job and do it well.
&lt;/div&gt;

&lt;p&gt;We find the same principle in software design, often referred as the Single Responsibility principle:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;…The single responsibility principle states that every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;No company, project manager, developer, or client is exempt from falling for this faulty logic. We are inclined to think that having and doing more is equivalent to being better or having more value. &lt;strong&gt;Software should be elegant, and elegant code is where simplicity meets a good solution.&lt;/strong&gt; Therefore, it is our responsibility as developers to ensure that every bit of code we produce is as elegant and succinct as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Special Thanks to:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mark Holmes - &lt;a href=&quot;http://markholmes.io/&quot;&gt;markholmes.io&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 20 May 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/programming/coding/software-development/productivity/2014/05/20/swiss-knife-syndrome.html</link>
        <guid isPermaLink="true">https://coderoncode.com/programming/coding/software-development/productivity/2014/05/20/swiss-knife-syndrome.html</guid>
      </item>
    
      <item>
        <title>Flexible PHP Development with PHPFarm</title>
        <description>&lt;p&gt;If you have been working with &lt;strong&gt;PHP&lt;/strong&gt; for a while, chances are that you have come across with a project, extension or script that requires to be tested on multiple &lt;strong&gt;PHP&lt;/strong&gt; versions, for simple CLI scripts this seems easy enough but what happens when you are working with complex applications, developing for frameworks or multiple versions of them ?&lt;/p&gt;

&lt;p&gt;Let’s say that like me, a &lt;strong&gt;Magento developer&lt;/strong&gt; that regularly develops extensions, there is a need to run on multiple versions of &lt;strong&gt;Magento&lt;/strong&gt;. The initial approach that most developers take is to create a virtual machine with the right environment. For an application like Magento that means you need two virtual machines one for PHP5.2 and one for &lt;strong&gt;PHP5.3&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Or at least that used to be the case because &lt;strong&gt;PHP5.3&lt;/strong&gt; is officially being deprecated, now we have to include PHP5.4 into the mix; with out current setup that means creating another virtual machine setting up all our sites again, deploying our changes to each of the virtual machines.&lt;/p&gt;

&lt;div class=&quot;notice&quot;&gt;
&lt;strong&gt;Note:&lt;/strong&gt; There are possible workarounds to avoid deploying multiple versions of the code across all servers and sharing the code across all virtual machines but that is outside the scope of this article.
&lt;/div&gt;

&lt;p&gt;This setup can quickly become cumbersome and it is not easily scalable: what happens if we want to test individual patch version or test code on all 3 versions, or add PHP5.5 depending of the host machine you use, it might not be able to run more than virtual machine at the same time.&lt;/p&gt;

&lt;p&gt;I ran into all these problems while working at &lt;a href=&quot;http://www.demacmedia.com/?utm_source=coderoncode.com&quot;&gt;Demac Media&lt;/a&gt; where I constantly need to work on multiple environments and specially when testing extensions for commercial distribution. In order to work more efficiently I came up with the following setup than can be ran locally or on a single &lt;strong&gt;Virtual Machine&lt;/strong&gt; if you are on windows.&lt;/p&gt;

&lt;h2 id=&quot;meet-phpfarm&quot;&gt;Meet PHPFarm&lt;/h2&gt;

&lt;p&gt;Getting multiple &lt;strong&gt;PHP&lt;/strong&gt; versions running side by side can be challenging and over the year devs have released multiple solutions like &lt;a href=&quot;https://github.com/phpenv/phpenv&quot;&gt;PHPEnv&lt;/a&gt; or the new &lt;a href=&quot;http://virtphp.org/&quot;&gt;VirtPHP&lt;/a&gt;, personally I use &lt;strong&gt;PHPFarm&lt;/strong&gt; which works very well with my workflow and is extremely easy to use, as well working seamlessly with Apache.&lt;/p&gt;

&lt;!-- Brief history about PHPfarm --&gt;

&lt;p&gt;The basic idea behind &lt;strong&gt;PHPFarm&lt;/strong&gt; is that we can install several version of PHP side by side, in addition we can select one as current or reference specific version directly. Another extremely nice feature about &lt;strong&gt;PHPFarm&lt;/strong&gt; is that we can run patch versions side by side.&lt;/p&gt;

&lt;h2 id=&quot;installation-and-configuration&quot;&gt;Installation and Configuration&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ cd /opt/
$ git clone https://github.com/cweiske/phpfarm.git phpfarm
$ cd phpfarm/src/
&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;notice&quot;&gt;
&lt;strong&gt;Note:&lt;/strong&gt; In order for PHPFarm to work properly you should add the _/opt/phpfarm/inst/bin_ and _/opt/phpfarm/inst/current-bin_ directories to your path, the method for changing this will vary depending on your current OS.
&lt;/div&gt;

&lt;p&gt;So at this point we have everything that we need to install any PHP version, so let’s go ahead and install &lt;strong&gt;PHP5.3.0&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ cd /opt/phpfarm/src/
$ ./compile 5.3.1
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At this point &lt;strong&gt;PHPFarm&lt;/strong&gt; will take care of downloading the source files for the specified version and compiling for our system, while compiling from source might be a little slower than using the distribution binaries, we have much more flexibility over the configuration and options if the installed &lt;strong&gt;PHP&lt;/strong&gt; version.&lt;/p&gt;

&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;/h3&gt;

&lt;p&gt;As I mentioned before we can control each individual version compilation options and default &lt;em&gt;&lt;strong&gt;php.ini&lt;/strong&gt;&lt;/em&gt; settings; both are controller by configuration files inside the &lt;strong&gt;src/&lt;/strong&gt; directory.&lt;/p&gt;

&lt;p&gt;The default configuration options are in src/options.sh. And we can create version specific option files like:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
custom-options.sh
custom-options-5.sh
custom-options-5.3.sh
custom-options-5.3.1.sh
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This structure give us very granular control over the PHP options, and this one the nicest features PHPFarm has to offer. Like wise we can do the same with the php.ini values:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
custom-php.ini
custom-php-5.ini
custom-php-5.3.ini
custom-php-5.3.1.ini
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;An example options and ini file might look something like the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/11041627.js&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/11041706.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;installing-multiple-versions-of-php&quot;&gt;Installing Multiple Versions of PHP&lt;/h2&gt;

&lt;p&gt;Previously, we installed one of the older versions of &lt;strong&gt;PHP5.3&lt;/strong&gt; but in order the get the hang of working with multiple versions of php, let’s go ahead and install the latest versions of  &lt;strong&gt;PHP5.4&lt;/strong&gt; and &lt;strong&gt;PHP5.5&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ cd /opt/phpfarm/src/
$ ./compile.sh 5.4.27
$ ./compile.sh 5.5.11
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In order to confirm that everything was installed correctly let’s verify each of the php versions we installed works:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ /opt/phpfarm/inst/php-5.3.1/bin/php -v
$ /opt/phpfarm/inst/php-5.4.27/bin/php -v
$ /opt/phpfarm/inst/php-5.5.11/bin/php -v
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running each one of those commands you should see each version’s full information, but is highly inconvenient if we have to type the full path to each of the php versions, right ? Well no worries PHPFarm actually has our back on this one, PHPFarm comes included with a command called with &lt;em&gt;&lt;strong&gt;switch-phpfarm&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Let’s try it out:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ switch-phpfarm 5.4.27
&lt;/code&gt;
After running that we can go ahead and try to get php information by doing the following:&lt;/p&gt;

&lt;p&gt;````
$ php -v
PHP 5.4.27 (cli) (built: Apr 18 2014 10:41:43) (DEBUG)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies&lt;/p&gt;

&lt;p&gt;````&lt;/p&gt;

&lt;p&gt;It’s as simple as that, &lt;strong&gt;switch-phpfarm&lt;/strong&gt; takes care of creating the necessary symlinks need to run php; switching back to &lt;strong&gt;PHP5.3&lt;/strong&gt; is as simple as too:&lt;/p&gt;

&lt;p&gt;````
$ switch-phpfarm 5.3.1
$ php -v
PHP 5.3.1 (cli) (built: Feb  9 2014 16:11:15) (DEBUG)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies&lt;/p&gt;

&lt;p&gt;````&lt;/p&gt;

&lt;h2 id=&quot;adding-apache-to-the-mix&quot;&gt;Adding Apache to the Mix&lt;/h2&gt;

&lt;p&gt;So we have multiple &lt;strong&gt;PHP&lt;/strong&gt; versions running side by side and we can execute code by calling the php version directly or by changing the current version, however this is not very useful, real world &lt;strong&gt;PHP&lt;/strong&gt; development goes well beyond single scripts executed through the shell. We need to be able to execute and test complex applications, and for that, we need a web server.&lt;/p&gt;

&lt;p&gt;Personally, I like to use &lt;strong&gt;mod_proxy_fcgi&lt;/strong&gt; and &lt;strong&gt;PHP-FPM&lt;/strong&gt; on my development and production stacks, however &lt;strong&gt;mod_proxy_fcgi&lt;/strong&gt; is only available on Apache2.4 which unfortunately is not an option for some developers out there, but no need to worry we can still setup older versions of Apache to run specific versions of PHP per VirtualHost.&lt;/p&gt;

&lt;div class=&quot;notice&quot;&gt;
&lt;strong&gt;Note:&lt;/strong&gt; I would still highly recommend using Apache2.4 and mod_proxy_fcgi, the module provides a lot of flexibility and allows you to segment parts of your applications, for example, running the backend and frontend of Magento using different PHP-FPM pools or even one running HHVM
&lt;/div&gt;

&lt;p&gt;For this article’s example purposes we will use &lt;strong&gt;mod_fastcgi&lt;/strong&gt; in order to run different version of PHP per VirtualHost. The first thing we need to do is make sure that mod_fastcgi is installed and running; in Ubuntu this can easily be done by running:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ a2enmod fastcgi actions suexec
$ service apache2 restart
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next we need to tell &lt;strong&gt;Apache&lt;/strong&gt; where it can find the configuration for the multiple &lt;strong&gt;fastcgi&lt;/strong&gt; servers, open the apache configuration file located in &lt;em&gt;/etc/apache2/apache2.conf&lt;/em&gt; and add the following lines at the end of it:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
# Include FastCGI configuration for PHPFarm
IncludeOptional cgi-servers/*.conf
&lt;/code&gt;
Now we need to create the &lt;em&gt;&lt;strong&gt;cgi-servers/&lt;/strong&gt;&lt;/em&gt; directory and the corresponding file:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ sudo mkdir /etc/apache2/cgi-servers/
$ cd /etc/apache2/cgi-servers/
&lt;/code&gt;
Inside create a file named &lt;em&gt;&lt;strong&gt;php-cgi-5.3.28&lt;/strong&gt;&lt;/em&gt; and copy the following content:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
FastCgiServer /srv/www/cgi-bin/php-cgi-5.3.28
ScriptAlias /cgi-bin-php/ /srv/www/cgi-bin/
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next let’s create the file &lt;em&gt;&lt;strong&gt;/srv/www/cgi-bin/php-cgi-5.3.28&lt;/strong&gt;&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;````
#!/bin/sh
PHPRC=”/etc/php5/cgi/5.3.28/”
export PHPRC&lt;/p&gt;

&lt;p&gt;PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN&lt;/p&gt;

&lt;p&gt;PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS&lt;/p&gt;

&lt;p&gt;PHP_FCGI_IDLE_TIMEOUT=5000
export PHP_FCGI_IDLE_TIMEOUT&lt;/p&gt;

&lt;p&gt;exec /opt/phpfarm/inst/bin/php-cgi-5.3.28
````&lt;/p&gt;

&lt;p&gt;We also need to make sure the file is actually executable:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ sudo chmod +x /srv/www/cgi-bin/php-cgi-5.3.28
&lt;/code&gt;
Finally, we can go ahead and create a virtual host that points to the newly create php-cgi server:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/11049832.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Let’s now enable our &lt;strong&gt;VirtualHost&lt;/strong&gt; and restart the Apache server:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ a2ensite test.mydomain.com.conf
$ service apache2 restart
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now let’s make sure our &lt;strong&gt;Virtual Host&lt;/strong&gt; is loading the proper &lt;strong&gt;PHP&lt;/strong&gt; correctly, to do this we can create a phpinfo script on the root directory of our VirtualHost, with the following content:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
&amp;lt;?php phpinfo(); ?&amp;gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With this setup we can install and use as many PHP version as we want, side by side and without any conflicts.&lt;/p&gt;

&lt;h2 id=&quot;final-comments&quot;&gt;Final Comments&lt;/h2&gt;

&lt;p&gt;Although this setup is tailored to my work flow, I’m sure that other developers will find useful or at the very least will give you ideas to improve your own development environment and work flow.&lt;/p&gt;

&lt;p&gt;Also if you spot any errors, have any suggestions or want to share your own setup please feel free to leave a comment on the section below.&lt;/p&gt;
</description>
        <pubDate>Fri, 18 Apr 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/php/programming/devops/2014/04/18/flexible-php-development-phpfarm.html</link>
        <guid isPermaLink="true">https://coderoncode.com/php/programming/devops/2014/04/18/flexible-php-development-phpfarm.html</guid>
      </item>
    
      <item>
        <title>Is HHVM/Hack the new face of PHP?</title>
        <description>&lt;p&gt;&lt;strong&gt;HHVM&lt;/strong&gt; has been generating a lot of buzz and excitement in the &lt;strong&gt;PHP&lt;/strong&gt; world recently and if you haven’t heard about HHVM yet you should check my first two posts about it.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://coderoncode.com/2013/07/24/introduction-hhvm.html&quot;&gt;An Introduction to HHVM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://coderoncode.com/2013/07/24/introduction-hhvm.html&quot;&gt;First steps on HHVM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;why-should-i-care&quot;&gt;Why Should I Care?&lt;/h2&gt;

&lt;p&gt;That’s a really good question why you should care about HHVM, after all is being developed by &lt;strong&gt;Facebook&lt;/strong&gt; (and Facebook is eeeviiiil right?); well the case is that &lt;strong&gt;HHVM&lt;/strong&gt; is – at least in my humble opinion – the coolest development going around the PHP world right now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HHVM&lt;/strong&gt; could change (is already at some extent) the way developers see and think about PHP performance, and how &lt;strong&gt;PHP&lt;/strong&gt; should work. Even if you don’t care and never plan to use &lt;strong&gt;HHVM&lt;/strong&gt; or HACK in any of your projects the mere fact that they exist is a good thing for the PHP community.&lt;/p&gt;

&lt;p&gt;Competition, that’s the first thing that &lt;strong&gt;HACK&lt;/strong&gt; and &lt;strong&gt;HHVM&lt;/strong&gt; brings to the table, ideally we should see some features from HACK reimplemented into later versions of PHP, driving development of the standard PHP language further.&lt;/p&gt;

&lt;h2 id=&quot;hack-will-never-replace-php&quot;&gt;HACK Will Never Replace PHP&lt;/h2&gt;

&lt;p&gt;Nor it should, seems one the most popular topics being used on Hack related articles is about how it could or could not replace PHP (see &lt;a href=&quot;http://www.sitepoint.com/look-hack-php-replacement-hhvm/&quot;&gt;Sitepoint 2&lt;/a&gt; or &lt;a href=&quot;http://www.sitepoint.com/hhvm-hack-part-1/&quot;&gt;Sitepoint 2&lt;/a&gt; ) but in my opinion HHVM/HACK was never meant to be a PHP replacement; it was designed to live side by side with PHP even in the same project.&lt;/p&gt;

&lt;p&gt;Heck, you could even have &lt;strong&gt;PHP&lt;/strong&gt; and Hack code running in the same class file and by setting the correct &lt;strong&gt;‘Mode’&lt;/strong&gt; parts of the code can be type checked and some can be ignored and treated as regular PHP; Hack’s interoperability with PHP is one of its strongest features and truly lowers the entry curve for all PHP developers.&lt;/p&gt;

&lt;h2 id=&quot;final-thoughts&quot;&gt;Final Thoughts&lt;/h2&gt;

&lt;p&gt;Right now the biggest criticism against &lt;strong&gt;HHVM/HACK&lt;/strong&gt; is that &lt;strong&gt;Facebook&lt;/strong&gt; could just drop the project in the next couple of years, a concern that can easily be put to rest by the fact that Facebook own massive code base(which is in the millions of lines of code) is now running almost on its entirety on HACK.&lt;/p&gt;

&lt;p&gt;HHVM/HACK are a refreshing look at the PHP language, is my opinion than even in the bleakest of scenarios there is already a positive outcome from &lt;strong&gt;HHVM/HACK&lt;/strong&gt; coming into existence, as for how far will &lt;strong&gt;HACK&lt;/strong&gt; influence the standard PHP language that is yet to be seen and it will depend greatly on the PHP internals group.&lt;/p&gt;
</description>
        <pubDate>Tue, 08 Apr 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/hhvm/hack/hacklang/php/programming/2014/04/08/hhvm-hack-new-php.html</link>
        <guid isPermaLink="true">https://coderoncode.com/hhvm/hack/hacklang/php/programming/2014/04/08/hhvm-hack-new-php.html</guid>
      </item>
    
      <item>
        <title>Working with Psysh</title>
        <description>&lt;p&gt;I previously mentioned Boris, a terrific REPL for PHP, and while Boris is a great and functional REPL, is not the only available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Psysh&lt;/strong&gt; is actually more than a simple REPL it’s also an interactive debugger; which means you can say goodbye to the endless barrage of var_dump() and die() statements.&lt;/p&gt;

&lt;p&gt;But do we really need another REPL for PHP, well honestly we could probably get by with the solutions currently available however &lt;strong&gt;Psysh&lt;/strong&gt; has an extremely interesting Ace under the sleeve, it can also function as a realtime debugger.&lt;/p&gt;

&lt;p&gt;Regardless of the mode on which is running &lt;strong&gt;Psysh&lt;/strong&gt; can offer a lot of information about our current application state and code. For example the PHP documentation is available by using the doc command:&lt;/p&gt;

&lt;!-- INSERT showterm.io --&gt;
&lt;iframe src=&quot;http://showterm.io/5581ee8f7c7d8d91e8c61&quot; width=&quot;100%&quot; height=&quot;400&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;We can also get more information about our current application objects and their properties:&lt;/p&gt;

&lt;!-- INSERT showterm.io --&gt;
&lt;iframe src=&quot;http://showterm.io/eaea65fdda60f865cd205&quot; width=&quot;100%&quot; height=&quot;400&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;&lt;strong&gt;Psysh&lt;/strong&gt; has also been integrated with several popular frameworks like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/ahmadsherif/laravel-**Psysh**&quot;&gt;Laravel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.twinbit.it/en/blog/drupal-and-**Psysh**-drupal-repl&quot;&gt;Drupal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking for a powerful REPL to integrate with your PHP project, &lt;strong&gt;Psysh&lt;/strong&gt; might the right tool for the job; with powerful features and an integrated debugger &lt;strong&gt;Psysh&lt;/strong&gt; has a lot of value to offer to any project.&lt;/p&gt;
</description>
        <pubDate>Thu, 03 Apr 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/php/development/programming/debugging/2014/04/03/working-with-psysh.html</link>
        <guid isPermaLink="true">https://coderoncode.com/php/development/programming/debugging/2014/04/03/working-with-psysh.html</guid>
      </item>
    
      <item>
        <title>Hello Hack</title>
        <description>&lt;p&gt;Recently Facebook unveiled &lt;strong&gt;Hack&lt;/strong&gt;, a new programming language that aims to provide developers with the tools to write and ship code quickly while catching errors on the fly.&lt;/p&gt;

&lt;h2 id=&quot;what-is-hack&quot;&gt;What is Hack?&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hack&lt;/strong&gt; is as programming language designed to work with HHVM and the same time it works seamlessly with &lt;strong&gt;PHP&lt;/strong&gt; as Facebook lead devs:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files. &lt;a href=&quot;https://code.facebook.com/posts/264544830379293/hack-a-new-programming-language-for-hhvm/&quot;&gt;Facebook&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So does that mean that &lt;strong&gt;Hack&lt;/strong&gt; is just a faster more efficient PHP implementation, right? Wrong, &lt;strong&gt;Hack&lt;/strong&gt; is much more than that, the language brings features that are normally found in statically typed languages to the dynamically typed world of *PHP**.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages… &lt;a href=&quot;https://code.facebook.com/posts/264544830379293/hack-a-new-proogramming-language-for-hhvm/&quot;&gt;Facebook&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;static-typing&quot;&gt;Static typing&lt;/h3&gt;

&lt;p&gt;In a &lt;strong&gt;dynamically typed&lt;/strong&gt; language like php variables types and its values are both mutable, this means that a variable can start like a null then take a string value and finally change to an integer all inside the same &lt;em&gt;local scope&lt;/em&gt;. While this is great for writing scripts and simple applications; as things start to scale the codebase will become harder and harder to maintain.&lt;/p&gt;

&lt;p&gt;With millions of lines of codes and hundreds of developers working on the same code base on daily basis this is exactly what happened at facebook, which was originally developed in &lt;strong&gt;PHP&lt;/strong&gt; and now is running almost entirely on &lt;strong&gt;Hack&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The main and so far most noted feature in &lt;strong&gt;Hack&lt;/strong&gt; its is static typing. In Hack you can annotate variable, function return types and, the function member variables. This alone can help tremendously to prevent errors like the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/9717629.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;On the snippet above &lt;strong&gt;dbfetch()&lt;/strong&gt; could return a null value instead of the object that our code is expecting; PHP errors can only be caught at runtime, but with Hack we can run a type checker against the code and catch this type of errors early in the development cycle.&lt;/p&gt;

&lt;h3 id=&quot;more-than-static-types&quot;&gt;More than static types&lt;/h3&gt;

&lt;p&gt;There is more to &lt;strong&gt;Hack&lt;/strong&gt; than static types among the many features the language implements we have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Collections&lt;/li&gt;
  &lt;li&gt;Tuples&lt;/li&gt;
  &lt;li&gt;Traits&lt;/li&gt;
  &lt;li&gt;Lambda Expressions&lt;/li&gt;
  &lt;li&gt;Generics&lt;/li&gt;
  &lt;li&gt;Async Programming&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that’s only a few of the features that the language has to offer, Collections are particularly interesting since the come as replacement for &lt;strong&gt;PHP Arrays&lt;/strong&gt;, Traits and Trait Generics are a welcome addition, Async programming gives developers the option to develop non-blocking code.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;There is a lot that &lt;strong&gt;Hack&lt;/strong&gt; has to offer to the PHP community, personally I think &lt;strong&gt;Hack&lt;/strong&gt; is a welcome addition to the PHP Universe. Although the general reaction has been mostly positive there has been some criticism and negativity towards &lt;strong&gt;Hack&lt;/strong&gt;, and Facebook decision to stick with PHP.&lt;/p&gt;

&lt;p&gt;And while &lt;strong&gt;Hack&lt;/strong&gt; stability and adoption has yet to be put to the test, the mere fact that something like &lt;strong&gt;Hack&lt;/strong&gt; exists is beneficial for the community and PHP as a language, there is a very good chance that many of the feature hack has could be ported to future PHP versions.&lt;/p&gt;

&lt;p&gt;Finally, there is one massive strength that in my opinion &lt;strong&gt;HHVM&lt;/strong&gt; and &lt;strong&gt;Hack&lt;/strong&gt; currently have on their favor and that is the seamless interoperability between &lt;strong&gt;Hack&lt;/strong&gt; and &lt;strong&gt;PHP&lt;/strong&gt;; developers can take a large codebase and slowly start rewriting the code in &lt;strong&gt;Hack&lt;/strong&gt; class by class even as far as individual functions while the rest of the application is still running on PHP.&lt;/p&gt;

&lt;p&gt;I was able to put this to the test by &lt;em&gt;hackifying&lt;/em&gt; a small &lt;strong&gt;Magento&lt;/strong&gt; extension and have it run successfully along with Magento.&lt;/p&gt;
</description>
        <pubDate>Sun, 23 Mar 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/php/hhvm/hack/hacklang/programming/programming-languages/2014/03/23/hello-hack.html</link>
        <guid isPermaLink="true">https://coderoncode.com/php/hhvm/hack/hacklang/programming/programming-languages/2014/03/23/hello-hack.html</guid>
      </item>
    
      <item>
        <title>HHVM In The Wild</title>
        <description>&lt;p&gt;HHVM is taking the PHP world by storm, and as PHP developer there many things to be excited about HHVM.&lt;/p&gt;

&lt;p&gt;The following list shows how developers are using HHVM in the real world in very different scenarios.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://fideloper.com/hhvm-nginx-laravel&quot;&gt;HHVM, Nginx and Laravel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://dmiller.io/blog/2014/01/04/laravel-on-hhvm/&quot;&gt;Laravel on HHVM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://markvaneijk.com/use-hhvm-to-speed-up-composer&quot;&gt;Use HHVM to speed up Composer&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.google.com/presentation/d/18HIS06kjYjVR5Km9JiSu0iZcSIHlQIEP3C4--hFfcfE/edit?pli=1#slide=id.p16&quot;&gt;Magento on HHVM (Magento Live UK)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.alexfu.it/2013/10/22/symfony-benchmark-on-hhvm.html&quot;&gt;Symfony benchmark using HHVM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://coderoncode.com/2014/02/17/magento-hhvm.html&quot;&gt;Magento and HHVM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;additional-reading&quot;&gt;Additional Reading&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.facebook.com/notes/facebook-engineering/speeding-up-php-based-development-with-hiphop-vm/10151170460698920&quot;&gt;Speeding up PHP-based development with HHVM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://coderoncode.com/2013/07/24/introduction-hhvm.html&quot;&gt;An Introduction to HHVM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://coderoncode.com/2013/07/27/first-steps-on-hhvm.html&quot;&gt;First steps on HHVM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you using &lt;strong&gt;HHVM&lt;/strong&gt; in production or in a way where you can see great performance gains and want to share with us? Then drop me an email at info (at) allanmacgregor.com or leave a comment in the section below.&lt;/p&gt;
</description>
        <pubDate>Sat, 22 Mar 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/hhvm/hacklang/hack/programming/development/2014/03/22/hhvm-in-the-wild.html</link>
        <guid isPermaLink="true">https://coderoncode.com/hhvm/hacklang/hack/programming/development/2014/03/22/hhvm-in-the-wild.html</guid>
      </item>
    
      <item>
        <title>Exploring Traits</title>
        <description>&lt;p&gt;Among the new features and fixes that come with &lt;strong&gt;PHP5.4&lt;/strong&gt; we have the addition of traits to the PHP language, PHP is a single inheritance language this means that classes and only inheriting from single parent class, in practice this complicates code organization and can lead to code duplicity.&lt;/p&gt;

&lt;p&gt;Languages like &lt;strong&gt;C++&lt;/strong&gt; or &lt;strong&gt;Python&lt;/strong&gt; manage this problem by allowing inheritance from multiple classes, Ruby in the other hand uses &lt;strong&gt;Mixins&lt;/strong&gt; to address this issue. Regardless of the technique the problem remains the same; Traits are another approach to this problem and are commonly used in the languages like &lt;strong&gt;Perl&lt;/strong&gt; and &lt;strong&gt;Scala&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Although PHP5.4(and Traits) has been around since early 2012, a lot of php developers might not be familiar with the concept and power behind Traits; In this article I want to explore traits, their usage, advantages and disadvantages.&lt;/p&gt;

&lt;h2 id=&quot;php-and-multiple-inheritance&quot;&gt;PHP and Multiple Inheritance&lt;/h2&gt;

&lt;p&gt;The main reason behind PHP lacking &lt;strong&gt;multiple inheritance&lt;/strong&gt; is the lack of concensus of how to solve the &lt;strong&gt;diamond problem&lt;/strong&gt; which arrises when multiple inheritance is implemented. The diamond problem can be described as an ambiguity in multiple inheritance OOP; but let’s see an example to understand what th is means.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;diamond problem&lt;/strong&gt; gets its name from the shape that the class inheritance takes in the particular situation where:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;… two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and/or C has overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C? &lt;a href=&quot;http://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem&quot;&gt;wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So assuming &lt;strong&gt;PHP&lt;/strong&gt; would allow for multiple class inheritance(which it doesn’t) the diamond problem would look something like this:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/9456741.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Whoops at that point (if PHP actually had multiple inheritance) we would get an error saying, since &lt;strong&gt;PHP&lt;/strong&gt; wouldn’t know which &lt;strong&gt;roar()&lt;/strong&gt; implementation to call.&lt;/p&gt;

&lt;p&gt;This in essence is the problem with multiple inheritance, (un)fortunately PHP being a single inheritance language doesn’t have this problem and with the PHP5.4 we can implement similar functionality to multiple inheritance model.&lt;/p&gt;

&lt;h2 id=&quot;a-trait-traits&quot;&gt;A Trait Traits&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Traits are a mechanism for code reuse in single inheritance languages such as PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies &lt;a href=&quot;php.net/traits&quot;&gt;php.net&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An easy way to conceptualize &lt;strong&gt;traits&lt;/strong&gt; would be to think of them as an interface with an implementation. As we mentioned before single inheritance has been part of &lt;strong&gt;PHP OOP&lt;/strong&gt; (Object Oriented Implementation) over the years this more than one developer has been frustrated by this characteristic when trying to write code that is both clean on a complex system.&lt;/p&gt;

&lt;p&gt;With Traits we can reuse functionality from other classes without having to extend them. Now, this might sound like multiple inheritance but the traits implementation is more akin to &lt;strong&gt;horizontal code reuse&lt;/strong&gt;; Inheratence in the other hand is considered &lt;strong&gt;vertical code reuse&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As we mentioned before Traits are similar to Abstract classes, for example they cannot be instantiated on its own. Let’s look at the following example:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/9573105.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Now, if you are thinking that could you have done the same by creatin a &lt;strong&gt;Cat&lt;/strong&gt; class that extends the &lt;strong&gt;Animal&lt;/strong&gt; class and extending our &lt;strong&gt;Tiger&lt;/strong&gt; class from there; take the following example into consideration:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/9573275.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Wasn’t that cool? Try to do that with single inheritance.&lt;/p&gt;

&lt;p&gt;The best part about traits is that it makes sense from a structural point of view, think about it Cats and BigCats share many traits among them but not all of them, for example we could break it down even further:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/9573439.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Traits are an incredible addition to the &lt;strong&gt;PHP&lt;/strong&gt; language and we have only started to touch the surface, in future articles will go over some of the more advance usages and caveats of using Traits.&lt;/p&gt;
</description>
        <pubDate>Mon, 17 Mar 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/programming/php/design-patterns/development/2014/03/17/exploring-traits.html</link>
        <guid isPermaLink="true">https://coderoncode.com/programming/php/design-patterns/development/2014/03/17/exploring-traits.html</guid>
      </item>
    
      <item>
        <title>Laravel Learning Resources</title>
        <description>&lt;p&gt;For the last couple of months I been working with Laravel and learning a lot, here are some of my favorite resources:&lt;/p&gt;

&lt;h2 id=&quot;books&quot;&gt;Books&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://leanpub.com/codebright&quot;&gt;Laravel: Code Bright&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://leanpub.com/laravel&quot;&gt;Laravel: From Apprentice To Artisan&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://leanpub.com/laravel4cookbook&quot;&gt;Laravel 4 Cookbook&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;blogs&quot;&gt;Blogs&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://laravelweekly.com/&quot;&gt;Laravel Weekly - Newsletter&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jeffrey-way.com/&quot;&gt;Jeffrey Way&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://taylorotwell.com/&quot;&gt;Taylor Otwell&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;screencasts-and-podcasts&quot;&gt;Screencasts and Podcasts&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://laracasts.com/&quot;&gt;Laracasts&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://tutsplus.com/course/laravel-ecommerce-application/&quot;&gt;Build an eCommerce App in Laravel - Tuts+&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.buzzsprout.com/11908&quot;&gt;Laravel.io Podcast&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Sat, 15 Mar 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/laravel/php/programming/resources/development/2014/03/15/laravel-learning-resources.html</link>
        <guid isPermaLink="true">https://coderoncode.com/laravel/php/programming/resources/development/2014/03/15/laravel-learning-resources.html</guid>
      </item>
    
      <item>
        <title>Boris The Missing PHP REPL</title>
        <description>&lt;p&gt;REPL(read-eval-print loop) can be great tools for quickly testing concepts, experimenting and getting quick feedback when learning a new language. Many languages and frameworks provide some sort of REPL like the rails console or laravel’s artisan tinker.&lt;/p&gt;

&lt;p&gt;PHP by itself has the interactive shell that can be invoked with:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
php -a
&lt;/code&gt;
However the PHP Interactive Shell lacks several features that other modern languages have in their REPL’s; like proper error handling, multi-line support and result output by default.&lt;/p&gt;

&lt;h1 id=&quot;meet-boris&quot;&gt;Meet Boris&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;Python has one. Ruby has one. Clojure has one. Now PHP has one too. Boris is PHP’s missing REPL (read-eval-print loop), allowing developers to experiment with PHP code in the terminal in an interactive manner. If you make a mistake, it doesn’t matter, Boris will report the error and stand to attention for further input.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/d11wtq/boris&quot;&gt;Boris&lt;/a&gt;, was developed by &lt;a href=&quot;https://github.com/d11wtq&quot;&gt;Chris Corbyn&lt;/a&gt; a PHP developer that after making the transition to Ruby was disappointed by the lack of a true PHP REPL.&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;&lt;img src=&quot;https://github-camo.global.ssl.fastly.net/18c23fa613beeb044a7ba1ba58a5dfefe120ca6f/687474703a2f2f646c2e64726f70626f782e636f6d2f752f3530383630372f426f72697344656d6f2d76342e676966&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After playing around with Boris for while, I can honestly say that it has the right to call itself ‘The Missing PHP REPL’; not only provides the basic features that you would expect from a standard REPL but also:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Output customization.&lt;/li&gt;
  &lt;li&gt;Configuration files.&lt;/li&gt;
  &lt;li&gt;Start Hooks.&lt;/li&gt;
  &lt;li&gt;Loading larger applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On top of that Boris can be easily installed or included in any project using composer.&lt;/p&gt;

&lt;p&gt;All these features make Boris a powerful and flexible tool regardless if you are just using it to test quick snippets or as part of a large application.&lt;/p&gt;
</description>
        <pubDate>Thu, 13 Mar 2014 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/php/programming/development/2014/03/13/boris-php-repl.html</link>
        <guid isPermaLink="true">https://coderoncode.com/php/programming/development/2014/03/13/boris-php-repl.html</guid>
      </item>
    
      <item>
        <title>Magento Online Hackahon 2014</title>
        <description>&lt;p&gt;This past weekend the Magento Community hosted the first Magento Online Hackathon, here is a quick recap of my experience.&lt;/p&gt;

&lt;h2 id=&quot;the-community&quot;&gt;The Community&lt;/h2&gt;

&lt;p&gt;First and foremost a big shout out to the Magento Community, you guys are awesome. Very few other communities could and have organized themselves to run a Hackathon this size let alone an online one; It’s truly amazing to see people from so many countries and in different timezones trying to work together.&lt;/p&gt;

&lt;p&gt;If anything at all was achieved in this event was to show that what makes Magento so unique and successful it’s community and the people in it.&lt;/p&gt;

&lt;h2 id=&quot;the-hangouts&quot;&gt;The Hangouts&lt;/h2&gt;

&lt;p&gt;Google Hangouts! What can I say? Although not all the teams used them, they where a great tool to facilitate communication with the teams, it also allowed us the organizers to easily reach people and broadcast the progress of the projects to anyone tracking the event.&lt;/p&gt;

&lt;!-- Insert Vinai&#39;s picture covering his eyes --&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/BfQCyAaCAAA8fF7.jpg&quot; alt=&quot;Shy Organizers&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-teams&quot;&gt;The Teams&lt;/h2&gt;

&lt;p&gt;Organizing the teams was a topic that the organizers spend a lot of time discussing, We where unsure of what would be the best approach to determine the team sizes, allocating the developers, and managing people switching between projects.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Should we limit the teams sizes?&lt;/li&gt;
  &lt;li&gt;What happens if people wanted to switch projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Normally in an offline hackathon rules are a bit more strict and people are easier to organize, doing an online hackthon presented many challenges in terms of communication, organization and participation.&lt;/p&gt;

&lt;p&gt;In the end it was decided that rather than enforcing the team allocation, we would use the votes registered at &lt;a href=&quot;magento.corehack.de&quot;&gt;magento.corehack.de&lt;/a&gt; to build a initial team rooster based on each persons vote, this initial rooster is just a suggestion for the initial team organization and participants could switch and even start new projects.&lt;/p&gt;

&lt;p&gt;In the end, I’m happy to say that the teams where more than capable of organizing themselves and there very few if any problems at all.&lt;/p&gt;

&lt;h2 id=&quot;the-projects&quot;&gt;The Projects&lt;/h2&gt;

&lt;p&gt;The Magento community proved that it can be very productive, and with over 20 projects there was plenty of work to do; here are some of the projects that came up as result from the online hackathon:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/magento-hackathon/Implement-Module-for-prediction.io&quot;&gt;Prediction.io Integration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/tim-bezhashvyly/rank&quot;&gt;Responsive Blank Theme&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/magento-hackathon/Loewenstark_Acl&quot;&gt;Extended Access Control List for Magento&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/magento-hackathon/Hackathon_MageMonitoring&quot;&gt;MageMonitoring&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/magento-hackathon/operation-frontend-steward&quot;&gt;Operation Frontend Steward&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/magento-hackathon/hackathon-casperjs&quot;&gt;Frontend tests on Magento with CasperJS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- Add list of the projects and progress, with commit history too --&gt;

&lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/o7Vgc8RgzLw?feature=player_embedded&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
</description>
        <pubDate>Sat, 08 Mar 2014 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/magento/hackathon/programming/development/2014/03/08/magento-hackathon-2014.html</link>
        <guid isPermaLink="true">https://coderoncode.com/magento/hackathon/programming/development/2014/03/08/magento-hackathon-2014.html</guid>
      </item>
    
      <item>
        <title>Magento and HHVM</title>
        <description>&lt;p&gt;If you are developer or system administrator working with &lt;strong&gt;Magento&lt;/strong&gt; running one or more medium sized stores, chances are that you are familiar with the many challenges of optimizing and scaling Magento.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Magento&lt;/strong&gt; is (in)famous for its performance, specially when scaling to a large numbers products, transactions or even catalog rules, seasoned Magento developers have probably hit at least one of this performance bottle necks more than once.&lt;/p&gt;

&lt;p&gt;From the sysAdmin perspective, &lt;strong&gt;Magento&lt;/strong&gt; can be a beast eating away resources and with many bottlenecks and paths to solve them:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Database Optimization&lt;/li&gt;
  &lt;li&gt;Cache Optimization and Architecture&lt;/li&gt;
  &lt;li&gt;Apache vs Nginx&lt;/li&gt;
  &lt;li&gt;mod_php or php-fpm&lt;/li&gt;
  &lt;li&gt;OPCode Caching&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And while all the optimizations help, in the end there is a major performance bottleneck that is not as easily surpassed and that is PHP performance, since PHP is an interpreted language there is price to pay in terms of speed of execution and overall performance.&lt;/p&gt;

&lt;p&gt;As large PHP like &lt;strong&gt;Magento&lt;/strong&gt; try to scale, this performance price gets more noticeable and harder to solve, sure we can always throw more hardware, setup load balancing and fire up a reverse proxy cache; but that will only mask the issue.&lt;/p&gt;

&lt;h2 id=&quot;hhvm&quot;&gt;HHVM&lt;/h2&gt;

&lt;p&gt;Facebook, believe it or not; is runs on PHP and of course it had to deal with the same problems that we talked about before. To solve them Facebook took and interesting approach by creating &lt;strong&gt;HHVM&lt;/strong&gt; (HipHop Virtual Machine).&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;HHVM&lt;/strong&gt; (HipHop Virtual Machine) converts PHP code into a high-level bytecode (commonly
known as an intermediate language). This bytecode is then translated into x64 machine
code dynamically at runtime by a just-in-time (JIT) compiler. In these respects, &lt;strong&gt;HHVM&lt;/strong&gt;
has similarities to virtual machines for other languages including C#/CLR and Java/JVM.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;According to Facebook, they have seen between 6x to 9x the improvement on the performance and speed of their servers, this is big news for any PHP application and not only &lt;strong&gt;Magento&lt;/strong&gt;.Having Magento run on &lt;strong&gt;HHVM&lt;/strong&gt; would drastically improve the speed and performance of the actual application without relying solely on caching.&lt;/p&gt;

&lt;p&gt;Currently, there are still many bugs on certain parts of the &lt;strong&gt;HHVM&lt;/strong&gt; libraries that prevent &lt;strong&gt;Magento&lt;/strong&gt; from fully running. However a lot of progress has been made recently to solve many of these issues; right now the main force behind all the bug fixes to get Magento and HHVM running is Daniel Sloof.&lt;/p&gt;

&lt;!-- Daniel Sloof profile and contact information --&gt;

&lt;blockquote&gt;
  &lt;p&gt;Daniel Sloof is a &lt;strong&gt;Magento&lt;/strong&gt; Developer located in Netherlands; has worked with Magent since 2010 and can be contacted at daniel@rubic.nl or on twitter @daniel_sloof&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Daniel has been working for the last few months on &lt;strong&gt;HHVM&lt;/strong&gt; and OSX compatibly, as well as the HHVM issues with simple_xml.&lt;/p&gt;

&lt;p&gt;As the time of this article publication, Magento can run on HHVM, but should still be approached with caution for production environments.&lt;/p&gt;

&lt;h2 id=&quot;getting-things-up-and-running&quot;&gt;Getting Things Up And Running&lt;/h2&gt;

&lt;p&gt;So you want to run &lt;strong&gt;Magento&lt;/strong&gt; on top of &lt;strong&gt;HHVM&lt;/strong&gt;? If that’s the case you’re in luck, let’s walkthrough the process for setting up, installing and running Magento+HHVM.&lt;/p&gt;

&lt;div class=&quot;notice notice-warning&quot;&gt;
	&lt;strong&gt;Notice:&lt;/strong&gt; While the advantages for running &lt;strong&gt;Magento&lt;/strong&gt; on &lt;strong&gt;HHVM&lt;/strong&gt; are many, HHVM is still under heavy development for that reason I would advise caution when running production projects on HHVM.
&lt;/div&gt;

&lt;h3 id=&quot;installing-hhvm&quot;&gt;Installing HHVM&lt;/h3&gt;

&lt;p&gt;To run &lt;strong&gt;HHVM&lt;/strong&gt; we will have to compile from the source, since HHVM is still under active and heavy development this is the best way to guarantee that we will get the latest and greatest version.&lt;/p&gt;

&lt;div class=&quot;notice notice-warning&quot;&gt;
	This article is not a detailed walkthrough for installing HHVM, if you get stuck or want to learn more read &lt;a href=&quot;http://coderoncode.com/2013/07/27/first-steps-on-hhvm.html&quot;&gt;First steps on HHVM&lt;/a&gt; or additional you can visist &lt;a href=&quot;https://github.com/facebook/hhvm/wiki#building-hhvm&quot;&gt;HHVM Wiki&lt;/a&gt; for environment specific instructions.
&lt;/div&gt;

&lt;p&gt;We will need to get a copy of the &lt;strong&gt;HHVM&lt;/strong&gt; repository:&lt;/p&gt;

&lt;!-- Instructions for cloning the github project or downloading the zip --&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8898050.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Next we will need to configure and compile &lt;strong&gt;HHVM&lt;/strong&gt;:&lt;/p&gt;

&lt;!-- Compilation instructions go here --&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8898057.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;testing-hhvm&quot;&gt;Testing HHVM&lt;/h2&gt;

&lt;p&gt;At this point we have a working hhvm binary that we can use to run php scripts, let’s verify that our hhvm instance works by running, execute the following command:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ /path/to/my/installation/hhvm/hphp/hhvm/hhvm --help
&lt;/code&gt;
If everything is working correctly we should see the following output:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/9056531.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Now if you want to be able to run &lt;strong&gt;HHVM&lt;/strong&gt; easily from any location you can add it to the &lt;strong&gt;PATH&lt;/strong&gt; by creating a symlink:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ ln -s /path/to/my/install/hhvm/hphp/hhvm/hhvm /usr/bin/hhvm
&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;configuring-hhvm-for-magento&quot;&gt;Configuring HHVM for Magento&lt;/h2&gt;

&lt;p&gt;The next step will be setting up the basic configuration file for &lt;strong&gt;HHVM&lt;/strong&gt; and running our first test:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/0b7dd1f25e976b12713c.js&quot;&gt;&lt;/script&gt;

&lt;!-- Instructions for **HHVM** .hdf configuration --&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;HHVM&lt;/strong&gt; works around .hdf configuration files, HDF stands for &lt;strong&gt;Hierarchical Data File&lt;/strong&gt; although in my opinion &lt;strong&gt;Hiphop Definition File&lt;/strong&gt; would also make sense.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The definition files contain all the configuration for a specific &lt;strong&gt;HHVM&lt;/strong&gt; instance they are somewhat equivalent to the apache configuration files. Most of the settings will be self explanatory, however I think it would be helpful if we breakdown the each of the configuration settings and we go into detail.&lt;/p&gt;

&lt;p&gt;As we can see in the example file, there are 4 main configuration nodes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Server&lt;/li&gt;
  &lt;li&gt;Eval&lt;/li&gt;
  &lt;li&gt;VirtualHost&lt;/li&gt;
  &lt;li&gt;StaticFile&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- Settings Breakdown section --&gt;
&lt;p&gt;#### Server&lt;/p&gt;

&lt;p&gt;The server node contains configuration that is specifically used when hhvm runs in server mode (surprising I know!), among these settings we have options like port, listening ip, hostname, number of threads to spawn and so on.&lt;/p&gt;

&lt;p&gt;The are 2 settings to which we should pay particular attention for our &lt;strong&gt;Magento&lt;/strong&gt; installation, &lt;strong&gt;SourceRoot&lt;/strong&gt; and &lt;strong&gt;DefaultDocument&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;SourceRoot&lt;/strong&gt; allows us to specify the &lt;strong&gt;Magento&lt;/strong&gt; root folder, this would be the equivalent of Apache &lt;strong&gt;DocumentRoot&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;DefaultDocument&lt;/strong&gt; allow us to set the index file to be used automatically, this would be the equivalent of Apache &lt;strong&gt;DirectyIndex&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;eval&quot;&gt;Eval&lt;/h4&gt;

&lt;p&gt;The Eval node controls the JIT(Just In Time) Compiler settings in this case the only thing that we need to know is that it should be enabled to get the full benefits from H&lt;strong&gt;HHVM&lt;/strong&gt;.&lt;/p&gt;

&lt;h4 id=&quot;virtualhost&quot;&gt;VirtualHost&lt;/h4&gt;

&lt;p&gt;The Virtual host node allows us to set certain settings by virtual host like &lt;strong&gt;ServerName&lt;/strong&gt; and &lt;strong&gt;ServerVariables&lt;/strong&gt; in this specific case we need to set the rewrite rules to work with &lt;strong&gt;Magento&lt;/strong&gt; rewrite settings, in order to resolve the assets and urls correctly.&lt;/p&gt;

&lt;h4 id=&quot;staticfile&quot;&gt;StaticFile&lt;/h4&gt;

&lt;p&gt;The StaticFile node as the name describes allow us to configure how &lt;strong&gt;HHVM&lt;/strong&gt; will handle and server files like css, js and image files.&lt;/p&gt;

&lt;p&gt;Now, that we have a working configuration file we can run our first test on &lt;strong&gt;HHVM&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&quot;running-magento-with-hhvm&quot;&gt;Running &lt;strong&gt;Magento&lt;/strong&gt; with &lt;strong&gt;HHVM&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Finally, we can get &lt;strong&gt;Magento&lt;/strong&gt; up and running with &lt;strong&gt;HHVM&lt;/strong&gt;, let’s start HHVM using the following command:&lt;/p&gt;

&lt;!-- Insert Command for running hhvm --&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;
$ hhvm -m server -c example.hdf
&lt;/code&gt;
At this point, we should see our Magento website if we go to &lt;strong&gt;http://localhost/&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&quot;measuring-the-speed&quot;&gt;Measuring the Speed&lt;/h3&gt;

&lt;p&gt;Finally, let’s run a quick speed test with siege and compare the speeds of &lt;strong&gt;HHVM&lt;/strong&gt; built-in server VS Apache2 + PHP-fpm:&lt;/p&gt;

&lt;h4 id=&quot;apache2-and-php-fpm&quot;&gt;Apache2 and PHP-FPM&lt;/h4&gt;

&lt;p&gt;````
$ siege -c20 -t1m localhost
** SIEGE 3.0.1
** Preparing 20 concurrent users for battle.
The server is now under siege…
Lifting the server siege…      done.&lt;/p&gt;

&lt;p&gt;Transactions:                436 hits
Availability:             100.00 %
Elapsed time:              59.14 secs
Data transferred:           1.89 MB
Response time:              2.14 secs
Transaction rate:           7.37 trans/sec
Throughput:                 0.03 MB/sec
Concurrency:               15.77
Successful transactions:     436
Failed transactions:           0
Longest transaction:        3.06
Shortest transaction:       0.51&lt;/p&gt;

&lt;p&gt;````&lt;/p&gt;

&lt;h4 id=&quot;hhvm-build-in-server&quot;&gt;&lt;strong&gt;HHVM&lt;/strong&gt; Build In Server&lt;/h4&gt;
&lt;p&gt;````
$ siege -c20 -t1m localhost
** SIEGE 3.0.1
** Preparing 20 concurrent users for battle.
The server is now under siege…
Lifting the server siege…      done.&lt;/p&gt;

&lt;p&gt;Transactions:               1950 hits
Availability:             100.00 %
Elapsed time:              59.96 secs
Data transferred:           9.32 MB
Response time:              0.13 secs
Transaction rate:          32.52 trans/sec
Throughput:                 0.16 MB/sec
Concurrency:                4.17
Successful transactions:    1950
Failed transactions:           0
Longest transaction:        0.47
Shortest transaction:       0.07&lt;/p&gt;

&lt;p&gt;````&lt;/p&gt;

&lt;div class=&quot;notice notice-warning&quot;&gt;
    &lt;strong&gt;Notice:&lt;/strong&gt; The previous tests are by no means comprehensive or accurate, and more than anything they try to showcase the speed difference between the two setups.
&lt;/div&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;!--
yeah but using inbuilt webserver is wrong because:
1) it will be deprecated in the foreseeable future.
2) you can keep using all of your existing rewrites etc because you&#39;re just changing the cgi backend.
3) static assets are served faster somethign like nginx.
--&gt;

&lt;p&gt;We covered a lot of ground here, and we learned how to get &lt;strong&gt;Magento&lt;/strong&gt; up and running with &lt;strong&gt;HHVM&lt;/strong&gt; Built-in server, that being said I feel that is important that we clarify a few things.&lt;/p&gt;

&lt;p&gt;While this article uses the hhvm built-in server, it is important to note that it is not the recommended method of using &lt;strong&gt;HHVM&lt;/strong&gt;. For production setups, Apache/Nginx + &lt;strong&gt;FastCGI&lt;/strong&gt; + HHVM is the recommended setup. Here are some of the reasons why FastCGI should be the prefered method:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The Built-in webserver will be eventually deprecated.&lt;/li&gt;
  &lt;li&gt;You can keep using all the existing rewrites.&lt;/li&gt;
  &lt;li&gt;Static assests are served slightly faster by something like Apache or Nginx.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, for the scope of this article and learning purposes the built-in server is a good introduction to HHVM and the general setup and configuration, in a further article we will cover the production setup with &lt;strong&gt;FastCGI&lt;/strong&gt;&lt;/p&gt;
</description>
        <pubDate>Mon, 17 Feb 2014 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/magento/programming/hhvm/performance/development/2014/02/17/magento-hhvm.html</link>
        <guid isPermaLink="true">https://coderoncode.com/magento/programming/hhvm/performance/development/2014/02/17/magento-hhvm.html</guid>
      </item>
    
      <item>
        <title>Design Patterns in PHP: Singletons</title>
        <description>&lt;p&gt;The singleton pattern is used to restrict the instantiation of a class to a single object, which can be useful when only one object is required across the system.&lt;/p&gt;

&lt;!-- Patterns are still patterns, poor usage that ends ineffective and complex code which makes them into anti-patterns --&gt;

&lt;p&gt;&lt;strong&gt;Singletons&lt;/strong&gt; are designed to ensure there is a single (hence the name singleton) class instance and that is global point of access for it, along with this single instance we have global access and lazy initialization.&lt;/p&gt;

&lt;p&gt;A basic Singleton implementation will look something like the following example:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8660951.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;In the previous example all three variables will point to the same object. The first call will instantiate the object while any subsequent will only return the instantiated object.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s address elephant in the room, and talk about why &lt;strong&gt;Singletons&lt;/strong&gt; are considered an Anti-pattern by many developers, although this is going to highly depend on the framework and language used; for PHP &lt;strong&gt;Singletons&lt;/strong&gt; are almost universally considered an Anti-pattern.&lt;/p&gt;

&lt;div class=&quot;notice notice-warning&quot;&gt;
	&lt;strong&gt;Singletons&lt;/strong&gt; are considered by many to be an anti-pattern, Anti-patterns are design solutions that are usually ineffective and present a high risk of being counter productive.
&lt;/div&gt;

&lt;h2 id=&quot;singletons-the-spawns-from-hell&quot;&gt;Singletons the spawns from Hell?&lt;/h2&gt;

&lt;p&gt;If you have read about &lt;strong&gt;Singletons&lt;/strong&gt; before you are probably wondering what the hell am I doing?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Singletons&lt;/strong&gt; are evil, an Anti-pattern and should never be used! Well that’s exactly what I want to address in this article; saying &lt;a href=&quot;http://c2.com/cgi/wiki?SingletonsAreEvil&quot;&gt;Singletons are Evil!!&lt;/a&gt; is not enough, we need to understand why &lt;strong&gt;Singletons&lt;/strong&gt; shouldn’t generally be avoided.&lt;/p&gt;

&lt;!-- Add more information about why **Singletons** are evil --&gt;

&lt;p&gt;There are several reasons why &lt;strong&gt;Singletons&lt;/strong&gt; are considered an Anti-pattern, let’s take a look at some of those reasons:&lt;/p&gt;

&lt;h3 id=&quot;single-responsibility-pattern&quot;&gt;Single Responsibility Pattern&lt;/h3&gt;

&lt;p&gt;This first problem that we encounter when using &lt;strong&gt;Singletons&lt;/strong&gt; is that their usage breaks the &lt;strong&gt;Single Responsibility Principle&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Singleton objects are responsible of both their purpose and controlling the number of instances the produce, while the &lt;strong&gt;Single Responsibility Principle&lt;/strong&gt; states that:&lt;/p&gt;

&lt;!-- Add Quote for the Single responsibility principle --&gt;

&lt;blockquote&gt;
  &lt;p&gt;… every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;hidden-dependencies&quot;&gt;Hidden dependencies&lt;/h3&gt;

&lt;p&gt;What are hidden dependencies and how is that relevant to &lt;strong&gt;Singletons&lt;/strong&gt;?, well if you read my previous article on &lt;a href=&quot;http://coderoncode.com/2014/01/06/dependency-injection-php.html&quot;&gt;Dependency Injection&lt;/a&gt; we saw how to pass dependencies as parameters to a function.&lt;/p&gt;

&lt;p&gt;Any parameters accepted by a function are called visible dependencies, on the other hand if a function requires something else to operate that is referred through a global variable – read singleton – then that dependency is considered hidden.&lt;/p&gt;

&lt;p&gt;Now this presents because there is no way for a third party to know about this hidden dependencies without taking a look at the actual function implementation.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A visible dependency is a dependency that developers can see from a class’s interface. If a dependency cannot be seen from the class’s interface, it is a hidden dependency. &lt;a href=&quot;http://tutorials.jenkov.com/ood/understanding-dependencies.html#visiblehidden&quot;&gt;jenkov.com&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;testing&quot;&gt;Testing&lt;/h3&gt;

&lt;p&gt;Along with these problems we have an issue when trying to Unit Test our applications. Proper &lt;strong&gt;Unit Tests&lt;/strong&gt; should run independently of things like database, Singletons make unit tests difficult if not impossible since they have a global state.&lt;/p&gt;

&lt;p&gt;That means that a singleton will stick around between &lt;strong&gt;Unit Tests&lt;/strong&gt; once its instantiated, this could and will cause tests to unexpectedly influence each other.&lt;/p&gt;

&lt;p&gt;There are workarounds that take care of ‘cleaning up’ the singleton after each test is run, however I find this contra-productive and messy.&lt;/p&gt;

&lt;h2 id=&quot;its-not-all-bad-is-it-&quot;&gt;It’s not all bad, is it ?&lt;/h2&gt;

&lt;p&gt;They can’t be all bad, can’t they? Well let’s try to argue in favor (sort of) of Singletons and some cases where they might be useful:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Debug Logging:&lt;/strong&gt; Almost all developers will agree that a way to debug logging should be available for every function and part of the code. A singleton could serve this purpose without harming readability, testability or maintainability.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Filesystem and Database Access:&lt;/strong&gt; The argument can be made for Singletons proving access to the filesystem and database, now this might work if you need a single global filesystem or database access point it trades flexibility and testability for modicum amount of convenience.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Singletons&lt;/strong&gt;, &lt;strong&gt;Anti-patterns&lt;/strong&gt;, and patterns in general are not good or bad; what makes a Singleton an Anti-pattern is not the pattern itself but how often is &lt;strong&gt;poorly implemented and how easy it is to do so.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Any pattern can become and an &lt;strong&gt;Anti-pattern&lt;/strong&gt; if incorrectly implemented, which happens often. That being said, when speaking of modern PHP and modern frameworks it is hard to make case in favor of &lt;strong&gt;Singletons&lt;/strong&gt; and personally I don’t see any advantages that out weight the many downsides that come with this pattern.&lt;/p&gt;

&lt;div class=&quot;notice notice-warning&quot;&gt;
	As a &lt;strong&gt;final note&lt;/strong&gt; I understand that Singletons are a controversial and polarizing topic, if you have an opinion, would like to complement any of the points made in this article or even better make a case in favor I would love to hear your comments below.
&lt;/div&gt;
</description>
        <pubDate>Mon, 27 Jan 2014 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/design-patterns/programming/php/development/2014/01/27/design-patterns-php-singletons.html</link>
        <guid isPermaLink="true">https://coderoncode.com/design-patterns/programming/php/development/2014/01/27/design-patterns-php-singletons.html</guid>
      </item>
    
      <item>
        <title>Design Patterns in PHP: Using Factories</title>
        <description>&lt;p&gt;The factory pattern is one of the most commonly used Design Patterns, it is useful when we need to choose between several interchangeable classes at runtime. By using factories we are also separating the creation of an object from the actual implementation.&lt;/p&gt;

&lt;p&gt;We can define a factory as a simple design pattern that give us a convenient way to instantiate objects. A factory is capable of creating different types of objects without necessarily knowing what type of object is actually being created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Factories&lt;/strong&gt; try to address the problem of tight coupling in large application, with a factory instead of calling new directly, we use our factory class to take care of creating of the object.&lt;/p&gt;

&lt;p&gt;There are &lt;strong&gt;several implementations&lt;/strong&gt; and variants of design pattern among of which we have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Simple Factory&lt;/li&gt;
  &lt;li&gt;Abstract Factory&lt;/li&gt;
  &lt;li&gt;Factory Method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On this post we are going to focus on the &lt;strong&gt;Factory method&lt;/strong&gt;, which is closer to the original Gang of four definitions and has more practical applications, as a side note the &lt;strong&gt;Simple Factory&lt;/strong&gt; is normally not considered an actual pattern by many developers.&lt;/p&gt;

&lt;p&gt;Personally I do consider the &lt;strong&gt;Simple Factory&lt;/strong&gt; to be a pattern, just a rather simple one; and I’m not going to start a debate about what pattern is or is not.&lt;/p&gt;

&lt;p&gt;As you can probably gather from the pattern name, a &lt;strong&gt;Factory Method&lt;/strong&gt; works by using a class method for creating and instantiating the required objects.&lt;/p&gt;

&lt;h2 id=&quot;when-to-use-a-factory&quot;&gt;When to use a Factory&lt;/h2&gt;

&lt;p&gt;Know we have a general idea of what a factory class is and what is used for, but when is it appropriate to use it? Factory classes are generally used when:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A class cannot anticipate the object types that needs to create beforehand.&lt;/li&gt;
  &lt;li&gt;We want to encapsulate the logic for instantiating complex objects.&lt;/li&gt;
  &lt;li&gt;We want to reduce tight coupling between our application classes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enough talking let’s create some practical examples of factory class usages.&lt;/p&gt;

&lt;h2 id=&quot;show-me-the-code&quot;&gt;Show Me The Code!&lt;/h2&gt;

&lt;p&gt;Let’s imagine that is our first day at the &lt;strong&gt;Ikea Product Factory&lt;/strong&gt; and we have been tasked with maintaining and updating the code; as you can imagine, this being Ikea, there are thousands of different products and products types. For the sake of argument, let’s imagine that every single product has its own unique class. So we would have something like this:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8506593.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;So as in the code example above, we have a &lt;strong&gt;Product&lt;/strong&gt; abstract class that implements the construct function and the getters and setters that are shared among all the product classes. For each product we have a class inheriting from the &lt;strong&gt;Product abstract class.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You also notice when reading the existing code is that there are hundreds of calls to instantiate each individual product class. Like so:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8506877.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;A clearer example of how this can become problematic is if we had a controller running on &lt;strong&gt;http://factory.ikea.com/product/create/{product_type}&lt;/strong&gt;, this controller is in charge of instantiating a new product objects based on the $product_type provided, validating and adding the information posted and saving the product.&lt;/p&gt;

&lt;p&gt;We are going to ignore the logic for validating the data and saving the product, right now we only care  about how that product object is being instantiated without the use of a factory:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8507273/ce8353737d091d4a25fd807ce5ca699bb264ae97.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;What’s the biggest problem with this code? Simply put since our controller doesn’t know beforehand what type of product it’s going to create, our fictional &lt;strong&gt;Ikea developers&lt;/strong&gt; used a switch statement to handle the right class instantiation.&lt;/p&gt;

&lt;p&gt;Now you might be thinking that doesn’t look so bad? It gets the job done, right? Well remember that it is our fictional &lt;strong&gt;IkeaFactory&lt;/strong&gt; and we have hundreds of different product classes; meaning that if this was a fully implement class we would have hundreds of different cases on our switch statement.&lt;/p&gt;

&lt;p&gt;The previous example is not only messy but hard to maintain too, what would a happen if we suddenly added a new parameter to our &lt;strong&gt;__construct()&lt;/strong&gt; function? You guessed right; that would mean updating every single instance where we call new on any of the product classes; that would mean a few hundred lines changed on our example controller function.&lt;/p&gt;

&lt;p&gt;Let’s see how implementing a basic factory can help us write better and more maintainable code. First we need to create a new class called &lt;strong&gt;ProductFactory&lt;/strong&gt;&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8507938.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;And now lets refactor our controller action to use our new factory:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8507273/a1d7341078c7692ad71d7609ece52eaee81faa0e.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Lets that sink in for a second, we just replaced hundreds of lines of code with a single line and a new class. Now if we had the same scenario where we had to change our constructor function we would only had to change a few lines in our factory method.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;In this post we went over the advantages of using the Factory Method patterns to simplify or code, and make it more manageable. Although the examples in this post where simple ones, the purpose was to exemplify the basic concept rather than a full explanation of every single usage scenario and advanced usages.&lt;/p&gt;

&lt;p&gt;Please feel free to leave a comment with ideas, corrections or your opinion on the topic.&lt;/p&gt;
</description>
        <pubDate>Sun, 19 Jan 2014 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/design-patterns/programming/php/coding/development/2014/01/19/design-patterns-php-factories.html</link>
        <guid isPermaLink="true">https://coderoncode.com/design-patterns/programming/php/coding/development/2014/01/19/design-patterns-php-factories.html</guid>
      </item>
    
      <item>
        <title>Playing with dependency injection in PHP</title>
        <description>&lt;p&gt;&lt;strong&gt;Dependency Injection&lt;/strong&gt; is a software design pattern that allows avoiding hard-coding dependencies and makes possible to change the dependencies both at runtime and compile time.&lt;/p&gt;

&lt;p&gt;By using &lt;strong&gt;Dependency Injection&lt;/strong&gt; we can write more maintainable, testable, and modular code. All projects have dependencies. The larger the project the more dependencies is it bound to have; now having a great number of dependencies is nothing bad by itself however how those dependencies are managed and maintained is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency Injection&lt;/strong&gt; is not a new pattern and it has been commonly used on many languages like Java, but this pattern is somewhat new in the &lt;strong&gt;PHP&lt;/strong&gt; world and it’s gaining traction quickly thanks for frameworks like &lt;a href=&quot;http://laravel.com&quot;&gt;laravel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s exemplify these concepts by creating a pair of classes first without dependency injection and then rewriting the code to use the dependency injection pattern; since I’m primarily a &lt;strong&gt;Magento&lt;/strong&gt; developer I’ll be really original (wink, wink) and create a &lt;strong&gt;Product&lt;/strong&gt; and a &lt;strong&gt;StockItem&lt;/strong&gt; class.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8275062.js&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8275059.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;At first glance the code looks pretty normal and it’s what many PHP developers would call good code, however if we take a closer look at it using the &lt;strong&gt;S.O.L.I.D&lt;/strong&gt; principle we can see that the code actually has many problems:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;The &lt;em&gt;StockItem&lt;/em&gt; is tightly coupled with the &lt;em&gt;Product&lt;/em&gt; class, and while this might not look bad on this particular example. Let’s imagine that we made a change to the &lt;em&gt;StockItem&lt;/em&gt; class to include a new parameter, we would then have to modify every single class where the &lt;em&gt;StockItem&lt;/em&gt; object was created.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The &lt;em&gt;Product&lt;/em&gt; class knows too much, in this case the stock status and quantity, let’s say that our application can handle inventories from multiple sources and stores but for the same product. With that in mind it would be in our best interest to make the &lt;em&gt;Product&lt;/em&gt; class know less about its inventory.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;We just made our life harder when it comes to unit testing the code. Since we are instantiating the stockItem inside the constructor it would be impossible to unit test the &lt;em&gt;Product&lt;/em&gt; class without also testing the &lt;em&gt;StockItem&lt;/em&gt; class.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;lets-inject-something&quot;&gt;Let’s Inject something!&lt;/h2&gt;

&lt;p&gt;In the other hand by using dependency injection we can correct most of these problems, let’s take at the same code but using dependency injection:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8275062.js&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8275757.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;constructor-injection&quot;&gt;Constructor Injection&lt;/h2&gt;

&lt;p&gt;By using dependency injection we have more maintainable code, in the previous example we are using a type of dependency injection normally referred as &lt;strong&gt;Constructor Injection.&lt;/strong&gt; By doing a simple change we can reduce the level of complexity of our code and improve the overall quality; not to mention that now we can easily run unit tests.&lt;/p&gt;

&lt;p&gt;Constructor injection is by far the most common method used and there are several advantages by using this particular type of injection:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;If the &lt;strong&gt;dependency is required&lt;/strong&gt; by the class and cannot work without it, by using constructor injection we guarantee that the required dependencies are present.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Since the constructor is only ever called when instantiating our object we can be sure that the &lt;strong&gt;dependency can’t be changed or altered during the object lifetime.&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These two points make Constructor Injection extremely useful, however there is also a few drawbacks that make it unsuitable for all scenarios:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Since &lt;strong&gt;all dependencies are required&lt;/strong&gt;, it’s not suitable when optional dependencies are needed.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;While using class inheritance trying to extend and &lt;strong&gt;override the constructor becomes difficult.&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;setter-injection&quot;&gt;Setter Injection&lt;/h2&gt;

&lt;p&gt;Another common type of dependency injection is called setter injection and the same code as above would look something like this:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8275062.js&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;https://gist.github.com/amacgregor/8275875.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;As we can see, with Setter Injection the dependencies are provided to our class after it has been instantiated using setter methods. Setter Injection has a few advantages:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Allows for &lt;strong&gt;optional dependencies&lt;/strong&gt; and the class can be created with default values.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Adding new dependencies is as easy&lt;/strong&gt; as adding a new setter method and it won’t break any existing code.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Setter Injection&lt;/strong&gt; might be more suitable for situations where more flexibility is required.&lt;/p&gt;

&lt;h2 id=&quot;so-is-dependency-injection-right-for-my-application&quot;&gt;So is Dependency Injection right for my application?&lt;/h2&gt;

&lt;p&gt;At the end of the day is up to each developer the one that has to make the decision about what design patterns are the right fit for his application be it &lt;strong&gt;Dependency Injection&lt;/strong&gt; or something else; that being said from personal experience using patterns like this might be an overkill for smaller projects.&lt;/p&gt;

&lt;p&gt;But if you are working on large and long running project, then there is good chance that dependency injection might the right solution for your project.&lt;/p&gt;

&lt;h4 id=&quot;if-you-have-any-stories-about-using-dependency-injection-in-the-real-world-and-you-would-like-to-share-please-leave-a-comment-down-below&quot;&gt;If you have any stories about using Dependency Injection in the real world and you would like to share please leave a comment down below.&lt;/h4&gt;
</description>
        <pubDate>Mon, 06 Jan 2014 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/dependency-injection/design-patterns/programming/php/development/2014/01/06/dependency-injection-php.html</link>
        <guid isPermaLink="true">https://coderoncode.com/dependency-injection/design-patterns/programming/php/development/2014/01/06/dependency-injection-php.html</guid>
      </item>
    
      <item>
        <title>The Transhumanist Revolution: Hubris</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;transhumanism&lt;/strong&gt; (abbreviated as H+ or h+) is an international cultural and intellectual movement with an eventual goal of fundamentally transforming the human condition by developing and making widely available technologies to greatly enhance human intellectual, physical, and psychological capacities.&lt;/p&gt;

  &lt;p&gt;&lt;strong&gt;en.wikipedia.org/wiki/transhumanism&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;style&gt;.bt-video-container iframe,.bt-video-container object,.bt-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;margin-top:0}&lt;/style&gt;

&lt;div class=&quot;bt-video-container&quot; style=&quot;position:relative;padding-bottom:56.28%;padding-top:30px;height:0;overflow:hidden&quot;&gt;&lt;iframe width=&quot;780&quot; height=&quot;439&quot; src=&quot;http://www.youtube.com/embed/bTMS9y8OVuY?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-the-transhumanist-revolution&quot;&gt;What is the &lt;strong&gt;transhumanist&lt;/strong&gt; Revolution?&lt;/h2&gt;

&lt;p&gt;Or even better why is &lt;strong&gt;transhumanism&lt;/strong&gt; a revolution? The word revolution evokes strong and most likely violent imagery; conflict and war are also typically associated with the word revolution; and I named this article that way for an opposite reason.&lt;/p&gt;

&lt;p&gt;Is not that I want to associate violence and conflict with the &lt;strong&gt;transhumanist&lt;/strong&gt; movement, quite the opposite; I believe that the &lt;strong&gt;transhumanist&lt;/strong&gt; movement will only keep gaining strength and that it would be beneficial and in the best interest for humanity.&lt;/p&gt;

&lt;p&gt;But that being said  what better way of addressing the most negatives arguments against &lt;strong&gt;transhumanism&lt;/strong&gt; than tackling the head on, this is the first on a series of articles where I attempt to address the main arguments and criticism against transhumanity.&lt;/p&gt;

&lt;h2 id=&quot;hubris&quot;&gt;Hubris&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Overbearing pride or presumption; arrogance: “There is no safety in unlimited technological hubris” (McGeorge Bundy).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This argument basically accuses humanity of trying to play ‘God’. Now there are two branches on which the phrase ‘playing God’ is used one is in the secular sense, meaning that secular humanist believe that tampering with the human biology has higher risk than rewards and thus it should be avoided, and while the secular argument does have some validity; let’s go back to the first one and address the argument from the theological point of view.&lt;/p&gt;

&lt;h3 id=&quot;against-god-plan&quot;&gt;Against ‘God’ plan&lt;/h3&gt;

&lt;p&gt;The Vatican has been one of the main critics of the &lt;strong&gt;transhumanist&lt;/strong&gt; movement and any related technologies, going as far as to calling genetic manipulation an ‘immoral act against god’; this belief is derived from the notion that man was created in the image of God and that anything that changes the genetic identity of a man is &lt;a href=&quot;http://www.vatican.va/roman_curia/congregations/cfaith/cti_documents/rc_con_cfaith_doc_20040723_communion-stewardship_en.html&quot;&gt;radically immoral&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The problem is that the Vatican decided to draw the line of what defines a human being at the genetic code; but the fact of the matter is that defining what makes human is still very much out for debate. A hundred years ago a man with a prosthetic leg or even a hard would have probably raised the same concerns, or let’s even forget the artificial aspect for a second; the catholic church battled for many years on the subject of organ transplant.&lt;/p&gt;

&lt;p&gt;In that sense there is a fair amount of hypocrisy going around when &lt;strong&gt;transhumanism&lt;/strong&gt; is called playing ‘God’, if you truly want to make that argument from an honest position, you would have to reject every single advance that modern medicine has made:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Vaccines&lt;/li&gt;
  &lt;li&gt;Organ transplants&lt;/li&gt;
  &lt;li&gt;Artificial Organs&lt;/li&gt;
  &lt;li&gt;Cancer Treatments&lt;/li&gt;
  &lt;li&gt;Prosthetics (even the most basic ones)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And while modifying the genetic code and improving our own biology does sound like playing ‘God’; we have been playing ‘God’ for as long humanity has tried to cure disease and heal our sick.&lt;/p&gt;

&lt;p&gt;The difference is that technology capable of taking us a step beyond treatment and prevention, to a point where human might be in control of their own evolution. And while is easy to be scared by change, we have to recognize that a big part of what define us has human beings is the constant search for change and improvement and not the stagnation that fear brings.&lt;/p&gt;
</description>
        <pubDate>Wed, 01 Jan 2014 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/transhumanism/futurism/2014/01/01/transhumanist-revolution-hubris.html</link>
        <guid isPermaLink="true">https://coderoncode.com/transhumanism/futurism/2014/01/01/transhumanist-revolution-hubris.html</guid>
      </item>
    
      <item>
        <title>Technical Debt</title>
        <description>&lt;p&gt;Technical Debt, chances are that you as developer have heard that term at least once before; but ask yourself do you really understand technical debt and when is appropriate to use it.&lt;/p&gt;

&lt;p&gt;The term “technical debt” was first coined by Ward Cunningham who compared technical complexity and debt in a 1992 experience report:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite… The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still under the debt load of an unconsolidated implementation, object-oriented or otherwise. – &lt;strong&gt;Ward Cunningham (1992-03-26). “The WyCash Portfolio Management System”. Retrieved 2008-09-26.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Basically technical debt refers to the shortcuts or hacks that we do and that will have future repercussions on our application, technical debt can also be acquired by inaction, like not commenting code, not generating documentation, skipping testing, and so on.&lt;/p&gt;

&lt;p&gt;So if you ever had to hack things to make it work or skip testing just to meet a deadline; then you incurred into technical debt without knowing. Technical debt is usually paid inform of time and money spend fixing problems that could’ve been easily avoided if proper practices would’ve been followed.&lt;/p&gt;

&lt;h2 id=&quot;technical-debt-is-bad--right-&quot;&gt;Technical debt is bad … right ?&lt;/h2&gt;

&lt;p&gt;So technical debt has to be bad since we are only generating problems for our future selfs correct? Well not exactly and this is a topic of much debate among developers, if properly managed technical debt can become and asset instead of problem.&lt;/p&gt;

&lt;p&gt;And while the previous point is highly controversial, modern companies seem to be embracing technical debt as part of their “Standard” methodologies for development, specially does who follow Agile practices. So what does this mean, does it mean that technical debt is desirable even to some extend ?&lt;/p&gt;

&lt;p&gt;Purposely incurring into technical debt implies sacrificing quality and injecting hacky code into our project, instinctively developers find the idea revolting (at least I do) however more often than not as developers we are forced to bend the rules.&lt;/p&gt;

&lt;p&gt;If you’ve ever worked for an “Agile” development company or one that likes to work with extremely close deadlines; you know exactly what I mean with bend the rules.&lt;/p&gt;

&lt;p&gt;And one can even incur into technical debt without being aware of it, so the truth is that no matter what you are likely to incur into some technical debt.&lt;/p&gt;

&lt;h2 id=&quot;dealing-with-technical-debt&quot;&gt;Dealing with Technical Debt&lt;/h2&gt;

&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h2 class=&quot;red&quot;&gt;First rule of Dealing with Technical Debt: &lt;strong&gt;Never Ignore Technical Debt&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;The worst thing you can do with any kind of technical debt is ignored it, recognize that technical debt comes with the interest and sooner or later you will have to pay; even if you incurred into technical debt for good reasons is important that you get rid of it as soon as possible.&lt;/p&gt;

&lt;h2 class=&quot;red&quot;&gt;Second rule of Dealing with Technical Debt: &lt;strong&gt;Set a repayment plan&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;As we mentioned before debt is something that we want to get rid of as soon as possible, the same applies for technical debt.&lt;/p&gt;

&lt;p&gt;For Technical Debt we want to specify a deadline to completely repay our debt back, this way you set a deadline and only allow the technical debt go on for a predetermined amount of time.&lt;/p&gt;

&lt;p&gt;If we don’t pay attention, technical debt has the tendency to hang around, and the more time goes by the hard it becomes to remove a specific piece of technical debt.&lt;/p&gt;

&lt;h2 class=&quot;red&quot;&gt;Third rule of Dealing with Technical Debt: &lt;strong&gt;Set a debt ceiling&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;If you are not paying attention debt will pile on without you even noticing, for that reason is recommended that you setup a debt ceiling, a maximum amount that you can ‘borrow’ from your projects quality.&lt;/p&gt;

&lt;p&gt;Setting a limit on how much debt a project can have helps keeps under control and forces you to think twice if that particular hack/change/compromise is really needed.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Sooner or later everyone is forced to acquire some level of technical debt, the previous rules will help you to it responsibly and you will better equipped to get rid of the technical debt faster.&lt;/p&gt;

&lt;p&gt;That being said, while researching for this article I found that there was a fourth rule that was being overlooked and that it should be the golden rule when dealing with technical debt.&lt;/p&gt;

&lt;h2 class=&quot;red&quot;&gt;Golden rule of Dealing with Technical Debt: &lt;strong&gt;Avoid Technical Debt&lt;/strong&gt; &lt;/h2&gt;

&lt;p&gt;This sounds kind of obvious but in practice is much harder than it sounds, and for most part is us, developers who are at fault. We need to be more vocal and push back to try to avoid Technical debt; when the Project Manager, Sales guy, client says “Just make it work”, “Hack it together, I don’t care “ or any similar cringe worthy phrases we need to stop and make them understand the consequences on the short and long term for the project and the code.&lt;/p&gt;

&lt;p&gt;In the end the best way to deal with Technical Debt is not to have any to begin with.&lt;/p&gt;
</description>
        <pubDate>Mon, 04 Nov 2013 00:00:00 -0500</pubDate>
        <link>https://coderoncode.com/technical-debt/development/devops/programming/2013/11/04/technical-debt.html</link>
        <guid isPermaLink="true">https://coderoncode.com/technical-debt/development/devops/programming/2013/11/04/technical-debt.html</guid>
      </item>
    
      <item>
        <title>We are consuming data the wrong way</title>
        <description>&lt;p&gt;Welcome to the  information age where everything is connected, everything is in the cloud and where rivers of information flow directly to your screen.
If you ever felt like you where drowning in information you are not alone, we consume information – or at least try to – from dozens or even hundreds of different channels.&lt;/p&gt;

&lt;p&gt;As we move forward in the Age of Information we only increase the different sources of information that are available to us, yet it seems our data management and consumption skills remain surprisingly the same.&lt;/p&gt;

&lt;p&gt;Currently most people are not really capable of keeping up with the barrage of information generated by social media, emails and the army of blogs and news readers that most people use but fail miserable at doing so.&lt;/p&gt;

&lt;h2 id=&quot;the-dumb-web&quot;&gt;The Dumb web&lt;/h2&gt;
&lt;p&gt;Currently the Web is dumb, and by dumb I don’t mean useless nor I’m about to tell you go offline – or spend time in the sun ugh — What I mean is that the web is literally dumb, there is no intelligent capabilities to the way we browse the web.&lt;/p&gt;

&lt;p&gt;We are essential using the same technology as it was invented 30 years ago, when the few websites where just black text and a white background. Sure, we have css5, html5, javascript, server side languages, etc.&lt;/p&gt;

&lt;p&gt;All those techs are great for processing and displaying data but really don’t help that much with data consumption. We still get a lot of noise and irrelevant content, let’s say for example I visit nytimes.com&lt;/p&gt;

&lt;p&gt;[insert nytimes.com screenshot]&lt;/p&gt;

&lt;p&gt;As you can see the page is overflowing with information, excerpts, headlines and articles lists, but really of vast that amount of information hat is presented to me I’m only interested on two or three articles across one or maybe 2 different categories.&lt;/p&gt;

&lt;p&gt;Sure I could go to a category and narrow the results even further, but that is exactly my point, we shouldn’t have to do that the nytimes.com and the website in general should be smart enough to present a curated list of articles that match our tastes and preferences.&lt;/p&gt;

&lt;p&gt;Why are we forced to hunt for information, we spend hours everyday trying to find gold nuggets in mountains of digital noise. Our daily lives are overflown with information and it’s only getting worse.&lt;/p&gt;

&lt;h2 id=&quot;moving-towards-the-smart-web&quot;&gt;Moving towards the smart web&lt;/h2&gt;

&lt;p&gt;There are many challenges that still need to be solved before we can have a truly smart web, privacy being one of the most complex ones, sharing data with third party sites it is always a concern.&lt;/p&gt;

&lt;p&gt;However there are some really interesting approaches currently under development that provide interesting approaches to the problem of data management.&lt;/p&gt;

&lt;p&gt;One of my favourite ones is the open source project Huginn currently under development, the idea behind Huginn is to provide a framework for creating and managing intelligent agents that can help with our daily live tasks among them data consumption.&lt;/p&gt;
</description>
        <pubDate>Mon, 28 Oct 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/programming/technology/development/2013/10/28/making-the-web-smarter.html</link>
        <guid isPermaLink="true">https://coderoncode.com/programming/technology/development/2013/10/28/making-the-web-smarter.html</guid>
      </item>
    
      <item>
        <title>Stop Disrupting Everything</title>
        <description>&lt;p&gt;If you have been hanging around in HackerNews for the last few months chances are that you have seen at least one post similar to the following ones:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Disrupt Social Media&lt;/li&gt;
  &lt;li&gt;Help me Disrupt Health Care&lt;/li&gt;
  &lt;li&gt;Disrupting Mass Surveillance&lt;/li&gt;
  &lt;li&gt;Disruptive Innovation&lt;/li&gt;
  &lt;li&gt;Disrupt Sleep&lt;/li&gt;
  &lt;li&gt;Disrupt yourself&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and even
- Indian Inventor Disrupts The Period Industry&lt;/p&gt;

&lt;p&gt;And the list goes on and on, &lt;strong&gt;disrupt&lt;/strong&gt; is the new magical buzzword used by startups across the globe, and while I don’t have a problem with the word disrupt or even the general use of buzzwords to describe concepts; I do have a problem with the inherited mentality that comes with the use of such &lt;em&gt;magical buzzwords&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I propose that the use of such buzzwords murks the message of the startups using them to describe their product or service and even worse can damage the efforts of startups that are not jumping into the &lt;strong&gt;disruption&lt;/strong&gt; bandwagon.&lt;/p&gt;

&lt;p&gt;But wait a minute that can’t be true, buzzwords are technical words or phrases that have become fashionable to explain certain terms within the industry, so they must be harmless well this is often not the case since these buzzwords come attached with some heavy baggage.&lt;/p&gt;

&lt;p&gt;Let’s put things into context and define what disrupt actually means and how is being used:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;1
	a : to break apart : rupture
	b : to throw into disorder agitators trying to disrupt the meeting
2
	: to interrupt the normal course or unity of
definition from &lt;a href=&quot;http://www.merriam-webster.com/dictionary/disrupt&quot;&gt;merria-webster.com&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let that definition sink for a second, disrupt means break apart and interrupt; by that definition a majority of the articles, startups and new techs have been called disruptive are &lt;strong&gt;NOT&lt;/strong&gt; actually disruptive.&lt;/p&gt;

&lt;p&gt;Not all innovation disruptive nor it should be, disruption – at least on terms of tech – means that a new technology comes to displace an existing one.&lt;/p&gt;

&lt;p&gt;With that said, technologies and startups can be disruptive but it’s really difficult to assess a technology as disruptive until after they have actually had measurable impact on an industry.&lt;/p&gt;

&lt;p&gt;So please stop calling yourself or your startup disruptive unless you actually understand what you are saying and specially if your startup is on it’s earlier stages or not even launched, otherwise you will only look foolish and subtract validity to your startup/idea/self.&lt;/p&gt;
</description>
        <pubDate>Sat, 14 Sep 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/startups/rant/2013/09/14/stop-disrupting-everything.html</link>
        <guid isPermaLink="true">https://coderoncode.com/startups/rant/2013/09/14/stop-disrupting-everything.html</guid>
      </item>
    
      <item>
        <title>5 Rules for Writing Great Commits</title>
        <description>&lt;p&gt;One of the most underestimated skills that a developer can have is the ability to make well documented, clean commits.
Writing good commits can save everyone involved in project tremendous amounts of time, money and effort.&lt;/p&gt;

&lt;p&gt;Other developers can quickly see what changes you made and why, and is extremely useful when tracking down when bugs where introduced.&lt;/p&gt;

&lt;h2 id=&quot;a-skill-that-requires-practice&quot;&gt;A Skill that requires practice&lt;/h2&gt;
&lt;p&gt;Choose a project, preferably one that you have been working for some time and has had least a few dozens commit. Now take a look at your commits and try to back track your work.
Not pretty right? At least it wasn’t for me; I had to take a hard look at my workflow and realize that I was approaching commit messages more than an annoyance that needed to be quickly bypassed instead using them as valuable tool for team and myself.&lt;/p&gt;

&lt;p&gt;In order to help me make my commits consistent I setup the following 5 basic guidelines that my commit messages should try to implement:&lt;/p&gt;

&lt;h3 id=&quot;keep-your-commits-clean&quot;&gt;1- Keep your commits clean&lt;/h3&gt;
&lt;p&gt;By clean we are referring at the actual files that are part of a commit; and only adding the files that really need to be part of the actual commit or even the repository.&lt;/p&gt;

&lt;p&gt;I have see many times commits that include log files, tmp/x folders, IDE configuration files, media files. This is not only unnecessary but adds a lot of overhead and possibly increases the size of a repository.&lt;/p&gt;

&lt;h3 id=&quot;commit-early-commit-often&quot;&gt;2- Commit early, Commit often&lt;/h3&gt;
&lt;p&gt;Commit as soon as you have one change ready, thing of your commits as brief snapshots you can use to roll back. Or even better different save games that allow you to go back at specific spots and approach a problem different.&lt;/p&gt;

&lt;p&gt;By committing often we are creating a development history that we can use as reference and in the worst case scenario to roll back in case of a problem.&lt;/p&gt;

&lt;h3 id=&quot;one-whole-change-per-commit&quot;&gt;3- One whole change per commit&lt;/h3&gt;
&lt;p&gt;While I was already doing this with my regular commits I found that many new developers where packing multiple changes into a single commit, and writing messages like:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Fixes vulnerability #222
Changes css class
Rewrites controller&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Having multiple changes all into a single commits makes a bug harder to track down and complicates the process of rolling back&lt;/p&gt;

&lt;h3 id=&quot;specify-why-was-the-change-made&quot;&gt;4- Specify why was the change made&lt;/h3&gt;

&lt;p&gt;Let’s take a quick look at the previous message not only are multiple changes applied inside the same commit but we don’t have any of clue of what was the reason behind that change.&lt;/p&gt;

&lt;p&gt;One new practice that applying is adding a small reason sentences with a description of why the change was implemented for example:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Rewrites controller
Reason: The controller need be changed to implement x and y feature&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;specify-what-was-changed&quot;&gt;5- Specify what was changed&lt;/h3&gt;

&lt;p&gt;Ok so our original commit message looks better but something still missing from it, we are not specifying that we change exactly, saying:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Rewrites controller&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It’s not very specific a much better commit message would be:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Rewrites some/module/CheckoutController.php&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This simple guidelines can save you of a lot of headaches down the road, and if another developer has to look back at the changes that where implemented on a project, he is able to quickly follow the history of the project.&lt;/p&gt;
</description>
        <pubDate>Thu, 05 Sep 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/github/programming/development/2013/09/05/making-good-commits.html</link>
        <guid isPermaLink="true">https://coderoncode.com/github/programming/development/2013/09/05/making-good-commits.html</guid>
      </item>
    
      <item>
        <title>Fitbit Flex and the Quantified Self Movement</title>
        <description>&lt;p&gt;I recently bought a &lt;a href=&quot;http://www.fitbit.com/flex&quot;&gt;Fitbit Flex&lt;/a&gt;, the &lt;strong&gt;Flex&lt;/strong&gt; is a fitness tracker wristband, very similar to the Jawbone UP or the Nike Fuel band. However I have found the Flex to be extremely comfortable to use, accurate and very useful for keeping track of my daily fitness and health.&lt;/p&gt;

&lt;p&gt;But why go through all the trouble of tracking my meals, and wearing a &lt;strong&gt;fitness tracker 24/7&lt;/strong&gt;; well the reason is very simple I want to improve my general health and become a more effective person.&lt;/p&gt;

&lt;p&gt;I believe that information empower us to make better healthier decisions, and this has certainly proven to be true in my case after a my first month of using the Fitbit Flex, I been able to lose 2KG just by changing my eating habits and doing a little more exercise every day.&lt;/p&gt;

&lt;p&gt;Tracking what I eat and how much I exercise is only the beginning, I want to get to a point where I can track most if not everything of what happens on my daily life, looking for ways to do this I found about the &lt;strong&gt;Quantified Self&lt;/strong&gt; movement.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The Quantified Self is a movement to incorporate technology into data acquisition on aspects of a person’s daily life in terms of inputs (e.g. food consumed, quality of surrounding air), states (e.g. mood, arousal, blood oxygen levels), and performance (mental and physical).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So without actually being aware of it I took my first step on the &lt;strong&gt;Quantified Self&lt;/strong&gt; world, and started wondering what else could I possibly track and what I could do with that information.&lt;/p&gt;

&lt;p&gt;After some consideration I want to keep tracking more of my biometric information before moving into things like the memoto or recording video of my waking hours.&lt;/p&gt;

&lt;p&gt;Right now the &lt;strong&gt;Fitbit Flex&lt;/strong&gt; tracks my activity and sleep quality, plus by using their dashboard I can track what food I eat and my caloric balance, which is great if you are trying to lose weight.&lt;/p&gt;

&lt;p&gt;The Flex has also replaced my morning alarms since it comes with a neat silent alarm that wakes you up by vibrating.&lt;/p&gt;

&lt;h2 id=&quot;superficial-tracking&quot;&gt;Superficial tracking&lt;/h2&gt;

&lt;p&gt;While I love my FitBit Flex, It only tracks a fraction of the information that I hope to eventually track. For example the next vector of personal information that I want to start tracking is my heart rate and blood pressure.&lt;/p&gt;

&lt;p&gt;Sure, I could take measurements daily and add that information to the Fitbit dashboard, but this sort of defeats the purpose of life logging, which in my opinion should be as friction less and possible and require minimum input from the user.&lt;/p&gt;

&lt;p&gt;Plus I want to have a detailed log minute by minute of my heart rate and blood pressure, this information could later be used for correlating it with work related stress, activity and so on.&lt;/p&gt;

&lt;p&gt;Another area that I feel could be improved is sleep tracking, the Flex tracks my ‘sleep efficiency’ but it does it based on movement so is not really that accurate. Ideally I want to track my REM patterns, temperature, heart rate, blood pressure, and so on while sleeping.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Fitbit Flex&lt;/strong&gt; is a great way to get started with the quantified self movement and get your feet wet without having to spend too much money or effort.&lt;/p&gt;

&lt;p&gt;Even if you are just looking to lose some weight or track what you are eating, the Flex is a great choice.&lt;/p&gt;
</description>
        <pubDate>Thu, 29 Aug 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2013/08/29/fitbit-flex.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2013/08/29/fitbit-flex.html</guid>
      </item>
    
      <item>
        <title>Burnout</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;Burnout:
A state of emotional and physical exhaustion caused by a prolonged period of stress and frustration; 
an inevitable corporate condition characterized by frequent displays of unprofessional behavior, a blithe 
refusal to do any work, and most important, a distinct aura of not giving a shit. 
– &lt;strong&gt;Urban Dictionary&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We all been there, feeling tired, bored and even sick of our work; burnout is very common in the tech industry, probably more common that most people want to realize.&lt;/p&gt;

&lt;p&gt;There are countless posts, articles and even books that talk about preventing and/or dealing with burnout; exercise, meditation, changing jobs, go in on vacation, changing your diet or taking a bunch of pills (vitamins). All of those have been suggested by the internet gurus, web doctors and startup celebrities.&lt;/p&gt;

&lt;p&gt;But I’m not going to tell you to do any of those things because frankly if you start exercising, meditation or doing whatever it helps you to fight burnout while you are burnout then this new habit are not going to stick, or you probably won’t do them correctly and at then it will be a waste of time that will only another ‘failure’ to your life and contribute to that burnout feeling.&lt;/p&gt;

&lt;p&gt;So how do you combat burnout, well here is the secret … you don’t, at least not until you understand it, so let’s jump into some definitions of what burnout is and what is not.&lt;/p&gt;

&lt;p&gt;According to wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Burnout is a psychological term that refers to long-term exhaustion and diminished interest in work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok, so first two signs of burnout is feeling tired and not giving a shit, but how do we get at this point in the first place; burning out it’s a gradual process, 
you don’t wake up one morning and suddenly think &lt;strong&gt;“I’m tired of my life and no longer give a shit”&lt;/strong&gt;  –…well maybe you but that’s a different set of issues not burnout.–&lt;/p&gt;

&lt;p&gt;Burnout starts to set in when that feeling of accomplishment and satisfaction starts to vanish from your daily lives –burnout not only affects our professional lives but our personal ones too, for example one can be emotionally burnout– this is very noticeable in our professional lives where the majority of people expects to achieve clear results every time.&lt;/p&gt;

&lt;p&gt;It’s all related as how as a society we perceive success and accomplishments, we have a very clear and narrow definition of what success means and how is supposed to look like and when we don’t achieve those specific goals we start to feel as a failure, depressed, irritated and eventually burnout.&lt;/p&gt;

&lt;p&gt;The most effective way of fighting burnout is to preventing it to ever happen, to do that we need to change the way we perceive success and how we measure achievements; even in failure there are reasons to be learned.&lt;/p&gt;

&lt;p&gt;Burnout sets in when we stop learning, when we stop thinking, when we don’t realize that even if we are not achieving the results we were hoping, there is still much to learn.&lt;/p&gt;

&lt;p&gt;So don’t fight burnout, just don’t let it set in.&lt;/p&gt;
</description>
        <pubDate>Fri, 02 Aug 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2013/08/02/fighting-burnout.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2013/08/02/fighting-burnout.html</guid>
      </item>
    
      <item>
        <title>Week 1: 500 Words a day</title>
        <description>&lt;p&gt;A week ago I decided to follow the example of the amazing &lt;a href=&quot;http://nathanbarry.com/&quot;&gt;Nathan Barry&lt;/a&gt; in order to try kick start this blog and work on a couple of book projects that I want to launch. The basic idea revolves around creating the &lt;strong&gt;habit of writing&lt;/strong&gt; a specific amount of words every day no matter what.&lt;/p&gt;

&lt;p&gt;It has been a week since I started and so far it has been both a rewarding and challenging process, this method is not new by any means whatsoever some people recommend doing &lt;strong&gt;750 words per day&lt;/strong&gt; others swear that 1000 words is the ideal amount.&lt;/p&gt;

&lt;p&gt;There is even an on-line editor which sole focus is on writing 750 words per day, the site is called &lt;a href=&quot;http://750words.com/&quot;&gt;750words.com&lt;/a&gt; – &lt;strong&gt;shocking right?&lt;/strong&gt; – now it really all depends on what you are trying to say and the ability of the writer.&lt;/p&gt;

&lt;p&gt;While &lt;strong&gt;750words.com&lt;/strong&gt; sounded like an easy way to get started, I didn’t felt comfortable writing what might be privates thoughts or at least sensitive information without any control or guarantees of how the information was stored and guarded.&lt;/p&gt;

&lt;p&gt;For my daily goal I settled to start with &lt;strong&gt;500 words&lt;/strong&gt;; 500 words seemed to be an achievable goal that would keep me motivated, but challenging enough where I would actually had to put some effort.&lt;/p&gt;

&lt;h2 id=&quot;tricking-myself-to-win&quot;&gt;Tricking Myself to Win&lt;/h2&gt;

&lt;p&gt;Setting a habit is hard, specially when is something that requires effort or makes uncomfortable (read exercise); writing is not different, you are not going to be on the top of your game each day and the infamous writers block my hit at any time and without warning.&lt;/p&gt;

&lt;p&gt;So I took preventive methods to help me out and basically tricky myself pass any obstacles, the first thing that I’m doing is keeping record of how many days in a row I been keeping up with my goal, for tracking this I’m using and iPhone app called &lt;a href=&quot;https://itunes.apple.com/us/app/commit/id473527073?mt=8&quot;&gt;&lt;strong&gt;Commit&lt;/strong&gt;&lt;/a&gt; by &lt;strong&gt;Nathan Barry.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The app is very simple and easy to use, you can set daily goals and if you want to a reminder; the app will ask you each day if you have met your goal. The more you keep the chain going the less likely is for you to break it; you also get instant feedback and a sense of achievement.&lt;/p&gt;

&lt;p&gt;And thats exactly what I wanted, to feel that sense of achievement each day, that rush of satisfaction of completing a challenging task, basically I was trying to trick my brain into becoming addicting to writing.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;We are what we repeatedly do. Excellence, then, is not an act, but a habit. 
- &lt;strong&gt;Aristotle&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first two days writing 500 daily words seemed easy enough, I was even exceeding the quote for a few hundreds words during the first days. By Thursday I was starting to slowdown.&lt;/p&gt;

&lt;p&gt;Slowing down is not a bad thing unless you stop completely, I found that changing topics and working a different draft helped me to write pass my mental roadblocks and get back into a writing flow.&lt;/p&gt;

&lt;h2 id=&quot;the-result&quot;&gt;The result&lt;/h2&gt;

&lt;p&gt;After just my first week I feel incredibly productive and I have build a considerable buffer of posts, that I will be posting every four days or so in this blog.&lt;/p&gt;

&lt;p&gt;Along with that I’m also making progress on my new book project (shhh! Don’t tell anyone).&lt;/p&gt;
</description>
        <pubDate>Tue, 30 Jul 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2013/07/30/500-a-day-week1.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2013/07/30/500-a-day-week1.html</guid>
      </item>
    
      <item>
        <title>First steps on HHVM </title>
        <description>&lt;p&gt;On a previous post &lt;a href=&quot;http://coderoncode.com/2013/07/24/introduction-hhvm.html&quot;&gt;Introduction to HHVM&lt;/a&gt; we went over &lt;a href=&quot;http://www.hhvm.com/blog/&quot;&gt;&lt;strong&gt;HHVM&lt;/strong&gt;&lt;/a&gt;’s history and the potential of running our &lt;strong&gt;PHP&lt;/strong&gt; applications on top of it. Currently a few applications are fully supported like wordpress and drupal; more complex applications like &lt;a href=&quot;http://www.magentocommerce.com/&quot;&gt;&lt;strong&gt;Magento&lt;/strong&gt;&lt;/a&gt; are still not 100% with HHVM due to bugs in the HHVM implementation.&lt;/p&gt;

&lt;p&gt;The first thing that we need to in order to start developing with HHVM is to setup a proper environment, for this case we are going to use a Vagrant Box.&lt;/p&gt;

&lt;h2 id=&quot;skipping-the-installation&quot;&gt;Skipping the Installation&lt;/h2&gt;

&lt;p&gt;If you want to skip the whole setup you can download the configured vagrant box by doing the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir vagrant-hhvm
cd vagrant-hhvm
vagrant init
vagrant box add hhvmdev https://www.dropbox.com/s/5qyjkes49nk5abt/package.box
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;installing-vagrant&quot;&gt;Installing Vagrant&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://vagrantup.com/&quot;&gt;Download&lt;/a&gt; and install the appropriate version of Vagrant for your machine.&lt;/p&gt;

&lt;h2 id=&quot;downloading-ubuntu-precise-1204&quot;&gt;Downloading Ubuntu Precise (12.04)&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir ~/dev/vagrant/
cd ~/dev/vagrant/
vagrant init
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This will create a vagrant configuration file, this file is used for setting the configuration and provisioning our new vagrant box. We also need to download and ISO image of the &lt;strong&gt;Ubuntu 12.04&lt;/strong&gt; vagrant can do this with a single command.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vagrant box add base http://files.vagrantup.com/precise64.box
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Once vagrant finishes downloading the Ubuntu image we can start our vagrant box by typing:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vagrant up
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Vagrant runs in headless mode (meaning there is no screen or interface, everything runs in the background) in order to be able do anything with our new box we need to open a ssh session to it. If you are working in OSX or Linux you are luck, you can login into your vagrant box by typing:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vagrant ssh
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Windows users can still run the command to get instructions on how to connect with vagrant by using putty or &lt;strong&gt;xshell&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Once we are logged it into our brand new vagrant box we are ready to start installing HHVM&lt;/p&gt;

&lt;h2 id=&quot;installing-hhvm&quot;&gt;Installing HHVM&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Facebook&lt;/strong&gt; currently provides binary distributions of the HHVM, but unfortunately this binary files are nowhere near the latest updates; so in order to have the latest bug fixes and patches we have to build HHVM from the repository HEAD&lt;/p&gt;

&lt;h3 id=&quot;setting-up-the-build-tools&quot;&gt;Setting up the build tools&lt;/h3&gt;
&lt;p&gt;We need to install some base tools before we can actually build HHVM:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install git-core cmake g++ libboost1.48-dev libmysqlclient-dev \
libxml2-dev libmcrypt-dev libicu-dev openssl build-essential binutils-dev \
libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev \
autoconf libtool libcurl4-openssl-dev libboost-regex1.48-dev libboost-system1.48-dev \
libboost-program-options1.48-dev libboost-filesystem1.48-dev wget memcached \
libreadline-dev libncurses-dev libmemcached-dev libbz2-dev \
libc-client2007e-dev php5-mcrypt php5-imagick libgoogle-perftools-dev \
libcloog-ppl0 libelf-dev libdwarf-dev libunwind7-dev subversion
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;building-hhvm&quot;&gt;Building HHVM&lt;/h3&gt;
&lt;p&gt;Next, we need to get a copy of &lt;a href=&quot;https://github.com/facebook/hiphop-php&quot;&gt;HHVM GitHub repository&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir ~/hhvm-dev/
cd ~/hhvm-dev/
git clone https://github.com/facebook/hiphop-php
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Before jumping ahead and compiling HHVM we need to setup some third-party libraries required to support some of the &lt;strong&gt;PHP&lt;/strong&gt; language features:&lt;/p&gt;

&lt;h4 id=&quot;libevent&quot;&gt;libevent&lt;/h4&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone git://github.com/libevent/libevent.git
cd libevent
git checkout release-1.4.14b-stable
cat ../hiphop-php/hphp/third_party/libevent-1.4.14.fb-changes.diff | patch -p1
./autogen.sh
./configure --prefix=$CMAKE_PREFIX_PATH
sudo make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4 id=&quot;libcurl&quot;&gt;libCurl&lt;/h4&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone git://github.com/bagder/curl.git
cd curl
./buildconf
./configure --prefix=$CMAKE_PREFIX_PATH
sudo make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4 id=&quot;google-glog&quot;&gt;Google glog&lt;/h4&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;svn checkout http://google-glog.googlecode.com/svn/trunk/ google-glog
cd google-glog
./configure --prefix=$CMAKE_PREFIX_PATH
sudo make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4 id=&quot;jemalloc-30&quot;&gt;JEMalloc 3.0&lt;/h4&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget http://www.canonware.com/download/jemalloc/jemalloc-3.0.0.tar.bz2
tar xjvf jemalloc-3.0.0.tar.bz2
cd jemalloc-3.0.0
./configure --prefix=$CMAKE_PREFIX_PATH
sudo make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Now we are ready for compiling HHVM:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd hiphop-php
export CMAKE_PREFIX_PATH=`pwd`/..
export HPHP_HOME=`pwd`
cmake .
make
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If the compiler ran successfully and we didn’t get any errors, we should be able to check HHVM version by running:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; hphp/hhvm/hhvm --version
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Let’s create a &lt;strong&gt;symlink&lt;/strong&gt; to make our lives a little easier:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo ln -s ~/hhvm-dev/hiphop-php/hphp/hhvm/hhvm /usr/bin/hhvm
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;next-steps&quot;&gt;Next steps&lt;/h2&gt;

&lt;p&gt;Let’s test &lt;strong&gt;HHVM&lt;/strong&gt; by setting up a quick PHP script:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir -p ~/dev/scripts/
vim ~/dev/scripts/hhvm-test.php
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;And copy the following code:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;?php echo &quot;Hello world, I&#39;m running HHVM\r\n&quot;; ?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Save the file, now in order to run or PHP applications through &lt;strong&gt;HHVM&lt;/strong&gt; is important to understand how the differ from a normal &lt;strong&gt;LAMP stack&lt;/strong&gt;(we will cover this on a later post), for now we can run our test script by running:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;hhvm ~/dev/scripts/hhvm-test.php
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If you see the message printed on your console means that the setup was successful and we are now running HHVM.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;In the next post I’ll cover the installation of Wordpress under &lt;strong&gt;HHVM&lt;/strong&gt; and the basis for &lt;strong&gt;debugging&lt;/strong&gt; an application running on HHVM.&lt;/p&gt;
</description>
        <pubDate>Sat, 27 Jul 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/programming/development/hhvm/vagrant/2013/07/27/first-steps-on-hhvm.html</link>
        <guid isPermaLink="true">https://coderoncode.com/programming/development/hhvm/vagrant/2013/07/27/first-steps-on-hhvm.html</guid>
      </item>
    
      <item>
        <title>An Introduction to HHVM</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;HHVM (HipHop Virtual Machine) converts PHP code into a high-level bytecode (commonly known as an intermediate language). This bytecode is then translated into x64 machine code dynamically at runtime by a just-in-time (JIT) compiler. In these respects, HHVM has similarities to virtual machines for other languages including C#/CLR and Java/JVM.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;a-little-big-of-history&quot;&gt;A little big of history&lt;/h2&gt;

&lt;p&gt;In early 2008 Facebook began working on &lt;strong&gt;HipHop&lt;/strong&gt;(now HPHP), a PHP execution engine; its original motivation was to convert Facebook massive PHP code base into C++ in order to save resources and increase the application performance. The original release was known as HPHPc a &lt;strong&gt;PHP&lt;/strong&gt; to &lt;strong&gt;C++&lt;/strong&gt; compiler.&lt;/p&gt;

&lt;p&gt;For next 2 years Facebook continued working on &lt;strong&gt;HipHop&lt;/strong&gt; adding &lt;strong&gt;HPHPi&lt;/strong&gt; ( a ‘developer mode’ version of HPHP) and HipHop debugger known as &lt;strong&gt;HPHPd&lt;/strong&gt;, this allowed developers to watch and step through the code and interactively debug &lt;strong&gt;PHP&lt;/strong&gt; applications running on the &lt;strong&gt;HipHop&lt;/strong&gt; platform.&lt;/p&gt;

&lt;p&gt;At it’s peak, &lt;strong&gt;HipHop&lt;/strong&gt; PHP code showed up to 6x times better performance than its &lt;strong&gt;ZEND&lt;/strong&gt; counterpart. However, there where several drawbacks to this first iteration of HipHop:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;HPHPc did not fully supported the PHP language, most noticeably the lack of support for &lt;em&gt;create_function()&lt;/em&gt; and eval() –Honestly, I don’t see the lack of support for the last one as something bad– functions.&lt;/li&gt;
  &lt;li&gt;Facebook developers had to maintain two difference engines (&lt;strong&gt;HPHPc&lt;/strong&gt; and &lt;strong&gt;HPHPi&lt;/strong&gt;) with resulted in duplication of efforts and waste of resources.&lt;/li&gt;
  &lt;li&gt;Finally, &lt;strong&gt;HPHPc&lt;/strong&gt; required a vastly different deployment process which will hurt adoption by &lt;strong&gt;PHP&lt;/strong&gt; developers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In light of these problems Facebook took two key actions on early 2010, the first was to open source the &lt;strong&gt;HipHop&lt;/strong&gt; platform. – Open sourcing a project like this is a great way to build a community around the project and getting external help from that community –/&lt;/p&gt;

&lt;p&gt;At the same time &lt;strong&gt;Facebook&lt;/strong&gt; started the development of the modern version of HipHop, known as HHVM (HipHop Virtual Machine), &lt;strong&gt;HHVM&lt;/strong&gt; improves the strengths of HPHPc and corrects many of the critical problems.&lt;/p&gt;

&lt;p&gt;HHVM was build on top of &lt;strong&gt;HPHPc&lt;/strong&gt; and it works by converting PHP code into high level bytecode(an intermediate language) this bytecode is the translated into machine code dynamically at runtime by a JIT (Just-In-Time) compiler.&lt;/p&gt;

&lt;p&gt;If you are like me you probably have a vague recollection of the concepts of bytecode, machine code and Just-In-Time compilers, so let’s take a momentarily side step and quickly review these concepts and how the they play a key role on &lt;strong&gt;HHVM&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;bytecode-machine-code-jit-oh-my-&quot;&gt;Bytecode, Machine code, JIT, Oh my …!&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Bytecode&lt;/strong&gt;: Is a non human readable code designed for efficient execution by an interpreter or compiler. When HHVM first loads our project it converts all the PHP code into this intermediary form of bytecode; the bytecode generate is not particular to any type of architecture and could be portable among different systems.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Machine code&lt;/strong&gt;: Are a set of instructions designed to be executed directly by the CPU. If you ever played with Assembly (Who hasn’t !?) you know very well what machine code is, for those very few of you who haven’t had the pleasure of working on assembly or similar languages; machine code is generated by the compiler or interpreter and then handed to the CPU&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;JIT (Just In Time) compiler&lt;/strong&gt;: Just in time compilation is a technique used to improve performance of software, this is achieved by compiling bytecode during execution, the byte code is store in memory and then the JIT compiler loads and compiles as many sections of the byte code as needed.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The performance and speed gained by applying these techniques is what gives &lt;strong&gt;HipHop&lt;/strong&gt; and subsequently &lt;strong&gt;HHVM&lt;/strong&gt; its core strengths. Keeping a &lt;strong&gt;PHP&lt;/strong&gt; code base while achieving performance comparable to compiled applications.&lt;/p&gt;

&lt;p&gt;Currently HHVM supports PHP 5.4 almost on its entirety, however there are still numerous bugs that prevent some applications from running, for that reason Facebook has set as goal to have the top 20 open source PHP applications running on HHVM. The first popular application to achieve this was Wordpress.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;
&lt;p&gt;So now that we have a better understanding of what HHVM does and the advantages if running it we can start testing our applications on HHVM. In a subsequent post I will be covering the setup of a dedicated Vhost for HHVM, running benchmarks against your applications and eventually (fingers crossed) how to run Magento on HHVM.&lt;/p&gt;
</description>
        <pubDate>Wed, 24 Jul 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/hhvm/programming/development/vagrant/2013/07/24/introduction-hhvm.html</link>
        <guid isPermaLink="true">https://coderoncode.com/hhvm/programming/development/vagrant/2013/07/24/introduction-hhvm.html</guid>
      </item>
    
      <item>
        <title>More than human</title>
        <description>&lt;p&gt;In the last couple years, we have seen the emergence of new and exciting technologies aimed towards closing the gap between man and machine; projects like Google glass, scanadu the real life ‘tricorder’ and the myriad of fitness bands are only a few examples of how not only technology has become part of daily lives but is slowly becoming part of what we are and how we define our identity.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Transhumanism is an international intellectual and cultural movement supporting the use
of science and technology to improve the human condition…&lt;/p&gt;

  &lt;p&gt;&lt;strong&gt;en.wikipedia.org/wiki/Transhumanism&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From a technologist point of view, this phenomenon is really interesting, but I find even more interesting the social implications of this line of technological development; which is what I intent do explore on this particular article.&lt;/p&gt;

&lt;p&gt;I’m a huge fan of science fiction and trans-humanism, that been said I’ve found that many trans-humanists and futurologist often fail to factor-in socio-economic and political variables in their predictions, and in that sense they might end been to optimistic on the time lines that they propose.&lt;/p&gt;

&lt;p&gt;Ray Kurzweil, father of the singularity movement and probably the most famous futurologist is a clear example of over optimistic predictions while he is more than likely correct on his technological predictions he fails to factor the possible blow-back from political groups, religious institutions and the resistance that is common with change.&lt;/p&gt;

&lt;p&gt;Google Glass, which we could call the earlier beginning of  trans-humanist technologies is already getting resistance well before of its public release and efforts have started in the US, and UK to get it &lt;a href=&quot;http://www.huffingtonpost.com/2013/04/10/google-glass-banned_n_3039935.html&quot;&gt;banned&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What will happen when more esoteric technologies are made available to us, what kind of resistance we can expect when the first humans can and start modifying their own biology.&lt;/p&gt;

&lt;h2 id=&quot;the-problem-with-religion&quot;&gt;The problem with religion&lt;/h2&gt;

&lt;p&gt;What would happen if as Kurtweil expects, we get the first Immortal humans in the next few decades? How will a discovery like this affect the world religions, who base their core dogmas in the beliefs of an afterlife, and the rewards (or punishment) that come with it?&lt;/p&gt;

&lt;p&gt;If death is no longer part of the human condition and becomes an avoidable, even reversible process; how would the religious leaders react?&lt;/p&gt;

&lt;p&gt;If such evens happened tomorrow and this treatment was widely available, then is very likely that we would see even larger acts of terrorism committed the religious extremist of the world; a Jihad on science, Christian extremist bombing hospitals and carrying ‘Gods will’.&lt;/p&gt;

&lt;h2 id=&quot;the-future-of-humankind&quot;&gt;The Future of Humankind&lt;/h2&gt;

&lt;p&gt;Regardless of the singularity and the trans-humanism movement, humankind needs to mature; collectively we are in our teenagers still trying to figure out whom we are, and we want to do.&lt;/p&gt;

&lt;p&gt;Unfortunately, the stakes are much higher, and if we do not get our act together as species there is a real chance that we will not make it see the promises of the singularity.&lt;/p&gt;
</description>
        <pubDate>Sun, 21 Jul 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/futurism/technology/2013/07/21/more-than-human.html</link>
        <guid isPermaLink="true">https://coderoncode.com/futurism/technology/2013/07/21/more-than-human.html</guid>
      </item>
    
      <item>
        <title>Blog relaunched using jekyll</title>
        <description>&lt;p&gt;Over the last 2 years I have tried several times to kickstart &lt;strong&gt;coderoncode.com&lt;/strong&gt;, and a long with it I have tried multiple 
blogging platforms (wordpress, obtvse, etc) I even tried coding my own blogging solution; all without much success.&lt;/p&gt;

&lt;p&gt;From each of these attempts I have learned valueable lessons, so far I have spent more time tweaking the platform and the style 
than actually writing; so if I’m to succeed this time I need a blogging platform that actually lets me write and doesn’t get 
in the way.&lt;/p&gt;

&lt;h2 id=&quot;meet-jekyll&quot;&gt;Meet Jekyll&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Jekyll is a simple, blog-aware, static site generator. It takes a template directory containing raw text files in various 
formats, runs it through Markdown (or Textile) and Liquid converters, and spits out a complete, ready-to-publish static website 
suitable for serving with your favorite web server.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As content generators go, Jekyll is truly amazing, while I don’t (yet) intent to list the full set of features or how to use it
we can over the main features of &lt;strong&gt;Jekyll&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Clear directory structure and scaffolding generation.&lt;/li&gt;
  &lt;li&gt;Support for assets and downloads.&lt;/li&gt;
  &lt;li&gt;Preview server.&lt;/li&gt;
  &lt;li&gt;Configurable in YAML.&lt;/li&gt;
  &lt;li&gt;Supports drafts and future publications dates.&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Mon, 01 Jul 2013 00:00:00 -0400</pubDate>
        <link>https://coderoncode.com/2013/07/01/blog-relaunched-with-jekyll.html</link>
        <guid isPermaLink="true">https://coderoncode.com/2013/07/01/blog-relaunched-with-jekyll.html</guid>
      </item>
    

    
      
        
      
    
      
        
          <item>
            <title>About</title>
            <description>&lt;p&gt;&lt;strong&gt;Allan MacGregor&lt;/strong&gt; is a developer living and working in Toronto. Originally from Mexico, he freelanced his way through college before moving to Canada, in 2009. While he designed and developed dozens of projects with clients large and small, specializing in ecommerce websites; during that time he was one of the early adopters of &lt;strong&gt;Magento&lt;/strong&gt;. In early 2010, he moved to Toronto to work at &lt;strong&gt;Demac Media&lt;/strong&gt; as Magento Lead Developer.&lt;/p&gt;

&lt;p&gt;Since joining Demac, Allan has worked on numerous projects including Integrations with CanadaPost, Optimal Payments and, Masterpass, several internal tools, and dozens of Magento Stores.&lt;/p&gt;

&lt;h2 id=&quot;my-books&quot;&gt;My Books&lt;/h2&gt;

&lt;h3 id=&quot;released&quot;&gt;Released:&lt;/h3&gt;

&lt;div class=&quot;section group&quot;&gt;
  &lt;div class=&quot;col span_3_of_12&quot;&gt;
    &lt;a href=&quot;http://www.amazon.com/dp/1782163069/?tag=coderoncode&quot;&gt;&lt;img src=&quot;http://magedevguide.com/images/3060os_cover79b6.png?1393801869&quot; /&gt;&lt;/a&gt;  
  &lt;/div&gt;
  &lt;div class=&quot;col span_3_of_12&quot;&gt;
    &lt;a href=&quot;http://coderoncode.com/books/magetdd.html&quot;&gt;&lt;img width=&quot;170&quot; src=&quot;/assets/book_images/magetdd_title_v2.png&quot; /&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class=&quot;col span_6_of_12&quot;&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;h1 id=&quot;what-im-working-on&quot;&gt;What I’m working on&lt;/h1&gt;

&lt;p&gt;Some fun projects I been working on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MageVagrant &lt;a href=&quot;https://github.com/amacgregor/MageVagrant&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MageHack-Voting &lt;a href=&quot;https://github.com/amacgregor/MageHack-Voting&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Magento Whoops &lt;a href=&quot;https://github.com/amacgregor/magento-whoops&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Magento Xhprof Integration &lt;a href=&quot;https://github.com/amacgregor/magento-xhprof&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For comments or questions, feel free to &lt;a href=&quot;http://twitter.com/allanmacgregor&quot;&gt;ask me on Twitter&lt;/a&gt; or shoot me an email at info at allanmacgregor dot com.&lt;/p&gt;
</description>
            <link>https://coderoncode.com/about/</link>
          </item>
        
      
    
      
        
          <item>
            <title>Books</title>
            <description>&lt;div class=&quot;section group&quot;&gt;
  &lt;div class=&quot;col span_3_of_12&quot;&gt;
    &lt;a href=&quot;http://coderoncode.com/books/magetdd.html&quot;&gt;&lt;img width=&quot;170&quot; src=&quot;/assets/book_images/magetdd_title_v2.png&quot; /&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class=&quot;col span_9_of_12&quot;&gt;
    &lt;h1&gt;&lt;a href=&quot;http://coderoncode.com/books/magetdd.html&quot;&gt;Test Driven Magento Extension Development&lt;/a&gt;&lt;/h1&gt;
    &lt;p&gt;Learn how to effectively build and test extensions using TDD/BDD and tools like &lt;strong&gt;PHPspec, Behat and PHPUnit&lt;/strong&gt;.&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;hr /&gt;

&lt;div class=&quot;section group&quot;&gt;
  &lt;div class=&quot;col span_3_of_12&quot;&gt;
    &lt;a href=&quot;http://www.amazon.com/dp/1782163069/?tag=coderoncode&quot;&gt;&lt;img src=&quot;http://magedevguide.com/images/3060os_cover79b6.png?1393801869&quot; /&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class=&quot;col span_9_of_12&quot;&gt;
    &lt;h1&gt;&lt;a href=&quot;https://www.packtpub.com/web-development/magento-php-developer%E2%80%99s-guide&quot;&gt;Magento PHP Developer’s Guide&lt;/a&gt;&lt;/h1&gt;
    &lt;p&gt;Get started with the flexible and powerful e-commerce framework, &lt;strong&gt;Magento&lt;/strong&gt;.&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
            <link>https://coderoncode.com/books/</link>
          </item>
        
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    

  </channel>
</rss>