Jump to content

Recommended Posts

Dear all,

 

I am about to migrate a hospital management system(HMS) from VB.net to PHP. I had a few questions regarding the implemtation of the architecture. My job is plan the system and get it implemented from a team of PHP coders. I have done some PHP coding my self but of very elementry nature.

 

1. I am planning to use 3 tier architecture. I surfed the net and found out that there are frameworks like cakephp etc, which are used for 3 tier architecture. My question is what to do, start my own framework from scratch or use the framework. If using frameworks is optimal idea then which one to use. Can anyone help me in choosing the frameworks. I would really appreciate if someone provides me with some resources, as in techical documents related to the 3 tier architecture.

 

2. What about securtity and expectional handling. Can someone provide me with some good resources for the same

Link to comment
https://forums.phpfreaks.com/topic/75995-what-architecture-to-use/
Share on other sites

If you're going to use a framework then you might as well use Zend Framework, freely available on their site. It's had a stable release so should be ok for what you're after. Bear in mind it's built on PHP5.1 and will require certain php components to be built in, so i recommend you check your server specification bofore going down that road.

 

Frameworks are really about bringing together MVC (model-view-controller) in a sample structure, but really you don't even need a framework to produce MVC code. Really all you want to do is build your model (the data controlling infrastructure to manipulate data), build your view (html+css) and then tie the two together with a controller (intialise model x and view y and glue them).

 

Security/exception handling should be done by the application. Cohere to the basic principles and you'll be fine. Restrict/escape/check user input (probably at controller level because that's where it's entered) and then hand it over to your business logic.

OOP architecture is however you design it.

Using design patterns will help you. A few to get you started would be :

 

Singleton

Factory

Strategy

Decorator

 

It really is no different from any other language because OOP is not language specific. It's a design concept rather than a language application (if that makes sense). Objects/Classes work pretty much the same in all languages now (as of PHP5 using references), so really it's up to you to create/initialise/extend your "objects" and put them together.

 

If you find yourself getting stuck on a concept or a pattern, or something you're unsure about how to implement by all means post here and we'll do our darned-est to help you out.

Unless you have a very specific need, there is really no reason to go out and build your own framework.

 

I found the Zend framework to be more of a collection of classes that help you automate things, which is nice, but there are better frameworks out there that truly automate the creation of a website and all the boring tasks.

 

I use the Symfony framework (http://www.symfony-project.com/). It creates the whole MVC architecture for you, and provides and API for many of the most commonly used ideas. If you're looking for an easy/quick platform to develop on, that has loads of features to boot (and many plugins for additional stuff) I would suggest looking at this. It does have a slight learning curve if you've never worked with an MVC framework before, but it is well worth it.

 

Of course, other people will have their own opinions about frameworks, but Symfony works very well for me. :)

My take on it is this. You don't need to use a specific architecture or methodology to develop. If you can write clean, easy to read, that is obviously efficient/solves the problem etc, adaptable, and is easy to maintain it doesn't matter what way you do it. The reason for these "formal" architectures or practices is to accomplish the above. At the end of the day its about doing the right documentation and knowledge transfer. All these architectures do is promote a lot of the same stuff I just said.

One more thing,

 

If you are migrating a vb.net app to PHP you are going to have to create a lot of code (for whatever framework).  CakePHP uses a 'code generator' type of thing.  There is a tool on my website that I wrote called DBInspector.  I wrote this a couple of years ago to generate base code for our sales app at the hosting company i worked at.  The nice thing about this program is you can create your templates using various languages, and it will generate any kind of code, whether its data access classes, website templates, input forms, output code etc.

 

I used it to generate all the smarty code for my app, as well as all the stored procedures for CRUD functions (we were using SQL Server).  It also created the DAL (data access layer) for the app.

 

http://www.websiterepairguys.com/tools/DBInspector-Code-Generation.html

 

If you download it and need help contact me through the site.

 

Regards,

Mark

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.