Just in case…
Posted by mkhairul - May 30, 2009 at 02:05:18 pm - 1 CommentCategories: blog
Just in case someone doesn’t understand my code.
function actions()
{
$projects = $this->input->post('project');
$this->_check_selected_item($projects);
$action = $this->input->post('action');
// So what the fuck does this do?
// When a form passes the value 'invoice' as an action
// (),
// $this calls for the method 'invoice' (e.g. $this->invoice())
$this->$action();
}
Designing and Engineering Time
Posted by mkhairul - May 28, 2009 at 12:05:16 am - No CommentsCategories: Books, blog, rants
Found a new book through a blog post.
Designing and Engineering Time: The Psychology of Time Perception in Software
Few interesting points:
- Response time of typical action in the application should be about 2 seconds.
- If response time takes more than 5 seconds, it is required to show a progress indicator. User should know that system is working on the task.
- If system response time is more than 7 seconds, people tend to leave web site or switch to another task. It breaks interaction flow.
Another important point is how to make a noticeable performance improvement.
If you are going to improve performance, it should be faster by more than 20%. Otherwise most people will not see the difference (it was shown in some researches that performance difference is noticeable in a range between 10% and 18%). For example, if you are improving search function with 10 seconds response time, it is required to make response time at least 8 seconds (or less).
That blog post describes it in its context of making its software, for the public, I’m not sure how it fits in my situation but I’m sure it has its place when the time permits (very tight schedule).
Learning a little every day..
Posted by mkhairul - May 23, 2009 at 10:05:37 pm - No CommentsCategories: rants
A long time ago, back when I was in college, my lecturer asked something that I can’t remember the exact question and I answered it with “I want to learn something new everyday!” (with a big cheerful enthusiasm). Everybody in the class is quiet. No one commented on my answer (every other classmate’s answer were commented by the lecturer). The lecturer just proceed with the student next to me.
That was one of the awkward moments I had in college, the other one was when I almost threw a chair (which could cause collateral damage) and yelled at someone in the class for provoking me too much.
Ok, enough of my past, how to learn a little every day?
- Make it part of your routine and give it 20 minutes.
- Think About What Interests You and Surprise Yourself
- Take notes, spend some time reviewing
Mindset
Posted by mkhairul - May 21, 2009 at 10:05:42 pm - No CommentsCategories: blog
After watching The Psychology of Incompetence by Ron Burk on youtube, I searched for more information on Fixed mindset. I found a book that might help me in learning about people and myself.
The book, Mindset: The New Psychology of Success is an interesting view of the way people think, even though it couldn’t possibly cover all the mindset that mankind have, it is still interesting by the looks of it.
Running MySQL CLI for XAMPP in Ubuntu
Posted by mkhairul - May 21, 2009 at 09:05:44 am - No CommentsCategories: Tips
If I don’t have mysql install, the shell will tell me to get it using apt-get. But when I already installed xampp, I can’t just type in mysql, I have to type in the full path to get all the databases and stuffs from my xampp installation directory.
sudo /opt/lamp/bin/mysql
Converting date format
Posted by mkhairul - May 19, 2009 at 04:05:48 pm - No CommentsCategories: code, php
I don’t know what its called, but here, we use dd-mm-yyyy, meanwhile in php you can’t convert that date into a unix timestamp using strtotime. So I have to convert it to a US date format (mm-dd-yyyy).
// Convert date format from dd-mm-yy to mm-dd-yy
function convert_date_format($date)
{
return implode('-', array_reverse(split('/', $date)));
}
Thoughts on TDD
Posted by mkhairul - May 16, 2009 at 04:05:01 am - 2 CommentsCategories: rants
I’m trying to look into unit testing and TDD, my previous experience with unit testing (and TDD) was not so good because I don’t really understand it and also the lack of mentoring.
I have to keep a lookout for TDD anti-patterns, and always remember..
Testing by itself does not improve software quality. Test results are an indicator of quality, but in and of themselves, they don’t improve it.
Using CodeIgniter in a project
Posted by mkhairul - May 1, 2009 at 12:05:23 pm - No CommentsCategories: Tips, codeigniter
So you want to use CI for your project? There’s several ways to prevent spaghetti code and it depends on the situation.
At the beginning of a project
I would advise that the lead to tutor all the project developers on how to build an application with CI. While tutoring follow a coding guideline and write some documentation, so that when you demonstrate it to them while coding, you refer back and forth to the guideline/documentation and explain why this is done this way instead of the other way. This should also encourage the developers to refer to the guideline and docs.
After a week or so, the lessons should be able to sink in, and see the progress of the developers on their coding style whether it follows the guideline.
In the implementation phase, do some code reviews (this requires discipline) until everyone gets it. All tabs is 4 spaces and is converted to space character not a tab character. I don’t mind different IDEs but the spaces must be consistent. Its very hard to read the code if its not.
In the Middle or Near the End of a Project
Do lots of code reviews. At this point of time, you’d probably don’t have a lot of time to show how to build an application with CI, so explain briefly how the structure is formatted, how things are done and designed and code. After all the introduction are done with, do code reviews.
In the end..
I’ve seen lots of variables and array abuse that makes it very hard to read code and there’s no synopsis of what it does (comments). I too am guilty of this and I try to reduce it. Hopefully with this post I would remind myself in the future that spaghetti is delicious and all but try to keep it out of the code.
GimpStyle Theme design by Horacio Bella.

