Tagged: programming RSS Toggle Comment Threads | Keyboard Shortcuts

  • softwareandme 1:11 pm on September 25, 2010 Permalink
    Tags: design patterns, object oriented, , programming   

    Php object oriented programming with design patterns 

    There are some certain designs in software development like in designing an aircraft. While designing an aircraft designers use some patterns, for example there is a pattern for landing gears. They are located under the aircraft and they have supports which are joint to the fuselage. Designer does not have to design a landing gear from scratch, if it is not needed, because he knows what is the pattern of a landing gear. Patterns are like templates while designing and building an automobile or aircraft.

    Software developers also need patterns for building their software projects like in other engineering disciplines. People say that Php is not suitable for object oriented programming in their blogs, it is not true! Php gives you chance to develop in procedural concept or in oop concept. Sometimes you need procedural programming though (but dont use procedural programming a lot in your oop projects it will turn your code to spaghetti code, just use where you have to use procedural programming). I used java which is known as the most suitable programming language for oop, but when you see  a Main function to run your program people who say php is not a suitable language for oop may think about this about other oop languages like java,c++. This is not true again all of these languages try to make their job, there is not a better or worse programming language. There are programming languages which are suitable for your needs and which are not suitable.

    I use object oriented programming in my projects with design patterns they help you to solve some problems in an efficient and fast way.

    In php.net site we see some patterns like factory and singleton design patterns, this is really cool, just look at the code dont try to understand if you do not know abything about design pattern i will explain what are design patterns and when we should use them.

    class Example
    {
        // The parameterized factory method
        public static function factory($type)
        {
            if (include_once 'Drivers/' . $type . '.php') {
                $classname = 'Driver_' . $type;
                return new $classname;
            } else {
                throw new Exception('Driver not found');
            }
        }
    }
    

     
  • softwareandme 5:19 am on October 1, 2009 Permalink
    Tags: , introduction, , programming   

    php, How I met and decided to use again 

    First i heard about php in a computer magazine, when i was in high school. After that I met apache and their good friend mysql came to meeting.  Then in the university years, the good friend Slackware joined us. It was fun to code with php and python while trying to learn c. They were easy and clean languages,  php syntax was so similar to c and then i decided to use php on the web projects, c was not something i was looking for i met c++ then oop adventure started. I had some ideals and tried to develop a project for my license thesis, I used C++ in the project. It was an unsuccessfull project, so no need to mention it.

    I was a C++ programmer and learned and studied Object Oriented Programming concepts a lot more than the procedural concepts. I just used procedural concept while learining how to code in c then i used c++ and tried to learn it. I am not a C++ professional but i first met with C++ seven years ago, i developed some projects with c++ but i had to develop with java and c#. After learning c++, java was not so hard, and i have found an equatition for c#

    c# = (c+ – +) + (java)

    c# was a really easy and good language for a c++ and java programmer.

     I was coding with php for years, since high school days. Php was not an object oriented language I was not able to use classes ( i mean php 3). I was writing some basic codes with php. Some day i have seen that object oriented principles applied in php. When i was developing code with c#, php’s oop was getting more stable. I was a web developer who can code with c# , php and java using netbeans, visual studio and vim. I didnot develop big projects with netbeans or visual studio, I was developing some other coders’, who left the work, libraries.

    Java and C# did not have clean code for me and developer was not free. Performance issues were making me so mad. Netbeans/Java or Eclipse/Java is more free than VS/C#. I returned to old friend php and realized that developers really did a good work and add the oop in php in a good manner. Php has still some problems like memory management but who doesn’t ?( c# or java :)   )

    Php and c integration always makes you feel good, you know c stands under the hood and you can add more cylinders and valves to the engine if you want to do that. Developers can develop php modules of their own if they need even they can change or add their rules to the language.

    Community support is really better than the other popular programming languages and python community is a good community like php community. There are a lot of magazines, books, professioanls, sites, irc channels, conferences, companies  about php.

    After php 5 and oop, php started to run ( it was walking )  and then we have seen some scalable huge projects writtien in php. sunn’s and ms’s stories about scalability were not right about their development environments and frameworks. Good software engineers told and show ( sunn and ms and the other big lier companies ) them developing scalable and good program is not something related to the language you use, it is something related to your software design and engineering. Design comes with freedom, if someone or something is not free, design wont be there; obligations will take place instead of design and freedom. Linux also freed the php,apache and mysql and gave a good development environment to free developers. I am a really advocate for free software ( free is not related to money, it is the free in freedom ) and enjoy when i see a succesfull free software project.

    After I have finished military service and as a coincidence i found jobs related to php and meet with the oldfriend again, now as a professional i have been developing oop php for three years.

    Blogged with the Flock Browser
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.