SPA server side framework - php

I am developing a new page and can not decide witch server technology I should use. I will try to describe as best I can, what I am making and hoping someone will have some advice for me.
The choice I have to made is PHP vs ASP.NET and in case of ASP.NET MsSQL vs PostgreSQL.
I must say I already spend a few months comparing and experimenting with this 2 products (and know both for many years, but for small projects).
So if I get to the point:
My web page will definitely be SPA. I don't intend to change some div content to achieve that, but open different content in dialogs or if you know KendoUI windows.
Everything else could be adapted to the selected framework. I don't plan to have many different views, but those few will heavily depend on data from database. The core of my page will be one view bind to a table with few 10/100 thousand records.
I am using jQuery to get data from server. I started with PHP, but it soon became very large project, tons of files for handling users, roles, access to file system, managing database, quering database, editing database, handling different language support... I use try version of zend studio which is great framework (you get debugger which is a little bugging from time to time) but can not compete with visual studio.
I also read on internet that all big sites (except SO) use PHP because they started small and when they became big there is no way to migrate to different server technology.
I get problems with requires files (there are to many) if I include from index.php there is different path that from AjaxCall/ProcessLogin.php. I always forgot to include some file and get unexpected result in client. ASP.NET would solve this problem. I huge disadvantage is also unknown types in PHP. I call function which return array of objects populate from database and I don't know nothing about object structure, but when using LINQ to SQL I know everything. It bothers me also that can not have 2 functions with same name and different parameters. LINQ to SQL is also amazing. And so on. Those who use both of them, you can say what advantages has developing in Visual studio c# over Zend studio in PHP.
I know (from what I read in past months) that PHP will get me better performance, that sometimes could be slower because of the interpreter. Again, I just use functions to get some data and on client side use telerik KendoUI for rendering contents.
My questions that I can not answer myself is is ASP.NET the right choise if I don't plan to use any other feature then [WebMethod] (any server side events, ASP.NET controls...)? Probably I should go with ASP.NET Web API or ASP.NET single page application? I read tutorial how can I call method with jQuery. I also found this thread. But I need to decide if I stick with PHP and do some hard work for stuff that I mention up, or I should use ASP.NET, get some really nice stuff on account of performance.
I must say that cost are not the problem. Hosting windows server, Visual studio ...

tldr; use PHP's Laravel Framework, it's a very good framework to start and it grows with you. Also it's heavily influenced by ASP.NET and Rails, just for the PHP world. Build your REST API with laravel and use jQuery for the AJAX stuff. Querying the database (e.g. postgres) with Laravel is amazing, just write something like User::where('age', 21)->get();.

Check spa-cart.com
Already much features with PHP SPA CMS

Related

PowerBuilder and PHP

Please excuse my distinct lack of knowledge in this field. Software development is not my forte.
I am currently about to commence work on a project of which there is a large system built using PowerBuilder with an Oracle Enterprise database to serve the data up.
I want to build a nicer interface for the system and believe it is possible to use web technologies (my background) to do so. Can anyone confirm if it is possible to use PHP with PowerBuilder or is there a way in which I can interface my build with PowerBuilder?
I don't think there is a "good" way to incorporate PB & PHP but if there is a will there is always a way.
One unusual but possible way of mixing the technologies might be to write an IIS handler with PowerBuilder.NET, or you could build the handler using Visual Studio and call a PowerBuilder .NET Assembly from the handler. I find it is easier to build the handler using Visual Studio myself because I had problems getting PB.NET to inherit from HTTPHandler or using the .NET interface. Doing this would be like re-inventing ASP.NET as it basically just processes .ASP files and kicks out HTML/Javascript/CSS,etc and you'd be writing a handler for a different file extension (say .pb or .powerbuilder) and spitting out your favorite web code based on what filename and/or arguments you used in the URL.
I made something like this not long ago just to see if I could do it and it wasn't too difficult. Eventually I'll post the code on my PB blog. I've seen another implementation of something like this using CGI which is older technology, not as good as using a handler for busy sites.
Again this probably wasn't the answer you were looking for but it is an answer. Good luck.

BackOffice Database Application FrontEnd - Program in C#/VB.Net or PHP?

I'm working on a project where there will be a MySQL database containing data that will mostly be displayed on the web using PHP. However, there is a need here for a back-office data entry application (linked to the same MySQL database) that is feature rich and easy to use.
what I'm trying to understand is where we are at with web-based frontends. I find that there are still so many events and features that I can make use of in a Windows Desktop GUI written in something like C#, VB.Net or MS Access. I don't have a lot of experience programming UI for web but it's my impression that it's still more difficult and takes longer to get similar or the same functionality using non-MS web technologies (I dislike ASP.net, sorry) as compared to programming the desktop portion in a traditional desktop application language like C#, VB.Net, or MS Access.
jQuery and jQuery UI are definately making things easier. Also, there's very rich online applications like Google Docs and Zoho but it's my impression that these are programmed by some of the top web UI programmers around, not to mention that it takes longer to write it and intensive testing to make it work in all of your target browsers. It also takes extra time and code to "block" browsers that don't meet the requirements.
What programming language would you recommend?
I know I may not have given enough information here but I'm not sure what I'm missing. If you have questions just leave a comment below so I can edit this post and answer the questions.
I think, the important decisive parameter in your case is:
who is going to use the end?
TRUE: almost anything can be implemented as a web application these days and web applications are the future while desktop applications will become the exception
TRUE: the obvious challenges of the web are still the same
In your case, if the end you're talking about is for internal use and just a few selected persons are going to use it plus you are more fluent in desktop application development... the choice seems obvious to me.
If on the other hand there is a chance that a bigger number of people in many locations with different computer systems are going to use the end, make it for the web.
You say you know VB.NET, well where's the problem... you can write your aspx pages in VB.NET, can't you?

Php-Django Chimera: is it possible?

I've seen a lot of posts about switching from php to Django but none have covered this. I have a website that is built entirely in php (php 5, mysql, and apache2). This site is used only for collecting data from users. Now I need to make a second half of the site to display the data. This will be step 2 of 5 in the overall plan, and I'd rather not keep using php. I was wondering:
How hard would it be to run a Django server (hopefully on the same computer) that would serve data from the php based database?
Could python classes (inheriting from django.db.models.Model) be formed to get the data from the php database?
Could Django authentication be used with the preexisting users table?
Cheers.
Chris
Python and PHP can be run from the same server just fine. There may be performance issues on heavy loads when mixing mod_php with mod_pythong/mod_wsgi though.
Much of Django is based on its own ORM. So you would not be getting the full benefits of Django if you're serving data from a database built outside of its ORM unless you changed the schema to match directly. But to answer your questions:
The easiest way to do this would be to use django's auth system and then migrate your current users to django.

How much languages is "recommended" for a dynamic website?

When constructing a website, say a Q&A site or a just a forum site for a community, is just knowing HTML,CSS,PHP, MySQL, and javascript enough to make the site dynamic?
I am saying this because when I talked with my teacher, he said that major sites use many languages combined. And he said that a site shouldn't be designed only in PHP.
So is it possible to create a good website, not e-commerce, with only html,css, and php?
yes. there is no reason you should use more than one language internally. it makes making it all work together much easier in a server environment, where the extra load of IPC over function calls can slow things down considerably.
Ofc! :)
Lots of large/enterprise portals use only HTML, CSS, Javascript, PHP & MySQL.
But don't forget that there's always a right tool for the right job... A simple site (even an e-commerce) will run very well on PHP & MySQL.
Short answer: yes, it is possible.
Longer answer...
HTML, CSS, PHP and MySQL are already many languages, but I guess he means that most major sites have a heterogeneous back-end. This is probably not out of choice though -- more often it is historical. As people change and new technologies emerge, new pieces are built with different languages and frameworks.
I have built a forum and Q&A sites with HTML+CSS+PHP+MySQL and many other people have done the same, so this set of tools is without a doubt adequate for building something like this. In fact, I would argue that you could build almost anything on the web with that combination.
A more interesting question (that will generate more heated response) is what framework you use on top of that. A CMS like Wordpress of Drupal, or an MVC framework like Zend, CakePHP or CodeIgniter.
Or whether you should be dropping PHP entirely and using something like Django or Ruby on Rails. Knowing more than PHP will definitely help you to be ready for newer approaches.
The dynamism of a website comes from a server side language that can create a HTML output on the fly, that's it. You can add a DB, simple JS or AJAX, but those are merely optionals.
Now, as for your teacher, languages like PHP, Python and ASP are, in the end, the same. It's ridiculous to have the includes files in ASP, the main files in PHP and the configuration files in Python, that makes absolutely no sense. Maybe, hopefully, he was talking about using JS in conjunction with PHP and SQL which is a natural recommendation.
The fact that your teacher is obsessed with another technology doesn't mean that you can't work with PHP only.
As the others said, it is perfectly reasonable and possible.
(I'm personally obsessed with ASP.NET, but still, I won't say that it is the only way to go for everyone. And PHP is just geat for beginners.)
Is he referring to the front-end or back-end?
The front-end of a website - the part that the user sees and interacts with - must be written in HTML.
(It may optionally include CSS and Javascript to enhance it.)
The back-end is what generates the front-end, and also determines the structure and control-flow of the application.
There's absolutely no need to use more than one language for the back-end, and it's often simpler to stick to one language.
However, for the front-end, you have no choice but to use HTML; otherwise it isn't a web application.
The front end must output HTML. These days it should use CSS for formatting. It will likely use Javascript to provide client side capability. Requiring javascript will likely create accessability issues for some users.
PHP is one of several languages used to handle requests. It is in interpreted language requiring the source be placed on the server. This opens up significant security risk if the someone gets access to the server. Several hosting sites have had major problems with PHP based sites over the last few weeks.
Java is run in a compiled form and code is not required to be on the server. This provides a layer of security as it is not simple to modify the code. Java runs in a container, and usually a framework. Developing using the Spring framework in a Tomcat container is an option. The learning curve is higher than with PHP. It also has strong support for accessing remote resources which allows it to integrate with legacy applications.
With any of the languages, there is a risk that developers will use available functionality when they shouldn't. The Java J2EE model is appropropriate for some sites, but was often implemented because it was the fashion, and there are a lot of tutorials on using it.

Migrating technologies: PHP+MySQL -> ASP.NET MVC+MS SQL 2008

I have a completed web app in PHP 5 + MySQL. I have not yet started its conversion, but it will migrate to ASP.NET MVC + MS SQL 2008. I'm not sure how to progress for the easiest transition:
Edit the PHP DAL for SQL Server. Migrate to the new db immediately
Leave the live code alone. Create ASP.NET MVC with a MySQL DAL to use for now. Migrate to new db later
Leave the live code alone. Write the new version entirely. Transition db and code at the same time
Is there some common wisdom for which path is best to take?
Edit: addressing Dave's question:
How are you accessing the database? If you have really good separation
between your code and database and are using stored procedures it would
probably affect the answers given.
None of the ASP.NET MVC stuff has been written at all. There will have to be some changes to make the current PHP data layer work with MS SQL. I'm currently taking advantage of some PHP+MySQL stuff that doesn't exist with PHP+MSSQL. Nothing major but it will take some amount of retooling. My data layer is sufficiently separate that I hope it won't be too invasive.
Also what's your release plan? Will you be forced to release incrementally
or do you plan on just "flipping the switch" one day?
Flipping the switch -- it's just a hobby site for my family. But I'm not opposed to leaving 1 db and both code sets live for a while until I feel confident that the new one is fine.
Edit 2:
Looks like my options are limited more than I thought. You can only use PHP's native MSSQL functions for SQL 2000 and before. For 2005+ you need to install MS provided drivers. I'm on el cheapo shared hosting so I can't really ask them to install drivers for me. Looks like I unfortunately have my answer :(
The purists will suggest starting with TDD so you can have a gauge of when the migration is fairly complete by having all unit tests pass.
However, I would suggest that you start with the app from scratch in ASP.NET MVC as it's very different from a non-MVC PHP application. I'd map the data layer first and build some models then work my way up controllers and the view. The data models should be fairly easy to migrate if you use the visual studio surface designer.
An easy way would be to use an Application generator.
There are many available like:
- Iron Speed Designer (only supports ASP.NET)
- Code Charge Studio (supports many different web scripting languages like PHP, ASP, ASP.NET, Pearl, etc.)
I have tried out both. But have not been satisfied with any as they have not documented the MVC/MVP part to extent that it becomes easy for developers to modify generated code.
Iron Speeds Designer MVC is better compared to CCS but ISD will prove to be costly as it supports only one set of technology while CCS supports many and one can add support for new language with a little support from its developers.

Categories