What wastes your time as a PHP'er?

A little survey:
As a PHP developer, what typically wastes your time? That is, what is stopping you writing features 100% of your day?

To be a little more objective, and avoid the thread becoming a rant, there are three actual questions:

  1. What is the last non-feature thing you did? Could be right now, ten minutes ago or whatever. However small.

  2. What was the biggest hold up so far this week? Something where you were out of action for 2 hours plus. A bad rollout, difficult bug, training, working around a framework, figuring out how something poorly documented worked, a long meeting. Anything you want, but at least a couple of hours of delay. Name and shame dud libraries.

  3. What typically wases your time? You can rant on this one.

Please answer all three before adding comments of your own (preferably in a separate follow on post). If you think too long about it, then you are probably getting too subjective. Try to add your reply before reading other peoples, as reading first will bias things.

I’m going to compile them at the end of the thread. I’ll add my answers later so as not to bias anything. I have a deeper discussion point to bring up, but I’ll do that later.

yours, Marcus

Note to moderators: I’m after PHP answers here as I want to relate it to code later. Please don’t move the thread out of the advanced PHP forum.

PS: sorry to hear about the new work environment :frowning:

Hi Marcus

My client can’t use version control. Well he could but I decided not to insist on inflicting esoteric programmer’s tools on him. That sometimes makes site updates harder from my end because I first have to upload anything with shared authorship to a temporary folder and then do some diffing. Any changes made by my client have to be copied back to my own (version controlled) files manually. There aren’t that many though so it’s not too bad. It’s pretty rare that this would create a significant amount of work. A bunch of shell scripts help to automate much of the process.

Ashamed to admit it… but lack of acceptance tests :blush:. I did most but skimped on others due to the usual time pressures when the site was first written. I should know better, I always regret it, and I am now because I’m scared to add some new features in case I break something. They’ll be held up until I sort out the tests. On a commercial site you really can’t afford to make any mistakes.

Skiving off to play my guitar (11mb) probably… Music is another thing, like programming, which can devour all your time.

Work related: subscribers who can’t log in. It usually turns out they just forgot their proper password but I still have to go on red alert painstakingly checking through the code for bugs which don’t exist, manually checking every new subscription as it comes in, and so on.

It’s not a regular problem though. In fact, I very rarely feel that my time is being wasted. I get on well with my client - I sometimes spend New Year with him and his family - so I guess that helps. It’s a small team of two and I think we both appreciate what the other is doing.

  1. What is the last non-feature thing you did? Could be right now, ten minutes ago or whatever. However small.

Currently we are stripping out our current view generation layer and making the themes directory configurable. The old browser driver mocked driving the browser using debug but this is no longer needed as we have a selenium adaptor to run the old tests. The old method relied on swing like widgets to generate debug that the test runner used to validate usage. Like a lot of widget systems it relies too heavily on inheritance( 4-5 levels deep ) and ends up being a code merry go round. The code really sucks in the views as well.

I have been playing with this for a fortnight now making the theme directory configurable( 3000 theme files ) involving 500 file changes( though admittedely some structural indulgance such as adding interfaces to make publicity more followable ).

Without the high test coverage at all levels (plsql/php/browser) the lack of clarity in the evolved design would probably ear mark it for termination. Too obtuse, never know what will blow up.

  1. What was the biggest hold up so far this week? Something where you were out of action for 2 hours plus. A bad rollout, difficult bug, training, working around a framework, figuring out how something poorly documented worked, a long meeting. Anything you want, but at least a couple of hours of delay. Name and shame dud libraries.

Mostly network stuff and cvs playing buggers. 2 days to merge and commit. Hardware currently is remote and we are looking to get a local oracle server and web server.

  1. What typically wases your time? You can rant on this one.
  1. Really sucky error handling. This is evident in a lot of projects (such as the code for stagehands autoloader just tries/or just used to include the file failing silently) leaving an xClass does not exist message with no include path showing etc. Those sort of autoloaders are worse than require once by a mile. That sort of error handling is rife and leads to a game of var_dump through the code base. When I find something I add a thrown exception with a meaningful friendly explanative message so if it does occur again it is traceable. Each thing should only make 1 person pay the cost of chasing their tale for everyone. If you chase your tale and do not try to help the next person you are part of the problem.

  2. Over reliance on a registry for communication. Hashmaps are getting pretty much banned as like registries in their rawest form they lack design in their interface. Large code bases are much more sensitive about communication in their design and using bucket approaches is just lazy. var_dump/print_r should not be an often used necessity. It is boring and lazy.

  3. Unit testing done wrong. With a code base where 10+ peoples ideas of unit testing cohabit there is some real just plain badly written tests. I have followed the agile community quite closely on this as the claim is it speeds up development which it can do if the the code follows the single responsibility principle and the objects are light. What starts out at 1.2 or so lines of test per line of code can end up at 6+ lines of test per line of code. Get given a small change and the forcible choice is refactor getting this fatness down of have to create 400 lines of uninteligable meandering mutterings of assertions. And we are talking about a small little ‘if’ here and an extra parameter not anything major.

I believe if a test is not readable it is partially worthless, it also likely has holes in it.

I think there is a metric somewhere if you hit two lines of test per line of production code then it is time to analyze design and maybe have a rethink. It will only get worse over time without diligence, if you have to rely on others for it the bigger the team the more bad design gets reproduced in all the monkey see monkey do.

I like unit testing, it leaves things maintainable. Whether it is a dog to maintain is another metric. I like the Boy Scout rule (http://www.informit.com/articles/article.aspx?p=1235624&seqNum=6) but it is something everyone has to adhere to otherwise it is like swimming upstream.


It might sound like hard work but I moved to a new team that is branched off so this stuff can be tackled. Before hand it was 10+ projects all on branches of the framework with no hope of being merged in. Each new project duplicating the design errors of the past. Make an improvement and then make it another 9 times while 9 other people repeat the same pattern of what has been removed.

Current project plan is to remove the duplication of effort as it kills productivity stone dead. 3.5 load factor is acceptable but is currently 6+, getting it back to 3.5 is a nice challenge.

Without a bit of pain this job would be boring, as long as that point of pain is not repeated over and over and is marked for death at some point it is manageable. I give things a few years of effort though before starting to mentally mark points of stagnation down heavily leading me to move.

Even though a large part of the issue is the framework design without some precedent of design it would further resemble chimps scatting. The code before framework and TDD is just locked away where only a few people are allowed to touch it. PHP 4.2.4, register global variables, all the best old school type of PHP party where the motto is “I want to do it MY way and I want to do it NOW and it will look like the creation of someone on too much methamphetamine as that is an accurate representation of my genius. My genius is just not understood, only I can code this byzantine. I AM L33T”

It is quite a good and sanitising game working out what drug consumption would produce certain pieces of code.

Hi…

The funny thing is, you didn’t do the sort before the unique. It might be worse than you think :).

That would be brilliant.

yours, Marcus

Repetition all over the place, the incredibly dumb tendency to be “smart” and use what other people considered “smart”, such as singletons. There were no tests, at all. None. There is zero documentation. The API sucks, the database has well over 100 tables, while it could probably do with less than 10. Mixing languages together. Did I mention repetition?

When it comes to repetition, I can show you something that illustrates:

berry@pc:/www/project/controllers% uniq controller.php | wc -l
810
berry@pc:/www/project/controllers% cat controller.php | wc -l 
849

In that controller, “sections” and “subsections” are defined in an array, which is not the controllers’ task at all. I shouldn’t mind that much, I could just move it. Hah, but wait… The array is redefined in local method scope three times. Lots of copy and paste programming back in the ol’ days. Another nice example of what my “model” looks like:

berry@pc:/www/project/model% cat model.php | grep "function" | wc -l
94

Now, normally I wouldn’t mind this: I stick classes which closely relate to one another in a single file, so 94 methods is not entirely uncommon, if I had quite a few related classes. In this case however:

berry@pc:/www/project/model% cat model.php | grep "class" | wc -l
1

That’s 94 methods in one single class. 94 methods. Well. Luckily I have the deal with myself to always leave code cleaner than I found it, so most of the repetition will be killed, and a lot of tests will be added.

I said more than 5% :wink: I try to be as productive as I can, and one day differs from the next, but I do try to keep it up and stay in the coding-spree for as long as I can. Truth be told though: there are days I can’t even get in it.

The process here is good, I think. I like the way I currently work, and so do my co-workers and customers. We hit deadlines, and things are clear and apparent. Version control, unit-testing, automated deployment scripts, I think the process is better than at several other companies around.

The tests cause me to write more. Then again, it also allows me to sleep at night, knowing that our tests pass, so there are no known bugs in the software that is used by a lot of people. It gives confidence and allows for easier refactoring in the future, if necessary.

The documentation causes me to write more too. I write three different kinds of documentation: first, the functional specification, which usually takes up a lot of time, but it makes for clear communication between us and customers, and it definitely gives you a guide-line, so that you know when you’re done and, ultimately, can send your bill. It also provides a clear image of what exactly has to be done, and - in the words of Joel Spolsky - it’s easier to change text than it is to change code.

The second type of documentation is system documentation: the kind of stuff I’d let new employees read to get a grip of the general workings of the system.

That’s very dependent of the project at hand, of course. Older projects cause me to read a lot more, because of the lack of documentation and the lack of readable code. I think the current project (which is an old one) is about 30% of reading, 20% of writing tests so I don’t ruin anything, 20% of improving (DRY’ing the code) 30% of writing new features. I never clocked this though, so I will do so today, and hopefully let you know later.

I don’t grep that much, really. I have an IDE and a step-debugger. I do read logs when I don’t get what’s going on, and I (usually) write tests before I start hacking at the code.

That’s an adventure, a challenge :wink:

Took a bunch of code out of my own “framework” because for the first time I am using it for a public only system (no authentication, no database). Still works exactly the same for the most part, just less lines and less complication.

Copied some code between projects that basically groups database results alphabetically, showing the letter above each result set.

Rather than slowing down and thinking about how well it will work in this new implementation, I dumped it in, spent about 90 minutes trying to bend it to work, before finally giving up, re-thinking the strategy and getting a finished result in 30 minutes.

Client communication :injured:

Besides that, trying to mold every feature request into something that is re-usable and flexible for other purposes. I hate the idea of writing code I can never re-use.

Lastly, I probably try to do way too much in each method, which means when I want to extend something I have to repeat too much code.

I mentioned a couple. I’ll dig out some specifics tomorrow at work but there are a few general ones I come across

-Having 2 controller functions doing pretty much identical things to cater for insert/update and containing lots of repeated code. Any change in the logic needs to be made twice. Adding a field? Add it twice. :frowning:

-As an extension, having multiple similar update functions which are used on a switch()/if() depending on a specific type. Polymorphism obviously isn’t liked by some people.

These aren’t a fault with the MVC implementations themselves (though I have an issue with that by php developers as a whole, see links in sig :wink: /plug) but by (trying to…) deploying MVC some people seem to then loose sight of other issues such as reusing code. See the queries I posted earlier. I’m sure if they were coding how they were actually used to they’d have thought it through a bit more and made a function to generate the query parameters. It seems that people learn a new concept, in this case MVC try to implement it but then forget about other things.

One of the previous developers LOVED huge sprintf() statements like that. I see them everywhere in his code and they are the bane of working on it. Trying to match up the parameters is not an enjoyable task.

That’s begging for a code snippet.

Well I don’t know if i can do that without posting all the framework code for something :stuck_out_tongue:

An an example, one time it looked like urls were auto-mapping like this (and they were for most of the site!):

/controller/action/arg/arg/

So the client wanted something changing on

/clothing/

I figured I’d open up clothing.php from the controllers directory. The file didn’t exist.

After stepping through half the front controller code, I found out that it was loading a (rather large, i might add!) XML file which contained every possible route to every controller action it then looped through each action segment and matched to the url using preg_match() (and didn’t even break when it found the right one!). A nice, unnecessary overhead both for the server and me working out where I need to look. Turned out the /clothing/ url mapped to a controller called “shop”. Which was a nice waste of half an hour or so.

What I want to know is what makes something legacy code.

I’d say when nobody really understands how it works and it cant be updated without someone having to learn how it works first :stuck_out_tongue:

On any large, long-term project I’ve worked on there’s always large pieces of code people daren’t touch because they’re hacked together, messy and incomprehensible. Generally it gets to the point where it’s easier and faster to rewrite it than to try to fathom the inner workings of it.

Hi…

Any specific gotchas?

That’s begging for a code snippet.

That’s a different thread. What I want to know is what makes something legacy code.

yours, Marcus

I could have, but for some reason I didn’t here. I probably should, in retrospect.

Not really. We found out that there needed to be a new field of data, so we couldn’t have known in advance. The problem here though, is that each time a task “changes hands”, there is an overhead of ensuring everything is taken care of, that the quality is acceptable etc. Things get mighty complicated when there are multiple providers involved in a solution.

Well, in all fairness, these things should probably not be perceived as obstacles to being productive. Defining what has to be done is often part of the process. In fact, I would probably find my job a lot less interesting if it weren’t.

Hi Tom…

In summary then… :slight_smile:

  1. Bad naming. I can’t fathom what all those prefixes mean (s_ for session?).
  2. Pointless marshalling.
  3. DRY is an alien concept.

All very obvious.

Mainly though it’s the very large number of beginner coders within the PHP community. In this case a Zend certification might have actually helped.

What would you do different next time? A code sample from the dev beforehand? The dev had a plan (however deranged), so they would probably have talked a good game over the phone.

How do we help businesses to recognise bad code? assessthiscode.com? An online script that can calculate some simple code quality metrics. Hm…that’s an idea actually :).

yours, Marcus

Took me about 3 or 4 hours in total. Time which otherwise would have been spent not doing anything nearly as productive. It will allow sites to far more easily control the elements that go into the site template. Previously it was all a bit messy essentially, it was a class which initialised a template, accessed datamappers directly and passed values to the template. Messy and non-=eusable code. Admittedly, in most cases not an issue but for those edge cases, especially where the template is not the same every time, it was always a bit hacky getting everything working as it should.

Aha! What is causing you difficulty understanding them? Conventions or the lack? Poor APIs? Surprises?

This is the stuff I’m after. Can you post some snippets of stuff that has caused you some head scratching?

All of the above :stuck_out_tongue:

Thought I’d post something quite basic. Here’s a login script: http://pastebin.com/SWnRj5Vj

-Non-descriptive variable names
-Horrible template engine requiring lots of binding logic
-developer kills me every time by renaming arbitrary variables during bindings $_SESSION[‘user_id’] = $s_rec[‘cid’]; In another script he actually does this: $t_values[‘_email’] = $s_rec[‘email’]; for about 20 fields… mostly just adding an _ but arbitrarily renaming enough fields to make it so I cant replace the whole block with a function that automatically prefixes an underscore to all the array keys.
-the if-else nesting is annoying to follow. In the shopping basket page ther are eight levels of nesting and nothing is broken up into functions.

Guess when this code was written… go on… guess. I’ll tell you: 2008. It was written by a freelance developer the company hired about 6 months before I started here.

Of course, this is just a classic example of spaghetti procedural code.

Guess what directory that’s in? /uplds/php/login.php

The login.php which is actually accessed by the browser looks like this:


<?
include 'config/config.php';
include 'config/include.php';

$page_name = basename($_SERVER['PHP_SELF']);

if(isset($_GET)){
	$gtp = $_GET['gtp'];
	$_SESSION['cfp'] = $_GET['cfp'];
	header('Location: ' . $gtp);
} else {
	header('Location: index.php');
}
?>

That’s it! The entire thing. There is a page like this, which does nothing for everything.

For every php page there is a file which looks like:


include 'config/config.php';
include 'config/include.php';

$page_name = basename($_SERVER['PHP_SELF']);

include 'inc/std_page_prep.php';

echo $page->output;

It’s identical. Exactly this, in 50+ files.

Heh, that’s just one I’ll post about a slightly better one later.

edit: i just came across this gem and had to post it:



 mysql_query (sprintf ("INSERT INTO drivers
                             SET firstName='%s', lastName='%s', nationality='%s', dateOfBirth='%s', birthplace='%s',
                             residence='%s', profession='%s', maritalStatus='%s', hobbies='%s', favouriteTrack='%s',
                             website='%s', sponsorText1=%s, sponsorLink1=%s, sponsorText2=%s, sponsorLink2=%s,
                             sponsorText3=%s, sponsorLink3=%s, sponsorText4=%s, sponsorLink4=%s, sponsorText5=%s,
                             sponsorLink5=%s",
                             htmlentities (addslashes ($this->data->fields->firstName->value)),
                             htmlentities (addslashes ($this->data->fields->lastName->value)),
                             htmlentities (addslashes ($this->data->fields->nationality->value)),
                             $this->data->fields->dateOfBirth->value,
                             htmlentities (addslashes ($this->data->fields->birthplace->value)),
                             htmlentities (addslashes ($this->data->fields->residence->value)),
                             htmlentities (addslashes ($this->data->fields->profession->value)),
                             htmlentities (addslashes ($this->data->fields->maritalStatus->value)),
                             htmlentities (addslashes ($this->data->fields->hobbies->value)),
                             htmlentities (addslashes ($this->data->fields->favouriteTrack->value)),
                             htmlentities (addslashes ($this->data->fields->website->value)),
                             (strlen($this->data->fields->sponsorText1->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText1->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink1->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink1->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText2->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText2->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink2->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink2->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText3->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText3->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink3->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink3->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText4->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText4->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink4->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink4->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText5->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText5->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink5->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink5->value)) : 'NULL')));

of course later in the page he does this:


 mysql_query (sprintf ("UPDATE drivers
                             SET firstName='%s', lastName='%s', nationality='%s', dateOfBirth='%s', birthplace='%s',
                             residence='%s', profession='%s', maritalStatus='%s', hobbies='%s', favouriteTrack='%s',
                             website='%s', sponsorText1=%s, sponsorLink1=%s, sponsorText2=%s, sponsorLink2=%s,
                             sponsorText3=%s, sponsorLink3=%s, sponsorText4=%s, sponsorLink4=%s,
                             sponsorText5=%s, sponsorLink5=%s
                             WHERE id=%s",
                             htmlentities (addslashes ($this->data->fields->firstName->value)),
                             htmlentities (addslashes ($this->data->fields->lastName->value)),
                             htmlentities (addslashes ($this->data->fields->nationality->value)),
                             $this->data->fields->dateOfBirth->value,
                             htmlentities (addslashes ($this->data->fields->birthplace->value)),
                             htmlentities (addslashes ($this->data->fields->residence->value)),
                             htmlentities (addslashes ($this->data->fields->profession->value)),
                             htmlentities (addslashes ($this->data->fields->maritalStatus->value)),
                             htmlentities (addslashes ($this->data->fields->hobbies->value)),
                             htmlentities (addslashes ($this->data->fields->favouriteTrack->value)),
                             htmlentities (addslashes ($this->data->fields->website->value)),
                             (strlen($this->data->fields->sponsorText1->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText1->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink1->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink1->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText2->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText2->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink2->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink2->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText3->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText3->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink3->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink3->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText4->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText4->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink4->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink4->value)) : 'NULL'),
                             (strlen($this->data->fields->sponsorText5->value) ? sprintf("'%s'",htmlentities (addslashes ($this->data->fields->sponsorText5->value))) : 'NULL'),
                             (strlen($this->data->fields->sponsorLink5->value) ? sprintf("'%s'",addslashes ($this->data->fields->sponsorLink5->value)) : 'NULL'),
                             $this->data->fields->id->value));

ahhh the code i have to work with.

Hi…

What concrete differences are there? If you look back at your old code, what were you doing wrong?

It sounds like you have everything mostly under control, process wise. Hats off to you for being 95% productive!

I’m going to press though ;).

In a perfect world you’d write just a single line of code to add a feature (kind of). What causes you to write more? What caused you to need the documentation? You demand readability, so you are spending a lot of time reading old code, yes? What proportion are you spending reading to writing? Do you grep much, read logs, write tests?

I’ve just moved from a super productive environment (it took 8 years to get it there) to one…er…less supportive.

yours, Marcus

  1. Refactoring our “page template” class (though I kept it backwards compatible :slight_smile: ) and how it interracts with the controller for the current request.The code was about 3 years old and had grown horribly because it wasn’t flexible enough. Still missing a few minor features but the code base is now about a fifth of the previous size and much easier to understand. It now initiates a proper MVC stack rather than trying to do everything in one class. Was something on my to-do list for quite a while. Finally had some spare time.

  2. Well this is entirely non-php related but required my expertise (nobody else would have any idea how to do it :frowning: ), luckly I don’t have an awful lot of work at the moment. Our designers use a NAS drive to store all their library images, psds, illustrator files and whatever is they work with :wink: over the weekend we had a power cut which killed the motherboard on it. I ended up taking it apart and plugging the drive into a pc only to find out it was using the XFS file system. Our only linux box is a fairly old machine we use as a development server, it doesn’t have SATA. I ended up downloading knoppix, plugging the drive into another PC and sorting it out that way. Fun stuff! Now they have a UPS and a RAID1 NAS :stuck_out_tongue:

  3. This might need context: I work in a very small team whos work mainly consists of many small-medium sized sites. Some of these were developed years ago (the company has been going 15 years and we have a few sites around that age) by people who no longer work here (and left before I started!). Many of these sites use some rather horrible bespoke frameworks that I despise working on. There’s no documentation, of course, and I’m constantly left wondering whether any thought at all went into them. Funnily enough, some of the newer ones (~2006+) are the biggest causes of my frustration. I mentally mark them down every time I have to use print_r(get_included_files()); or debug_print_backtrace(); to work out where something is happening.

Checking out various PHP Orm tools, suffers from same syndrome as “make a blog in 5 minutes” syndrome - the examples designed to give an overview of the capabilities each Orm’s capability rarely provide the necessary insight into the implications of utilising the proprietors solution. Been looking at Redbean, PhpDataMapper, Outlet and CoughPHP. They all have really interesting features - but I’ve noticed a lack of an Identity Map (or have failed to find how they implement it).

Company is in a transition phase, working on increasingly complex and development heavy projects - current paradigm not evolved enough to cater for common/contemporary development practices. Problem 2 and 3 kind of related.

Hi…

1: Strangely familiar. How many pieces of 3rd party code are you evaluating and how many of those will you eventually use? What stops you making a rapid assessment?

2: Rails/Ruby has Capistrano/Vlad/Rake. Does the PHP world need something similar?

3: Log your time fixing stuff then moan about it somewhere. “I spent 2 hours fing XXX 'cos it broke yet again”. Eventually 2 days of refactoring will seem cheap. It’s a long haul though.

yours, Marcus

System documentation. Just finished, decided I should get a reward in the form of coffee and a read-up on Sitepoint. Before writing the documentation, I had a meeting with a customer to determine what should be in the next version of the application we’ve built (prioritizing). In the rest, today was about adding features.

Todo-lists. Mondays are my set time to plan features, bug-fixes, and other related tasks, such as setting up the project’s environment. Creating the todo list generally does take me a while, but it does give me the benefit of knowing where my team stands in every given project, and I know if I’m going to deliver the software on time.

The second most time consuming non-coding activity has to be reading code. Although my current code seems to be pure logic to me now, the 5 years younger version of me wasn’t that keen on writing documentation, doing proper normalisation, keeping code DRY and readable, refactoring or having decent and up to date specifications.

I’ve learned a lot over the last five years, and the thing I’ve learned the hard way is that there is a huge difference between writing software and writing decent software, in terms of readability, but documentation just as well. I now wish I knew this five years ago.

Phone calls, customers, co-workers, but mostly: me. I know, this all sounds very self-critic, but to be fair, it’s me who usually busts out of the coding spree to do something else, just to crystallise my thoughts or to relax a little. You know, have some coffee, a smoke, a walk around the neighbourhood.

More than 5% of my day is not spent on “pure coding”, but doing things that aren’t entirely related, such as reading blogs, and taking breaks. I don’t necessarily think that is a bad thing though, quite the opposite. I think it helps me keep up with current developments and broadens my view on programming and problem-solving on a whole.

It also helps me relax, which is also a very real requirement to write decent code, at least to me. If you’re not relaxed enough (maybe even a little stressed), you’ll feel pushed to write code. Just writing code without thinking about it ends up in tragic code that makes no sense, you might as well take a little time off and write decent code that does make sense. The overall cost will be lower in the future.

That’s not all though. Unexpected interruptions are extremely annoying and usually bust my coding-spree. If I take a little time for myself, I stop coding at a point where it makes sense: when feature X is tested, built, and documented. Customers, co-workers and telemarketers unfortunately don’t have the gift of sensing whether or not I’m at a “save point” at that time, which means that once the nuisance is gone, I’ll have to get back in the coding-spree, which takes a lot of time.

I’ll edit this post, probably, I might have to think this over a bit more. I’m interested to see what my fellow-PHP’ers have to say about this topic.

Creating some apache mod_rewrite magic to free up a few IP addresses. We have rather alot of domains (including domains for people who can’t spell).

I am currentlly redeveloping the corporate offering of my company’s main product (corporate.myringgo.com). Having spent a day or two writing new features, half a day refactoring, now waiting for our C developer to update the “business logic” in a few modules. And waiting, and waiting.

  1. Tracking down issues for our support team. Typically involves searching log files, writing SQL queries, breaking out the L.A.R.T.
  2. Documenting stuff on our internal wiki.
  3. Getting sign off for rolling out new code. We use a simple svn update which takes about 5 seconds, however our procedures take around 4 hours.

Reading through the documentation for one of our providers, customer data is held by an outside company

Persuading the server guys that they hadn’t finished setting up our new dev servers, took about 2 days altogether

I’m been doing a lot of short term contacts over the last year, major beef for me is corporate IT departments, everything is so glacial. Given up moaning about lack of documentation and tests, when they exists it is like Christmas.

Hi…

No direct numerical comparisons will be made. This is a discovery exercise only.

What I’m hoping is that I’ll get enough information for the next post. I need about 20 replies, so lack of data is a problem at the moment.Check out the narrative capture links earlier if this peeks your interest. In the good old days of this forum I’d have probably collected that much in a few days.

The “me too” aspect is a problem, as that can skew things. That said, resonance is still useful.

yours, Marcus