Archive for February, 2009

Introduction

OOP stands for Object-Oriented Programming. What does it mean? And what’s the difference between OOP and procedural programming? We’ll go through all these terms, We’ll demonstrate the difference of these approaches and advantages of the OOP over procedural concept. Examples are for PHP, but concept is the same in all object-oriented languages.

So, let’s start with defining, what OOP is and how it differs from procedural programming. Just take a look around. For example, you see a table. Consider you have to program it. When using procedural approach, you focus on it’s behaviour (for example, you write function, that calculates height or that assembles it from the given dimensions). However, table has properties besides behaviour. When following procedural paradigm, we create variables for each property – height, width, length, square, weight. All that data – properties (variables) and behaviour (functions) describe the object from the real world – table. What’s wrong with this approach? Nothing wrong, everything is fine, when we’re dealing with one table.
Continue reading ‘What is OOP (Object-oriented programming)?’ »

One of the ways to make your blog more search engines friendly is to take cate of your <title> tag. That’s what’s showin in the browser’s window title. By default, wordpress shows Blog name on the homepage and [BolgName] > Blog archive > [PostTitle] on the posts page (the most important to us). Best variant is to show only post title or ctegory title in the <title> tag, without any blog name. Best variant to do this is to install All in one SEO Pack and configure everything there. However, if you can’t/don’t want do this, you can do one simple change.

  1. Go to Design->Theme Editor if you have version less, than 2.7 or Appearance -> Editor if you have 2.7.
  2. Choose file header.php
  3. Find line <title>…..
  4. Replace this line with these two:
    1.  
    2. <?php if (($t = wp_title(" ", false)) == ”){$t = get_bloginfo(‘name’);} ?>
    3. <title><?php echo $t; ?></title>
    4.                
  5. You’re done!

Further reading – wordpress reference

Long journey to the framework…

I’m developing web-applications since 2004, I am crazy about nice architecture and first-class CSS+JS frontend. On the server side, I was using my framework, quite basic one. And all my projects were based on it.

In the October 2008 I finished one of my projects using my own framework. Then looked at it critically, then saw description of the Zend Framework (it had so many features, that mine didn’t!), and decided to move from my own development to the better product.

Continue reading ‘Yii – the framework of my choice’ »

Recently I’ve learned one nice trick with for loop. When you use it, you should know he number of itereations. Most people do it like this:

  1.  
  2. $a = array(1,2,3,4,5);
  3. $s = sizeof($a);//you may use count(), but sizeof if 5% faster :)
  4. for ($i = 0; $i < $s; $i++)
  5. {
  6. //do something clever here
  7. echo $a[$i].
  8. ;
  9. }
  10.  

But this requires counting number of elements before using a loop. Continue reading ‘Nice trick with FOR loop’ »

Yii is a great framework. It gives excellent built-in functionality, but, from my experience, is quite sensitive to the server configuration. Mostly because it relies on the newest technologies.

So here is a list of things to check when you experience strange things Continue reading ‘Yii framework – tips when going production’ »