jacopo beschi: yet another web guy

Design pattern Archive

SOLID Design principles and Php: Single responsability

Created at: Jan/23/2014 jacopo beschi

Hello guys, this is the first article (of 5) About SOLID design principles. Solid design principles was written by Uncle Bob Martin with the objective to help building quality code. But how can you say that you have written good code? You could say: when the code works its good code, but in fact that's not; in fact the biggest quality of software are that it's easy to replicate and easy to modify.

Read on

Active Record Design pattern

Created at: Jan/15/2014 jacopo beschi

Hello folks, in this article i'll briefly explain the Active record design pattern. Active record is one of the data access pattern which helps you to map your domain model (Object) into Relational Database. Basically with active record, every istance of your class correspond to one row in a table of the database (one to one relationship). The active record basic usage consist in extending the abstract active record class from your model class. With this pattern the biggest advantage it's simplicity, in fact this pattern is used in many ORM, for example Laravel ORM Eloquent, Yii ORM, FuelPHP ORM or Ruby on Rails ORM. I'll show you how that works with a simple example.

Read on

Php class table inheritance

Created at: Jan/07/2014 jacopo beschi

In the previous article i talked about Single table inheritance which is one of the four ways to map inheritance into RDBMS (Relational Database Management System). As stated in the other article this pattern comes from Marwin fowler PoEAA Book. In this one we talk about Class table inheritance. Class table inheritance is an approach that consist in creating a table for each class in the object-model.

Read on

Php Laravel Single table inheritance

Created at: Jan/06/2014 jacopo beschi

As i came into OOP (Object-oriented-programming) i started to learn the concept of "Inheritance". Inheritance itself is a cool stuff, but problems come when you need to save that object structure into a relational database: for example Mysql. This article is one of a series that will explain the best-practise approaches to solve that problem.

Read on