News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Full Stack Radio:
Episode 3 Ruby, PHP, OO design, testing & other crap with Matt Machuga
November 17, 2014 @ 12:15:57

The Full Stack Radio podcast has released their latest episode today - Episode #3: Ruby, PHP, object oriented design, testing and other crap with Matt Machuga, with host Adam Wathan.

In this episode, Adam talks with Matt Machuga of Think Through Math about being a Rubyist who still writes PHP and the differences between writing PHP like a Rubyist vs. writing PHP like a Java developer. They also talk about common struggles when learning new things, and trying to remain pragmatic while still pushing the boundaries of what you know.

Links in the show notes include Matt's personal website, DHH on dependency injection and a book on Domain Driven Design. You can check out this episode either using the downloading the mp3. If you enjoy the episode, be sure to subscribe to their feed.

0 comments voice your opinion now!
fullstackradio podcast ep3 ruby objectoriented design testing mattmachuga

Link: http://fullstackradio.com/episodes/3/

Anthony Ferrara:
Foundations Of OO Design
October 30, 2014 @ 09:36:24

In his newest post Anthony Ferrara looks at some of the things he calls the foundations of object-oriented design, as set of three things (and principles) to keep in mind when working on OOP applications.

It's quite easy to mix up terminology and talk about making "easy" systems and "simple" ones. But in reality, they are completely different measures, and how we design and architect systems will depend strongly on our goals. By differentiating Simple from Easy, Complex from Hard, we can start to talk about the tradeoffs that designs can give us. And we can then start making better designs.

He starts with the "simple vs easy" concept and how sometimes making the two meet can be difficult. He includes an example of interdependent interfaces and how they add complexity (and, in turn, make them less easy to use). He also talks about accidental versus essential complexity and how, sometimes, "accidental" isn't always a bad thing. Finally, he wraps it up with a few principles to remember in your development including recommendations to reduce (accidental) complexity and keeping the target developers in mind, making it easiest for them to use.

0 comments voice your opinion now!
foundation oop objectoriented design complex simple developer opinion

Link: http://blog.ircmaxell.com/2014/10/foundations-of-oo-design.html

Mathias Verraes:
Objects as Contracts for Behaviour
September 29, 2014 @ 11:10:33

Mathias Verraes has a new post to his site today with an interesting idea when it comes to handling the architecture of an application: using objects as the contracts for behavior. He suggests that the objects themselves define how other pieces of code should interact with them, not necessarily external services. He illustrates with an invoice and appointment example.

Of course invoices do not pay themselves, but that's not what an object model is trying to do. An invoice exposes the behaviour of being able to be paid. That ability is in fact essential to what it means to be an invoice. The behaviour is an inherent property of an invoice. If an invoice doesn't have the ability of being paid, there's no point in issuing invoices at all. In other words, the contract of an invoice object declares that its interface includes payment as a feature. Its promise to the outside world is that it allows an outsider to pay for it. Encapsulation of state and behaviour is the core idea behind objects.

He wonders why, if this is more true to the "object-oriented programming" ideals, the idea of encapsulating procedural code as objects is so widespread. He suggests a lack of education on the subject or maybe even confusion from spoken languages themselves.

0 comments voice your opinion now!
objectoriented programming oop contract expose behavior property

Link: http://verraes.net/2014/09/objects-as-contracts-for-behaviour/

Brandon Savage:
Using objects doesn't make an application object oriented
July 16, 2013 @ 12:22:34

In this recent post Brandon Savage suggests that just using objects in your application doesn't mean that it's truly "object oriented development." There's other criteria that need to be met to really fit this description.

Lots of developers understand that object oriented code offers advantages over procedural programming. And so, they begin working on creating objects in their own projects, and eventually feel pretty good about what they've done. After all, if they're using objects, their code must be object oriented, right? Well, not exactly.

He breaks it down into three main points that developers should consider when working with OOP in their apps: splitting responsibilities between classes, being polymorphic and using dependency injection. There's no code samples to back up the concepts here, but it's a decent list to think about. There's plenty of tutorials out there about SOLID development and dependency injection in PHP apps, so you might check some of those out to help with these concepts.

0 comments voice your opinion now!
oop objectoriented development responsibility polymorphic dependencyinjection

Link: http://www.brandonsavage.net/using-objects-doesnt-make-an-application-object-oriented

NetTuts.com:
From Procedural to Object Oriented PHP
June 24, 2013 @ 12:17:36

In this new tutorial from NetTuts.com, they want to help you make the move from procedural PHP to the world of Object-Oriented PHP. They opt for the mini-project approach and show you how to make a simple Google API client.

This tutorial was inspired by a speech given by Robert C. Martin that I watched a year or so ago. The main subject of his talk is about the possibility of picking The Last Programming Language. He addresses topics such as why should such a language exist? And what it should look like? However, if you read between the lines, there was another interesting idea that caught my attention: the limitations that each programming paradigm imposes upon on us programmers. So before we get into how we could go about converting a procedural based PHP app into an object oriented one, I want to cover a little bit of theory beforehand.

They start their example with a procedural approach, showing how to make the client and make a request for calendar information. They then work through the refactoring of the example, breaking it up into logical chunks (objects) and separating out some of the logic (like view versus logic). They talk about everything from basic OOP terms out to more complex ideas like SOLID.

0 comments voice your opinion now!
procedural objectoriented oop programming tutorial introduction google api client

Link: http://net.tutsplus.com/tutorials/php/from-procedural-to-object-oriented-php

Lorna Mitchell:
A Little More OOP in PHP
November 01, 2012 @ 09:23:54

Lorna Mitchell has republished a previous article about OOP (following this entry) introducing you to some of the core object-oriented programming concepts in PHP.

This time around we'll look at some more advanced concepts and some more practical examples of building code, covering use of constructors and how to add access modifiers in to control how calling code can operate on your objects. We'll also show off how to create static methods and properties and, perhaps more importantly, illustrate applications of these features.

She talks about initializing objects with constructors, working with "statics" and using instanceof to determine the object type. Sample code is included to help illustrate the concepts.

0 comments voice your opinion now!
oop objectoriented programming introduction tutorial


Lorna Mitchell:
Introduction to PHP OOP
October 15, 2012 @ 11:56:06

Making the transition from the procedural PHP world into the object-oriented world of some more complex applications can be difficult. It requires a shift in thinking that might take some learning. Lorna Mitchell has posted an introduction to some of the common concepts.

Since the introduction of PHP 5 in 2004, PHP has had an object model worthy of that description and became a truly modern language for use on the web. [...] Using OOP (Object Orientated Programming) enables us to architect our systems much more clearly, and to make them more manageable and more maintainable. This technique also allows us to separate form from function to create clean, navigable codebases with plenty of opportunities to reuse code, apply design patterns and bring in concepts from other brances of computer science.

She covers some of the more common pieces you'll need to know to start venturing into OOP in PHP including: objects versus classes, using properties/methods, inheritance and access modifiers. Some sample code is included that works with user records in a database (along with the SQL to create the tables).

0 comments voice your opinion now!
introduction objectoriented programming class object


Chris Morrell's Blog:
Introducing Zit, an object-oriented dependency injection container
March 23, 2012 @ 12:57:43

In his latest post Chris Morrell introduces a project he's been working on to help with his dependency injection needs - Zit, an object-oriented dependency injection container similar to the Pimple DIC from Fabien Potencier.

I'll admit right now that I'm fairly new to the world of dependency injection containers. I usually do my dependency injection "manually" and have always thought that there must be a better way. Then I came across Pimple, which is a wonderfully simple solution to the problem. The only thing about it is that I hate its array-oriented interface. Something about $container['session_storage'] rubs me the wrong way.

The Zit tool should be very familiar to any user of Pimple, as it implements similar functionality, just in an OOP kind of way. He includes some example code in the post showing how to create a database connection object and inject it into the Zit container. You can find the latest code for the tool over on github.

0 comments voice your opinion now!
dependency injection container zit objectoriented


Freek Lijten's Blog:
Book Review - Growing Object-oriented software guided by tests
March 12, 2012 @ 13:57:57

Freek Lijten has a new post to his blog - a review of a book (from Freeman & Price) called "Growing Object-Oriented Software Guided by Tests". It's based on Java, but the ideas presented can be applied pretty universally.

It may seem strange but I'd like to start out with giving my opinion on this book: It is brilliant! If you don't like reading my post you at least know what you should do next: buy the friggin' book. The book offers some theory concerning agile development, (unit-)testing and code quality but its killer feature is the almost 200 page long example of developing an application the TDD way! In the rest of this post I will shortly highlight different parts of the books and stuff I enjoyed or learned from it.

He breaks up the review in to a few different parts - the process of test-driven development, his "first real lesson", their working example and a section about the more advanced topic of sustainable test driven development.

0 comments voice your opinion now!
objectoriented tdd testdrivendevelopment software book review


Gonzalo Ayuso's Blog:
Runtime Classes. A experiment with PHP and Object Oriented Programming
August 08, 2011 @ 09:17:05

Gonzalo Ayuso has put together an experiment related to the current OOP structure of PHP - a test working with runtime classes, a structure generated entirely when the script is executed and not predefined in the file.

Last week I was thinking about creation of a new type of classes. PHP classes but created dynamically at run time. When this idea was running through my head I read the following article and I wanted to write something similar. Warning: Probably that it is something totally useless, but I wanted to create a working prototype (and it was fun to do it).

His class is pretty basic - a "Human" object that echoes a "hello world" sort of message via a "hello()" method. He creates the classes inside of different test methods to ensure that his assertions are true. The tests check basic output of the "hello()" method, calling undefined methods, testing inheritance and a test creating and evaluating a dynamic function.

For something more complex, he creates a dynamic class that solves the FizzBuzz kat, a popular programming puzzle. You can find the full code for this and his other examples on github.

0 comments voice your opinion now!
runtime class experiment objectoriented oop fizzbuzz



Community Events





Don't see your event here?
Let us know!


release framework laravel library conference symfony tool security opinion series artisanfiles introduction voicesoftheelephpant version community composer list language podcast interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework