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

Anthony Ferrara:
A Point On MVC And Architecture
December 02, 2014 @ 12:10:24

Anthony Ferrara has posted another in his series looking at MVC as a design pattern and as an idea for building web applications. In this latest post he goes on to make a point about MVC, how it relates to architecture and CRUD.

Last week I post a post called Alternatives To MVC. In it, I described some alternatives to MVC and why they all suck as application architectures (or more specifically, are not application architectures). I left a pretty big teaser at the end towards a next post. Well, I'm still working on it. It's a lot bigger job than I realized. But I did want to make a comment on a comment that was left on the last post.

He responds to the comment (essentially that CRUD is a solved problem) and where the need for customizations is needed. He suggests what the real problem is, though: the three classes of developers - CMS users, custom developers and users of both.

0 comments voice your opinion now!
mvc architecture opinion problem crud comment response

Link: http://blog.ircmaxell.com/2014/12/a-point-on-mvc-and-architecture.html

Anthony Ferrara:
Alternatives To MVC
November 25, 2014 @ 11:52:15

Following up on his previous article talking about the MVC design pattern (and the idea of "MVC"), Anthony Ferrara has posted some alternatives to MVC for your consideration. These other options are mostly variants of the typical MVC structure and could be considered "siblings".

Last week, I wrote A Beginner's Guide To MVC For The Web. In it, I described some of the problems with both the MVC pattern and the conceptual "MVC" that frameworks use. But what I didn't do is describe better ways. I didn't describe any of the alternatives. So let's do that. Let's talk about some of the alternatives to MVC...

He starts by restating some of the major issues with the typical MVC implementation (three of them). From there, he covers each of the alternatives with a summary paragraph or three about each:

He talks about the similarities between them, mainly that they're all "triads" of functionality and that they all have the same basic purpose. He also suggests that they're all "pretending" to be application architectures.

If it's not clear where something fits in your application, that's a sign that your application architecture is flawed. Not that you need to introduce some magic in to get it to work. So let's admit that none of these are application architectures... And let's admit that there is a problem we need to solve.
0 comments voice your opinion now!
alternative mvc modelviewcontroller designpattern list architecture

Link: http://blog.ircmaxell.com/2014/11/alternatives-to-mvc.html

Anthony Ferrara:
A Beginner's Guide To MVC For The Web
November 24, 2014 @ 10:42:41

Anthony Ferrara has posted what he calls a beginners guide to MVC for the web, a tutorial that introduces to you the basic concepts behind the Model-View-Controller design pattern and how it should fit in with the SOLID design principles.

There are a bunch of guides out there that claim to be a guide to MVC. It's almost like writing your own framework in that it's "one of those things" that everyone does. I realized that I never wrote my "beginners guide to MVC". So I've decided to do exactly that. Here's my "beginners guide to MVC for the web".

He starts with his first lesson, his most important one really - you don't need "MVC" (the concept, not the pattern...he notes them differently). He then gets into what the MVC pattern actually is and describes each piece and how they fit together. Following that, he talks about "MVC" as a concept and how it's different from MVC, the design pattern (hint: the pattern describes one implementation of the MVC ideals). He talks about the role of state in the MVC structure and how the implementation of the MVC idea is slightly different in the various "MVC frameworks" out there.

There is a very useful lesson that MVC brings: Separation Of Concerns. Meaning that you should separate different responsibilities into different sections of your application. Separation of Concerns is a necessary step in dealing with Abstraction. Instead of latching on to MVC, latch on to abstraction. Latch on to separation of concerns. Latch on to architecture. There are far better ways to architect and abstract user interaction for server-based applications than MVC.
0 comments voice your opinion now!
beginner guide mvc modelviewcontroller designpattern concept solid abstraction

Link: http://blog.ircmaxell.com/2014/11/a-beginners-guide-to-mvc-for-web.html

SitePoint PHP Blog:
Practical OOP Building a Quiz App - Bootstrapping
November 14, 2014 @ 13:44:09

The SitePoint PHP blog has kicked off a new series of posts today with the first tutorial about building an application with OOP and the Slim framework. In this starting article they focus in on bootstrapping the application and introducing some of the basics behind MVC and OOP.

At a certain point of my development as a PHP programmer, I was building MVC applications by-the-book, without understanding the ins-and-outs. I did what I was told: fat model, thin controller. Don't put logic in your views. What I didn't understand was how to create a cohesive application structure that allowed me to express my business ideas as maintainable code, nor did I understand how to really separate my concerns into tight layers without leaking low-level logic into higher layers. I'd heard about SOLID principles, but applying them to a web app was a mystery. In this series, we'll build a quiz application using these concepts. We'll separate the application into layers, allowing us to substitute components: for example, it'll be a breeze to switch from MongoDB to MySQL, or from a web interface to a command-line interface.

They start off with a bit about why "MVC is not enough" and how they'll be applying domain modeling as a part of the application. There's also a brief mention of the concept of a service layer and how it will fit into the overall structure. Then it's on to the code: getting Slim installed (via Composer) and starting in on the interface/service classes for the Quiz. They walk you through entity creation for the Quiz and Question instances and a mapper to tie them together.

0 comments voice your opinion now!
practical oop tutorial series part1 bootstrap slimframework solid mvc

Link: http://www.sitepoint.com/practical-oop-building-quiz-app-bootstrapping/

SitePoint PHP Blog:
Re-introducing FuelPHP
November 10, 2014 @ 10:51:23

On the SitePoint PHP blog today they've posted a new tutorial that reintroduces you to FuelPHP, the framework that was (sort of) the successor to the CodeIgniter framework. It was started by some of the ex-CI developers in an effort to make a more robust, yet simple PHP framework for PHP 5.3+.

As a PHP developer, I have been a consistent user of different PHP frameworks, mostly focusing on CakePHP. Recently, I felt the need to go framework shopping and I have many valid reasons for choosing FuelPHP. It has a built-in modular structure and complete flexibility with emphasis on community. Before Fuel, I was a CakePHP user and just like Cake, Fuel is a huge community driven framework.

The author walks you through the installation process (via the framework's own "oil" command line tool) and dives into some example code quickly after that. He shows how to create a simple "Hello World" route and generate the scaffolding (code generation for the MVC pieces) including migrations. He creates a simple "users" table and adds some authentication checking to the controller. Then in the view he sets up a simple login form, requesting username and password and outputting any errors that might pop up during the authentication process.

0 comments voice your opinion now!
fuelphp framework introduction mvc authentication example

Link: http://www.sitepoint.com/re-introducing-fuelphp/

Reddit.com:
Would you take a job where you had to use a custom MVC framework?
October 08, 2014 @ 12:57:00

There's an interesting discussion happening in the /r/php subreddit on Reddit.com that asks about taking a job if a custom framework was involved.

i recently got a new job and whilst I'm working my notice period I've been tasked to find my replacement. One of the big questions my boss has is whether a developer would mind taking over a MVC framework I built specifically for the company. (I would explain why we didn't use Laravel / Symfony / Zend etc. but that's a whole post in itself). The framework is conventional and should feel familiar to someone with Laravel experience... But at the end of the day it's totally proprietary. It's built to PHP-FIG standards and would come with full documentation. So, would you have any issues taking the job, or would you be put off?

There's opinions shared that lean both ways, but there seems to be a large majority that strays more heavily into the "no" column. They suggest that, with all of the great and well-developed PHP frameworks already out there, a custom one would probably cause more problems that it solves. While there's plenty of technically oriented comments, there's also a few that are more "high level" looking at the reasoning for taking the job (hint: it's not just about technology) and what the needs/requirements of the business are.

0 comments voice your opinion now!
opinion custom mvc framework work

Link: http://www.reddit.com/r/PHP/comments/2il722/would_you_take_a_job_where_you_had_to_use_a/

Paul Jones:
Action-Domain-Responder and the "Domain Payload" Pattern
October 01, 2014 @ 10:16:11

Paul Jones has a new post with more information about his proposed "Action-Domain-Responder" design pattern (a replacement for the typical MVC) and suggests a new piece, the Domain Payload pattern. This pattern would use a domain payload object to wrap the data and provide the responder with additional handling and context.

In Action-Domain-Responder the Action passes input to the Domain layer, which then returns some data for the Action to pass to the Responder. In simple scenarios, it might be enough for the Responder to inspect the data to determine how it should present that data. In more complex scenarios, though, it would make more sense for the Domain to pass back the data in a way that indicates the status of the data. Instead of the Responder inspecting the Domain results, the Domain should tell us what kind of results they are.

He shows a code example of this Domain Payload object in action, starting with some typical MVC code and refactoring it along the way into an ADR structure. He shifts from a typical model into a more domain-driven approach and describes the wrapping of the data in the payload, context for the contents (even just a class name helps) and how those relate to the actual output. You can find the resulting code in this example over on Paul's GitHub account.

0 comments voice your opinion now!
action domain responder mvc adr payload wrapper context data

Link: http://paul-m-jones.com/archives/6043

Reddit.com:
The purpose of a framework
September 19, 2014 @ 12:19:48

In this post over in the /r/PHP community of Reddit.com, there's a question about frameworks. The original poster wonders about the purpose of a framework and if they're a requirement to build any kind of application that's "worthwhile".

I read posts here from time to time, and Laravel and Symphony are mentioned a lot here, and I always get the impression that it is a must to use a framework, to build something worthwhile. A little background on myself is that I've always approached development in a cowboy coding style where I just code. I've made a system where I use the basic mysqli object in PHP for database interaction, and I use Smarty templating system to output the html/css/js. I build my own classes based on what the customer is asking for, and then obviously I make the controller pages calling the classes I made - manipulate the data and output to smarty. What would Symphony help me with - that would be hard to accomplish regularly?

Plenty of answers and opinions are shared in the comments of the post, ranging from:

  • Encouragement for Symfony2 and the development speed it accommodates
  • Building a project without a framework
  • The benefits and downfalls of using MVC and other design patterns you may not fully understand
  • A definition of what a "framework" means outside of the world of MVC

There's also a consensus among several of the posts that one of the major benefits of a framework is to provide an overall decrease in the time to market with the handy features and things it provides out of the box. What do you think? Head over and post some thoughts of your own about frameworks and where they fit in your development.

0 comments voice your opinion now!
framework purpose opinion reddit mvc

Link: http://www.reddit.com/r/PHP/comments/2gub3p/the_purpose_of_a_framework/

SitePoint PHP Blog:
MVC - a Problem or a Solution?
July 28, 2014 @ 11:42:36

The SitePoint PHP blog has a new post by Jeroen Meeus that wonders if MVC is a solution or a problem when it comes to developing web applications.

Repositories, Adapters, MVC with all it cousins, SOLID, RTFM… As a (PHP) developer, those words are thrown at you from every corner of the web. And I hate it, I've had enough. Stop telling me what to do and show me those kittens instead. [...] When solving the web-application problem, we are forced to use MVC. The dev community often frowns upon those who don't use it, but seldom lets those they're frowning upon ask why. [...] MVC doesn't solve the Code complexity problem. It doesn't solve the code reuse or no-flexibility problem either. And it doesn't guarantee decoupled code.

He goes on to talk about how design patterns don't "solve problems". Rather they help us as developers by providing a best practice we can follow to get the job done. He suggests, though, that MVC has become "the new Singleton" but it has been used so much in so many different ways, it's boarding on the point of being abused.

Depending on the situation, and the problem at hand, different patterns can help you write robust, secure and understandable code. Just be careful using them - if you catch yourself using the MVC pattern for a 1-pager, ctrl+a del.
0 comments voice your opinion now!
mvc designpattern problem solution abuse

Link: http://www.sitepoint.com/mvc-problem-solution/

Reddit.com:
What exactly is 'model' in MVC?
June 20, 2014 @ 11:25:48

If you're relatively new to the world of the MVC (Model-View-Controller) design pattern and its use, you may be trying to figure out exactly what each piece is. One of the more difficult relationships is between models and controllers, more specifically what each are supposed to contain. In this discussion over on Reddit several people weigh in on their opinions and own suggestions about what models should be.

Sometimes I feel I should avoid session in model ... but sometimes I feel using session in controller is putting business logic in controller which is bad ... sometimes I feel I should avoid $_POST and $_GET in model ... but sometimes I feel receiving data in controller and then send all of them to model is an unnecessary move ... sometimes I feel one model should represent almost everything about one certain table ... sometimes I feel it's almost god pattern if that table is the core of your application, but separate the model into many model is confusing too since they are using the same table. I wanna be a Model Master who can explain 'Model' very well. Who can help me plz.

Comments on the post explain models in several different ways including:

  • Thinking of it as a representation of "domain" functionality
  • Models as a 1-to-1 relationship with database tables
  • The differences between them and collections
  • Links to some helpful libraries like Eloquent and Doctrine
0 comments voice your opinion now!
model mvc modelviewcontroller opinion definition

Link: http://www.reddit.com/r/PHP/comments/28luto/what_exactly_is_model_in_mvc/


Community Events





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


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

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