Posts tagged with "programming"

My thoughts on management & time tracking

So I’ve talked about time tracking before, however that was much more a “Keep yourself on track / how to know what to bill per hour as a freelancer/contractor”. Today I’d like to share some thoughts on bigger companies and my feelings toward management and time tracking there.

I’ll preface all this with “these are my opinions, I’m not saying I’m entirely correct here, this is just how I personally feel“.

As a programmer I love my craft, I spend hours playing around with new technologies, learning new languages and wrapping my head around computer science concepts. I’ve always known programming would be my career from a young age, finding it amazing that people would pay me to do what I love to do anyway. 🙂

What I never realised back then is how much of a programming role involves no programming at all. Meetings can be a daily occurrence, eating into your time, understandable though as things do need to be decided on/signed off.  Managers need you to explain all sorts of stuff to them so that they can sound informed to whoever it is that they report to. Clients want you to explain why you can’t add five new features by next week. Customers want you to explain how to use things (and occasionally need you to fix things).. Priorities must be juggled. 😀

All of the above I don’t really have an issue with, they are mildly annoying but to be fair, necessary evils.

What I do have an issue with however is time tracking on top of this in large organisations, usually so your manager can have some form of chart showing what their team have spent their time on the last few weeks. Of course this would all be possible without disturbing the programmers workflow at all  (since we all have issue management systems) but the word “granularity” starts getting thrown around and the next thing you know you’re now in JIRA logging hours on tickets trying to justify where you spend every minute of your day.

I honestly don’t get it.

I feel as a developer getting told to do this makes you feel that you are not trusted to manage what little time you have to do programming yourself. That you’re possibly under performing and need to work harder. Or that your time isn’t as valuable as the managers time. All in the name of a granular report that probably gets a courtesy glance at and then binned.  It definitely doesn’t create a happy team environment.

If you haven’t read Programmer Interrupted, I recommend that you do, but I’ll just include the results of their study here:

  • A programmer takes 10-15 minutes to start editing code after resuming work from an interruption.
  • When interrupted during an edit of a method, a programmer resumed work in less than a minute only 10 percent of the time.
  • A programmer is likely to get just one uninterrupted two-hour session in a day.

These are the problems that management should be trying to solve, not trying to interrupt a programmers time further by requiring that they log each and every hour that they’ve spent on each feature.

Another great article that discusses how programmers see time different to managers is the Makers Schedule.

Where I currently work (Kobas) actually deals with all of these things I’m complaining about very well. For a start there is no time tracking (making me very happy), we have a daily slack stand-up (i guess its more sit down?) where we give a few sentences of what we worked on yesterday and what we plan to do today. It’s very helpful for knowing what other people are up to without wasting time doing an actual stand-up.

Interruption wise at any point i feel I need to have an uninterrupted session I can pop in my headphones and unless something explodes I never get interrupted. Meetings for me are rare but when they occur they have an actual purpose. Developers != Support leading to less interruptions, of course I have to fix problems that come up from support but I’m not personally being interrupted by support requests.

So its certainly possible for companies to function well in these ways, why more big companies aren’t is beyond me. ¯\_(ツ)_/¯


Posted on August 29, 2016

Easy Caching with StashPHP

So short post this time, I swear I’m not dead, just busy!

Frequently with PHP you are going to need to cache things, mostly expensive SQL queries, but also data you aren’t going to want to be inserting into the database on every page hit, for instance website statistics.

With PHP we have a few options to achieve this;

  1. Caching with the file system.
    •  Upsides:
      • Works well with the Opcode cache
      • Usually the fastest method of caching for small or medium websites
    • Downsides:
      • Clearing the cache can be a lot slower as you will have to recursively search through path’s and delete.
  2. Caching with SqlLite
    1. Upsides:
      • Can be substantially faster than a full-blown RDBMS
      • All data is stored in a normal file in the host’s file system.
    2. Downsides:
      • Can only support one writer at a time, which can cause high file system latency, which is inconvenient if there are many clients trying to access it simultaneously.
  3. Caching with APC
    1. Upsides:
      • Makes PHP faster for you through the so called opcode caching.
      • No special configuration required.
    2. Downsides:
      • Practically none
  4. Caching with Memcached
    1. Upsides:
      • Allows machines to pool their memory together as one large memory cache, perfect for large websites.
      • Cross platform and cross RDBMS
    2. Downsides:
      • Stores data in the RAM, not ideal for small systems
      • Is considered to be a volatile in-memory key/value store
  5. Caching with Redis
    1. Upsides:
      1. Can act like memcached as a key/value store however it’s really a data structure server.
      2. Persistence to disk, by default.
      3. Values up to 512MB in size
      4. Built in clustering
      5. Extremely fast at everything
    2. Downsides:
      1. The more objects you put in it, the more memory its going to use.

So as you can see there are a bunch of different systems that handle caching in arguably better or worse ways depending on how big your website is. Putting a small website on Redis is probably overkill,  you might already have set up a RDBMS solution and now not want to change to a key value store etc.

This is where StashPHP comes in, you basically use the StashPHP library to cache things like so:

First you setup the driver to use, lets just use File System for the moment:

<?php // Create Driver with default options $driver = new Stash\Driver\FileSystem(); $driver->setOptions(array());

// Inject the driver into a new Pool object.
$pool = new Stash\Pool($driver);

Now you can setup your by wrapping the following code around your code:

<?php // Get a cache item. $item = $pool->getItem('path/to/item');

// Attempt to get the data
$data = $item->get();

// Check to see if the data was a miss.
if($item->isMiss())
{
    // Let other processes know that this one is rebuilding the data.
    $item->lock();

    // Run intensive code
    $data = codeThatTakesALongTime();

    // Store the expensive to generate data.
    $item->set($data);
}

// Continue as normal.
useDataForStuff($data);

Now rather than later on when you decide to add another cache, rather than needing to go rewrite all your caching calls etc. you can just change the setup of the drivers like so:

<?php $subDrivers = array(); $subDrivers[] = new Stash\Driver\Apc(); $subDrivers[] = new Stash\Driver\FileSystem(); $subDrivers[] = new Stash\Driver\Memcached(); $options = array('drivers' => $subDrivers);
$driver = new Stash\Driver\Composite($options);

$pool = new Stash\Pool($driver);

Presto, we’ve just avoided a nightmare!


Posted on September 07, 2015

Software I’m using to track tasks & time

So lately I’ve been trying to manage my time better, with countless personal projects and legacy applications to support I find not properly tracking what I’m doing to surprisingly be more of a waste of time than tracking my time, even when you take in the time lost by tracking said time.

Firstly, I already use Trello for organizing my tasks across bigger projects,  I’m pretty sure most people do, it’s one of the best task management tools for things that are just general planning rather than bugs. For managing bugs I’m using JIRA or Github Issues depending on if the project is open source or not. I’m generally trying to do as much open source as possible lately. For more general tasks I’m using Todoist, which I recommend checking out if you haven’t, it has a very clean and simple interface.

So with all that in mind I set out to find an application that could potentially work with all of the above as well as give me time tracking. Handily enough I found Toggl, which is completely free until you want to export invoices etc, which I don’t really have a need for right now.

Toggl just takes all the hassle out of time tracking, after installing it’s browser plugin Toggl integrates with most task tools. Github issues, JIRA, Trello, and Todoist just to name a few.

So not only do they make it really easy, but how they actually output your data is really handy also:

toggl

 

I recommend you all to give it a try and let me know how you find it..

Another one for any of you programmers is WakaTime:

Wakatime Screenshot

Wakatime allows you to install a plugin in your IDE of choice, pretty much all are supported, it basically reports on what programming languages your spending the most time using. Their graphs aren’t as pretty as Toggl’s but I still enjoy them! 🙂

 


Posted on March 29, 2015

Being a PHP Developer in 2015

This is just some thoughts on being a PHP developer in 2015;

A standard web project before used to just require you to setup a local web server, and then you’d upload to a standard web host with some worries about PHP versions perhaps but little to no thought required for the server side of things.Frameworks were a new thing, CodeIgniter was (to me at the time) the best thing to happen to PHP,  introducing me to PHP MVC patterns, easily integrated vendor libraries (I never got into Zend Framework) and Twig.

Now a web project involves using programs such as Composer, Bower and Grunt just to manage project dependencies. Then you have PHP & JS frameworks like Symfony, Laravel,  AngularJS that have really made life so much easier for us developers. Of course this all comes at a cost of having to put in time into learning all these new frameworks and tools, but the benefits of doing so are just amazing; development time goes way down and you create much better products. I wish I could further go into the benefits of each but they all require posts of their own to really get across their individual uses, I’ll attempt to get to that!

Working with UNIX servers is pretty standard for most web developers now, myself included. I’ve been using DigitalOcean for all my hosting, they really are a great host and I recommend them to anyone searching. Anyway a tool I found lately for server management which I guess is what has caused this post is Ajenti, before this I was using ISPConfig for the aim of being able to manage my servers easier than via ssh, however I found it’s interface pretty clunky and just overall slow, always ending up in ssh. After testing Ajenti in a fresh droplet I changed completely over to it on my other servers, so far it’s been amazing, I’m still using ssh here and there but overall Ajenti has really solved my problem so thanks guys. The install was amazingly simple too I recommend anyone looking for a GUI for their server to check it out.

So there seems to be a lot more to PHP web development now in 2015 than there was just a few years ago, though I personally feel all of it is for the better, making my life easier. It makes me wonder what it will be like in another few years though, whats next? 😀


Posted on January 27, 2015

WordPress – Shortcode in PHP files

So in WordPress with plugins etc. you end up using shortcode in posts to keep things simplier, an example would be if you want to display a gallery you would just use:
[galleries id="1"]
However trying to this when your outside of the “WordPress Loop” [in your theme files usually] you will hit the problem that WordPress won’t parse the shortcode. So whats the soloution? Super simple just append the following to your shortcode:
echo apply_filters('the_content', '[galleries id="1"]');
Presto, it works!

To read up more on shortcodes in WordPress click here.


Posted on September 11, 2011

Why I’m learning Perl

So this post may not be to everyones taste, its more a post to remind myself why I’ve decided to learn Perl. If anyone doesn’t know I already know PHP and some Java.

Perl is a programming language, It’s Object Oriented, simple to learn and very powerful. Perl stands for: “Practical Extraction and Reporting Language” but others have come up with many more interesting and colorful names for it;
Perl is “the little language that could” it’s designed to be able to do as many tasks as possible in as little time as possible.

“A good perl program is one that gets the job done before your boss fires you.”
Larry Wall, the creator of Perl.

Perl is an Interpreted language, so you don’t have to compile it like you do Java, C, C++ etc. For fast development work, that’s a godsend.

Perl has been successfully used for a lot of diverse tasks: text processing, system administration, web programming, web automation, GUI programming, games programming, code generation, bio-informatics and geneological research, lingual and etymological research, number crunching, and testing and quality assurance.

Perl Pros:

  • Cross Platform compatability. A perl script for linux/unix will work just as well in windows and vice versa, and the only exceptions to that rule are those dicticated by the operating system itself. (for example file paths are different in windows and unix.)
  • Online support. Perl has been around since the early 90’s, its exceptionally well known and thousands of tutorial and help sites abound on the internet.
  • CPAN.org, a massive collection of perl modules that can do almost anything, someone has usually done the work for you.
  • Taint mode, this helps you to write secure code by not trusting any data provided by the users until you have tested and declared it safe.

Perl Cons

  • Speed. Apparently with a very large program [Like word or something] the  sheer size of it would make it extrememly slow to compile at runtime.. This is the only Con I’ve found about Perl!

 


Posted on August 19, 2011

Another Re-Design

I_Hate_Eggs_by_Eibo_Jeddah

Image Above ©2010 =Eibo-Jeddah

So here we are, four months into 2010 and I couldn’t stand another minute of looking at the old design! So presto its gone! We are currently using the StudioPress Theme, which has quiet a nice feel to it I think! I have also added a Services page listing Services I can provide and estimate costs..

Other than that we have a contact page up thanks to a handy plug-in Contact Form 7. And we’ve finally gotten around to enabling the “All in One SEO Pack” so hopefully now we’ll get some more “related” traffic!

Currently doing alot of work with Prestashop, but can’t say much on that at the minute, but hopefully by the end of the month I can get a few posts on Prestashop up as well. Other than that just waiting on Microsoft Dreamspark Support to get back to me for a free trial for XNA Game Studio..


Posted on April 07, 2010

Programmer Personality

Just took an interesting test on “What is your programmer personality?” It is based of the Myers-Briggs Personality Test and has been changed to relate to your programming personality type.

Your programmer personality type is:

DLSB

You’re a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.

You like coding at a Low level.
You’re from the old school of programming and believe that you should have an intimate relationship with the computer. You don’t mind juggling registers around and spending hours getting a 5% performance increase in an algorithm.

You work best in a Solo situation.
The best way to program is by yourself. There’s no communication problems, you know every part of the code allowing you to write the best programs possible.

You are a liBeral programmer.
Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We’re not writing on paper anymore so we can take up as much room as we need.

Find out what kind of programmer you are here!


Posted on November 09, 2009

Google Delivers New Java-like Language: Noop

Google Noop
The developers over at Google have come up with Noop, a new language that runs on the Java Virtual Machine.

“Noop (pronounced ‘noh-awp,’ like the machine instruction) is a new language that attempts to blend the best lessons of languages old and new, while syntactically encouraging industry best-practices and discouraging the worst offenses,” according to a description of the language on the Noop language Website.

Noop supports dependency injection in the language, testability and immutability. Other key characteristics of Noop, according to the Noop site, include the following: “Readable code is more important than any syntax feature; Executable documentation that’s never out-of-date; and Properties, strong typing, and sensible modern stdlib.”

Read More

I suppose your thinking why another language? Google explain this:

Our experience has been that developers often create code that’s hard to test and maintain, without realizing it. On a large software project, this can create problems later on for the whole team. In analyzing this problem, we found that the root cause in many cases was language features – like globally visible state, misused subclassing, and API’s that are easily misused. Noop will try to avoid these problems.

Noop avoids these problems by being opinionated, meaning it pushes you toward using good practices while developing software. It does this by;

Noop saying Yes to Noop saying No to
  • Dependency injection built into the language
  • Testability – a seam between every pair of classes
  • Immutability
  • Syntax geared entirely towards readable code
  • Executable documentation that’s never out-of-date
  • Properties, strong typing, and sensible modern standard library
  • Any statics whatsoever
  • Implementation inheritance (subclassing)
  • Primitives
  • Unnecessary boilerplate

I’m still only learning Java myself, have to this year with the course. But I hope to mess around with Noop sometime soon in the future! 🙂


Posted on September 23, 2009

Snipt.net – Store your Code Snippets Online

Recyclable Code

Often when your programming well you find yourself with a lot of reusable or recyclable code. Everyone has their own little way of keeping all this code and organizing it etc. etc. for their next project. However today I found a great website now that I need my code snippets in more than one place, Snipt.net . Not only can you store all your code privately with the ability to tag it and have it highlighted. But you can browse through the public code also, for when your really stuck with that problem! 😉 This will certainly be a website I’ll be adding to most used for ’09


Posted on September 18, 2009

Learn PHP: Class Three, Includes and Requires

Today we are going to learn all about include and require! Include and require are handy to use not only in your php applications, but in general website design for sidebar’s and what not! So.. yeah.. 😛 Moving on!

Include and Require include a file within another PHP script. There are four ways of doing this:


include();
include_once();
require();
require_once();

Now using them is seriously simple. Lets say you have a file called “sidebar.php” with your links? All you have do do is the following:

include('sidebar.php');

One thing to remember is how to traverse directories in PHP. For instance, if my file “sidebar.php” is in a folder called “includes” you could go:

include('includes/sidebar.php');

Or another approach, if my file “sidebar.php” is in the parent directory, you could go:

include('../sidebar.php');

Now why are there four different ways to include them I hear you ask! Well they are pretty simple.

Include and Require are practically the same, apart from the way they give out errors. Include will continue parsing your script and just shove out an error. Require however will stop the whole script to give you an error. Really it’s all down to what you want.

Include_once and require_once you probably guess only allow you to include the file once. This is not only more secure but stops from silly errors where the file was just included and variables were overwritten halfway through the script. Again they give out the same errors as include and require.

So lets go over one of each!

include('sidebar.php');
include_once('sidebar.php');
require('sidebar.php');
require_once('sidebar.php');

We really are spoiled for choice aren’t we! 😉


Posted on September 16, 2009

Programmers Day

Interesting Fact:
Today, it is “The Day of the Programmer”. Since yesterday this has been made an official Russian holiday!
The Russian president only made this yesterday as seen here..

The day of programmer will be noted on September 13 (in 256- y the day of year), if year is bissextile – on September 12.

What is Programmers Day?
Programmer’s day is a whimsical “holiday” on the 256th day of the year celebrated mostly by computer programmers (reason: 256 = 2 to the power of 8 = the number of values representable in a byte of data). Traditions include drinking, behaving silly, coding silly programs, mini computer games, playing with old computers, etc. Programmer’s day usually falls on September 13th; on leap years, it is September 12th.

Why the 256th Day of the year?
A byte can have 256 possible values, bytes are very important to programmers. Not because they are required for programs to work, but because the payroll system and Krispy Kreme doughnut cash registers require them.

Irish?
We need to get onto Brian Cowen to make an offical holiday out of this!  😀


Posted on September 12, 2009

Learn PHP: Class Two, Ifs And Elses

Moving on to PHP’s If Else Statements.

Here is one in action:

if ($condition) {
echo 'condition is true';
}

Simple enough? To start with as you can see you first write the statement name, in this case “if”. Then you enclose your condition in brackets, [A condition is essentially a question you ask PHP.] then you add an opening “curly bracket”. The opening curly bracket basically defines the start of the code to execute of the condition of the statement evaluates to true. In this case we are wanting PHP to output the text “condition is true” if the condition is true. Then finally we have a closing curly bracket.
In the above example the entire condition has simply been set to the variable $condition. Therefore what we are asking PHP is does the variable $condition exist, and if it does, does it have a value that is not NULL. [Null = Nothing, zero, zilch] In this case we didn’t actually define the variable $condition therefore the statement will evaluate to false and the code within the statement wont be executed. Therefore the above will output nothing at all. However the following code:

$condition = "Here!"
if ($condition) {
echo 'condition is true';
}

Would output “Condition is True”.

Now if statements are pretty useless on their own! What you really want is if / else statements, which we will look at here!

$condition = 10;
if ($condition == 5) {
echo "condition is 5";
}

Basically here the variable condition is 10. PHP Checks if it is 5. As we all know 10 is not 5, so PHP does nothing. However in this statement:

$condition = 10;
if ($condition == 5) {
echo "condition is 5";
} else if ($condition < 5) {
echo "condition is less than 5";
} else {
echo "condition is $condition";
}

We have an if statement, an if else statement and an else statement.
Basically the code explains it, but the condition is 10. If the condition is 5, PHP will output that it is 5. Otherwise if the condition is less than 5. PHP will output that it is less than five. Lastly, if nothing matches in the if or else if statements PHP will output its else. Saying Condition is 10.

A last sample before we head off.

$condition = "yes";
if ($condition == "no"){
echo "condition is false";
} else if ($condition == "yes"){
echo "condition is true";
} else {
echo "Something happened to the variable";
}

Here you can see that the condition is actually a word. PHP checks it just like it would a number and outputs all the same. Here PHP would output “Condition is True”.

And that’s it for today! Next week we have “arrays” so until then practice! 🙂


Posted on August 28, 2009

Learn PHP: Class One, Echos and Variables

So now that we have done the Prep Class its time to move on to the actual learning!

Echoing:

echo "text here";

OR

echo 'text here';

Simple as that, thats how you get PHP to output some text. Whichever you use is really up to you, there is pros and cons to what you can do with each, you can read about them here.

Comments:
Comments are really important within any programming language, really to tidy up your code and so you remember what each bit does later on. PHP supports two different ways of commenting, C++ Style and Shell style. I will just stick with C++ Style for today

Example’s of echo’ng via C++ Style are as follows:

echo 'Hi'; // Output: Hi
echo 'Hi'; /* Hi */

// Comments out the rest of the line. While /* */ lets you comment as far as you want, just remember to close the comment! If you don’t get me I’ll do a quick example:
This will stop PHP echo’ing “Hi”


/*
echo "Hi";
*/

This however will not.

//
echo "Hi";
//

But this would

//echo “Hi”;
/* style are obviously much easier for commenting out blocks of code. But for just adding a quick comment // style is alot better!

Variables:


$variablename = "Variable One";
$variablename = 'Variable One';
$variablename = 1;

Variables are vital within your programming language, you will use them over and over again! Again, you can use single or double quotes, both with their pros and cons, you can also use numbers, or other variables. I’ll give you a quick example of adding within variables.

$add = 2 + 1;

That variable would add 2 + 1. But how to get what the Variable says? Well you just use echo again!

$add = 2 + 1;
echo $add;

The output of that would be:

3

Nothing more, nothing less.
You can also add variables within variables. As complicated as that sounds its pretty easy. I’ll give you a quick example.


$one = 1;
$two = 2;
$add = $one + $two;
echo $add;

So lets go over what we just learnt with a quick script;

$name = 'Sean'; // My Name
$age = 16 +1; // Seventeen!
$nextage = $age +1; //Age I will be next year.
echo 'Hi my name is ';
echo $name;
echo ' and I am';
echo $age;
echo 'but I will be'
echo $nextage;
echo 'next year!'

Of course that is probably the longest, but easiest way you could do it! The faster way to do it would be:


$name = 'Sean'; // My Name
$age = 16 +1; // Seventeen!
$nextage = $age +1; //Age I will be next year.
echo "Hi my name is $name and I am $age but I will be $nextage next year!”"

That’s defiantly the handiest way to do it! Don’t worry I’ll go a bit more into that in the next lesson! Until then, practice!


Posted on August 21, 2009

Learn PHP: Preparation Time

Nearly two or three times every week I get someone asking me to teach them how to program, many of these are from an online game I help out with called Injustice. Its amazing really that people that there is some hidden secret to coding and that I can just send you a link or say one or two lines and they will be able to code! I’m telling you people, its not magic!!
So instead of repeating myself over and over I’m shoving this article in here! Mainly because of this, secondly because I believe people can learn PHP a little easier than some of the websites make it. So on with the show!

Ok, so to actually learn PHP the best way to do it will be to install Xampp.

You can download Xampp here.
Xampp will install Apache [Webserver] MySQL [Database] and PHP among other things, but that is all we will be using! Once you download the file, run it, its a graphical installer for windows.

For linux users, I’m sure you can work out how to install it! 😉

Once installed start the Apache and MySQL services, the control panel will be in front of you, all you have to do is tick the boxes! Yep thats it, your done installing.

Now, to put files into your “webserver” you will go into C:/Xampp/htdocs/ if you installed it in the default directory. So lets create a folder called project. And put a file called index.php in there. In the index.php file just put the word “Test”. Then all you have to do is go to, http://localhost/project/index.php and if you did everything right you should be looking at a webpage that just says “Test”. There you have it! You are ready to learn PHP!


Posted on July 07, 2009