Related
I'm deciding on a web framework for an upcoming project, and I'd appreciate any advice. We've decided to use jQuery for the JavaScript, and are heavily leaning toward Python or PHP (more Python) for our server-side logic. I'm especially interested in web2py because of its jQuery integration.
About our project
Our project is to develop a security console for a complex
cybersecurity system operating within an organization's internal
network.
This console will be largely server-driven, as messages come in from the network and must be pushed by the server to the user.
The user will also be able to initiate security actions, the implementation for which will likely be in C++.
The interface we've planned will be relatively rich, and I want to leverage jQuery's power as much as possible.
We have some control over the browser environment we'll be running in (e.g., we don't have to worry about clients with JavaScript disabled).
Our site is likely to have only a few, long-lived client connections.
We are looking for software components with permissive licenses, though we're using some copyleft components (I see that web2py is LGPL while Django is BSD, so +1 to Django)
We have about a month to create a functional demo of our system, of which this interface is a small (but visible) part.
About us
We are two developers with about 5 years of programming experience, but little web development experience. I have several years of Python experience and a summers' worth of experience messing around with PHP. My coworker has some Python experience and has never touched PHP.
I used Django once back in 2008, and was frustrated by the file and code structure, which I found highly unintuitive. Perhaps this structure is inherent to the MVC model (I've had similar experiences with Django and CakePHP since), and I just need to bite the bullet and memorize it.
My Question
Given the information above, what are the relative advantages of the various Python/PHP web frameworks for our project? As mentioned above, I'm especially interested in web2py because of its jQuery integration, though Django's dominance is (once again) hard to ignore.
Thank you very much for your time!
Before deciding on a framework, you should first decide if you want to commit to a language you are unfamiliar with.
You said you've both got minimal PHP experience, so you have to weigh up the advantages here; Will the pros for going PHP (if any) out weigh the amount of time the developers will need to spend to retrain?
(Although depending on your background experience, PHP should be very easy to pick up.)
If you frame it like that, PHP would have to have a pretty convincing offering to give you. From what I'm seeing, specifically Django vs web2py, they both seem very close in functionality - which is good, but doesn't provide the "you must use x!" scenario you may be after.
However, If you will be bringing more people in later and feel finding people to work with web2py will be difficult, it may tip it to PHP. You said your self, Django's popularity (and BSD license) is hard to ignore, and it should make it easier to find people for later expansion.
If it were me, in your shoes, I would go with web2py. Assuming the development team will continue to be Python focused for the foreseeable future.
Python vs PHP: Python
With python, you can always write wrappers for C code so you won't have to mess with starting other processes and passing args to them. That might be useful for your security functions.
Web2py will allow you to easily write a webservice for this too, to more easily integrate the C portions with the web-site infrastructure.
If you already prefer python, I would go with that. If you need to bring on web-developers later that are trained in PHP, teach them Python. It won't take long, and I'm sure they'll appreciate it in the long run. Plus, moving from a PHP MVC framework to web2py or even django would make things easier. I've used CodeIgniter for PHP and find that web2py was so much simpler and easy to understand.
Also as for the directory structure, django is not actually true MVC -- it's MTV (model, template, view).
I find web2py's organization a little more straight-forward. But yes, either way it can seem strange at first. I would say YES, you should bite the bullet and use MVC.
In web2py, the "view" is html markup with the ability to write raw python code. The controller extracts data from the model (database), attaches any needed files (css/js etc) and the model of course simply defines the structure of the data and allows you to access it in an OO way.
Lastly, I wouldn't tip my hat in favor of web2py just because of jQuery integration. It does use it, and a some of the built-in framework stuff (like response.flash/session.flash, the LOAD function that loads a page or data from another controller) rely on jQuery, but using it in another framework only means you have to write an include statement (e.g. ).
But, the way it allows/forces you to focus on development is what takes the cake for me.
I've been using Django as part of my work for a couple years now and truly enjoy it when I can make it work. Unfortunately, and maybe it's just me, but I end up spending hours working on configuration every time I start a new server, or try to make it work in a development IDE.
It's relatively simple to start a new project and start coding. But there are all sorts of little catches that keep things from working if you deviate from the norm. Things like if you want your django project to serve from a subdirectory like example.com/django. The information is out there to make it work. But it's hard to find.
I can't tell you if web2py has those same problems or not. I only just learned about it from your question. It does look slick and simple though. I can tell you that after the hassles of getting the applications to serve properly from whatever server configuration I'm using, django is way more fun to program with than plain php. PHP frameworks may differ.
From my understanding the project not usual web application, you must need event driven program, web server in python.
Django won't help you here.You should look into Flask, Flask has inbuilt console too.http://werkzeug.pocoo.org/, you might need to use twisted, gevent,Flask jquery.
I would recommend asking about web2py on its mailing list -- you'll get lots of help and advice there. Regarding the LGPL license, note that it only applies to the framework, not your application -- you can license your application however you like, including closed source/commercial.
It sounds like you'll need some server push functionality, but if you'll really only need a few long-lived connections at a time, you might not need to bother with solutions like Twisted or gevent. If necessary, though, web2py does include this (requires Tornado, and works using WebSockets, though can be adapted to use other methods).
I'm being hired to write a photography website. Basically a gallery layout, links to an online store, etc. I know we use rails for sites like twitter, but would rails be too bulky for this? Should I go with php instead or are the two pretty much interchangeable and come down to a matter of personal preference?
Certainly this is a matter of preference, but there are pros and cons to every language.
I can say that the two are not interchangeable. PHP is almost a catch all language that has tried to implement every concept under the sun. It can be fun to use if you know what you are doing, and are clear about your style and approach to programming, but PHP gives you so much latitude, it can be easy to hang yourself on community examples.
Ruby on Rails is something of a framework in itself, and would be an excellent choice for creating a dynamic site. It is certainly not too bulky, and if your server can run it, the only thing that should stop you from using it, is your comfort level.
The advantage of PHP is that it can be everything to everyone, but ruby presupposes a great deal of experience in programming, and a good understanding of the pitfalls and problems inherent in working with a dynamic language. This is a wonderful thing for experienced programmers, but can be a painful thing for less experienced ones.
If you want to go the PHP route, there are a number a frameworks that can speed up the process, (which is one of ROR's claim to fame). Smarty, Zend and Cake are just a couple examples.
But again, if you are using these frameworks for the first time, the barrier to entry can actually extend your initial development time.
Honestly, a preexisting CMS might be your best choice... though you could go crazy finding a good one, and then figuring out how to bend it to your will. Joomla, Wordpress, ModX, Radiant and Refinery are some examples. (Wordpress being probably the most popular)
For simple sites, you should try to use an off-the-shelf CMS.
Why rewrite the wheel?
It does come down to personal preference. Here's mine: I would say no, rails is not too bulky for a task like this. Simple websites often lead to more than simple websites. I recently learned Rails and was able to build a simple photo blog in no time at all. It's simple, yes, but it's something I can add to easily as the requirements roll in.
Also, check out Rails + Plugins = CMS (good read): http://rubyredbricks.com/2009/2/24/rails-as-cms
The choice between Rails and PHP (or ASP.Net or Java or ...) is a matter of personal preference. You just try to find a language and framework that you'll enjoy working in (that you can afford since hosting for different kinds cost different amounts).
If you're thinking that the site is really simple, you should look into a Content Management System (CMS). A lot of people use Joomla or WordPress as a CMS, but there are tons of options out there.
One point I would add is that I've written a lot of desktop applications. When doing so, I've been very concerned about which libraries I use because it affects the size, download time, and complexity of installing the application.
All that just kind of goes away with a website. As long as the server has all the support code you need, you're good to go.
Use whatever seems easiest for you, or is most readily available. I don't see a right or wrong answer to this.
Although Rails is a "full stack" and quite complete, it won't take up much disk space so having 99% of it just sitting there doing nothing won't actually hurt you.
`In order to stick with the wonderful Ruby language, you could consider Sinatra, or a Rails blog-package like Slate.
I've done a couple of sites in WordPress. You get a lot of polish and premade content management for not much more trouble other than uploading the files, adding a plugin, and choosing a theme. You can throw in a sidebar widget if you feel better having written some code.
Things like Joomla! are more customizable, but Joomla! in particular is kinda large.
These days, I wouldn't touch WordPress or Joomla!, simply because they are in PHP and I've been spoiled by Ruby.
Finally, take a look at what your situation is. Do you have other paying projects ready to start? If so, you will need to pick a reasonably fast approach. But if this is the only thing happening, and you can afford to spend more time on it than it really deserves, you might have other considerations. Perhaps you really think you should learn Rails, or some other technology. Perhaps you want to put package Xyz on your resume...
Why is PHP the most used programming language for a web based platform?
PHP:
is easy to learn;
has been around for ~15 years;
runs fairly efficiently;
is cheap to host; and
actually scales really well (some of the largest sites on the internet use it).
PHP is basically the ultimate grass-roots success story.
PHP is:
Built for the web, that is not an extension of an existing language like Perl.
Free of any default framework; this allows it to be fairly lightweight and powerful, a good example of the KISS (Keep It Simple, Stupid) principle.
Because software that values simplicity over everything else propagates faster.
Probably because PHP is easy to learn and it was really simple at first start. With the upcoming of OOP from PHP4 we cannot really say it's simple anymore but at least it tries to keep simple.
Plus from the start the language was really Web oriented, easy access to get/post variables.
You can also note the PHP community is really wide and Zend do a great job to make it a real concurrent of Java/Dotnet/all the others.
Perl/Python/Ruby are also good scripting language but they require some libraries to develop web application
While most CGI language extensions require you to write HTML/JS/CSS within that languages syntax, PHP is able to be used within the contents of an HTML file structure. For someone who doesn't really get the concept of CGI (like I did a while back), it's really nice and offers room to grow with libraries and a universally familiar syntax.
It's also a strategic isue to
choose PHP over Java/Ruby/...
Because you will find PHP
programmers every time, but it is
really difficult to get (cheap)
Java/Ruby/... programmers.
PHP has become the third most be
liked programming language. * **
Its Open Source.
Its old and therefore very stable.
Its the best documented language in the internet.
It has the most string functions (necessary for web/HTML programming).
It has a very huge community, you will find the answer for every PHP question in the internet (or ask stackoverflow).
Its the only language which was designed for the internet.
PHP is fairly easy to install and fairly easy to understand. For that matter, you don't even have to install it. Fifteen dollars a month (or less) will get you a PHP webhost at hundreds of hosting companies.
There are no shortage of "Build a website in 5 minutes with PHP" books. Therefore, it's often the first choice to new web developers or people who want to get something done quickly.
PHP certainly has it warts, but done properly, it can be a good solution as well. Despite its warts, it runs an awful lot of successful websites.
I think it is easy to learn, it is faster, it has lots of forums, it has lots of example codes, it has ...
A lot of emerging php framework like Symfony, Zend, and Cake make rapid development, good mvc design easy. A lot of extremely popular blogging software/cms's are built using php eg. Drupal, Wordpress, and Joomla!.
I currently have a very functional customised online ordering website written from scratch in ASP. This was built approx 4 years ago, and works exceptionally well.
I need to build a similar one for another company. Do I simply upgrade and get a like product developed in ASP.Net 2.0, or do I need to do some homework on other options such as PHP, Rails, Django, Magento etc?
The new site will need to use Ajax (or something similar) and other Web 2.0 features in which I know ASP.Net can handle.
Are there other simple frameworks available to create a customised online ordering type of application? As an example, I have heard that Rails and Magento are very difficult to customise etc.
Do I use the devil I know?
If you are looking at AJAX, then rather than vanilla ASP.NET, I'd look at ASP.NET MVC; this is a much cleaner model (more logical too, IMO) - and it plays very well with jQuery for the ajax, since you have much more control over both the html and the paths.
Also, jQuery now has intellisense in VS20008, making it even more inviting.
I can't comment on PHP - but the ASP.NET MVC is at least in roughly familiar territory. But note that ASP.NET (including MVC) is a lot more than just a straight upgrade to ASP.
I think it all goes around what level of focus and resource you intend to commit to this project.
If this is a project that you'll focus on solely for the next few years, then programming it yourself makes best sense, but if this is just one of many projects that you're busy with then I'd recommend trying something like Magento.
I was faced with a similar situation and chose Magento and that decision has been ratified many times over since then. Granted, there is a learning curve at the beginning, but you cannot compare the power of community developed projects against one you'll develop sporadically yourself. There have been a constant stream of improvements to the software, including iPhone-friendly shopping interfaces and ajax interaction, all stuff that I just would not have had time to get to.
Anyway, that's just my 30c worth.
Regarding which language to use if coding yourself, I think this is a purely personal decision and our responses can only be subjective.
But, since, you ask: I started web programming with ASP, but gave PHP a try over 7 years ago and have loved every minute of it.
If your current solution works and this new project doesn't require major changes and/or anything that you cannot do using ASP you should consider not switching but staying with ASP. Regarding AJAX, you shouldn't have any problem with the ASP.
My work is split between ASP.Net and PHP. I'd say , in general, I prefer the former for larger projects and the latter for small quick (in terms of dev time) things. In my experience, PHP's advantages over ASP.Net are cheaper hosting and larger user base (easier for the client to find someone to work on the app if you become unavailable in the future). If those aren't top priorities, I'd say stick with .Net. And definitely take a look at ASP.Net MVC and jQuery, as Marc recommended.
ASP.NET MVC all the way.
Easier port, more professional, safer and better for large projects.
This is an interesting question.
Comparing the Compiled vs interpreted languages - there is just a myth outside that PHP is faster than Asp.Net but at some points, this looks true. Find here a detailed explanation,
http://naspinski.net/post/AspNet-vs-php--speed-comparison.aspx
Moreover, the eCommerce site contains large number of products and database, so it should be wisely chosen the technology for development from these two, asp.net and PHP.
Check these pages if you would like to go deep in the selection of asp or php for eCommerce,
http://www.ydeveloper.com/asp-dot-net-ecommerce.html
I've been doing html, css and javascript for quite a long time, mostly for my very own enjoyment. I would say I know fairly much, I've created many simple games and apps and experiments with javascript. However there is only so much that is possible to do in the browser, for any more "complete" websites I am constantly confronted with my ignorance on server side programming.
So, what do I need. I need to get my head around how to use databases and how to use some server side programming language, I guess. What is the right choice? What should I avoid?
Thanks.
PHP and MySQL have a pretty low barrier to entry (they're both free and ubiquitous). I'd start with those, since most hosts provide them for you. As an added bonus, they work really well together (and PHP isn't very hard to learn coming from a web development background).
Head First SQL is a great book for learning MySQL. All of the examples in the book are done on MySQL. The book even explains where to get it and how to install it. As for PHP, the introductory tutorial at official website is the best place to learn it.
Update: Head First PHP & MySQL is now available. I haven't read this one yet, but other books in the series and by the same author are great for learning new languages from scratch.
Download Python. Learn the Python language. Learn Object-Oriented programming.
Python includes SQLite, this makes it easier to Learn the SQL language.
Download the Django framework. This makes it easy to write server-side applications that work simply and reliably.
I would suggest PHP. Not because it's the best, most modern or cleanest language out there, but because it is easy to learn for someone coming from pure HTML.
You begin by just adding tiny bits of PHP to your regular HTML and magic happens :)
Ruby is a fantastic language and the frameworks for web stuff generally teach you some good practices. Try it. The Learn to program book uses Ruby, maybe you'd like to check it out.
I noticed in your question you mention that you've been using javascript. If you're comfortable progamming javascript, I've recently begun working with server side javascript in the form of EJScript on linux and using jscript on windows. It's been fairly painless, and the documentation has been pretty good so far on both.
If you're more interested in learning this with another technology then Django & Python or ASP.NET & C# (or IronPython) are both fairly low barrier to entry platforms available on windows, *nix, etc...
I would say that if you're comfortable working in Linux, then go for PHP and MySQL. If you aren't comfortable working in Linux, then download the free Visual Web Developer version of Visual Studio Express, and get started using that. This lets you program in VB.Net or C#, and use the .Net web development framework. It's really miles ahead of anything PHP in terms of how nice a platform it is to work on. There's also a free developer edition of SQL Server that lets you store up to 4 GB of data.
There's plenty of .Net hosts out there now too. Although, due to increased license costs, Windows hosting plans will usually cost more and give you less space/bandwidth than Linux hosting plans, you can still get enough room to play around with and deploy some apps on the web. If you develop something really cool, and outgrow what your hosting account provides, it's probably time to upgrade to a VPS, and post ads on your site to start paying the bills
I'd recommend PHP for folks who are familiar with HTML but are newish to programming. Here's why:
I'm currently an ASP.Net developer, and I think that ASP.Net abstracts waaaaay to much to make it a good first programming environment. I say learn how to generate and manipulate straight HTML with a language like PHP instead of trying to understand GridViews, etc., which have no bearing or relevance to programming in the broader sense.
I wouldn't say ASP.Net is "the Dark Path" or anything, but if you start out by learning it, you'll tend to favor the warm and insulating arms of the framework. ASP.Net is pretty much a code-generator when compared to more explicit (some would say reckless, messy, and tedious, but I'm not one of them) methods like PHP.
With PHP you'll see the effect your code has on the actual HTML when you view source. With an ASP.Net page, you'll be baffled by the amount and complexity of the HTML it spits out.
After you get your hands dirty in PHP, you can explore the pros and cons of frameworks like ASP.Net that "do a lot of the work for you".
I was exactly in your situation 3 to 4 years ago and, like some of the commentators suggest, I tried PHP because of its low barrier of entry.
That was a mistake! Oh sure I was able to achieve some things here and there, including using a contact form from a book which was so flawed that it was later hijacked by big time spammers and got my domain banned from most email servers out there.
Later on I tried to learn how to create dotabase driven sites with object oriented programming following the guidance of the excellent books, blog posts, and forums from Sitepoint and other sources. It was just too hard for my little brain. I just could not do it.
So what happened? 2 1/2 years ago I decided to learn Rails, which had just turned v. 1.1. It has been fun since the beginning and extremely rewarding. Working with Ruby is a pleasure, much easier to learn than PHP, and the Rails framework is so well put together that you can, with little effort, produce some very elaborate web sites with advanced features all while learning how to do proper object oriented web programming.
I used my new knowledge to recreate from scratch the site of my non-profit organization (with a new domain ;-) and, with a friend who is a talented designer, created a web development firm.
Don't get me wrong, it's not that easy, if you want to learn programming you need to put a lot of effort into it but in my own experience Rails can bring you some instant results while letting you get deeper and deeper over time.
I recommend two main sources of knowledge:
The excellent, official Rails
guides.
The free screencasts
from Railscasts.
Whatever your choice will be I wish you the best and a fun and fulfilling experience
I recently came upon this question myself. I really liked the way PHP integrates with HTML making designing a site more natural in my opinion. Design your site as you would with static content and then switch the static with the dynamic. However, I wanted to choose a "good" language. I looked at PHP, Ruby, Perl, and Python, as they are the most popular, open source options. I didn't need any powerhorses, if you will, like Ruby on Rails or Django, since I just wanted to mess around with server side stuff and some SQL—nothing serious. I don't remember why nor do I care to remember why, but I chose Python. But I still wanted that integration with HTML. I came across Karrigell. It's a neat piece of Python that essentially handles the integration. It comes with a little web server which you can use on its own or use something like mod_proxy with lighttpd. The devs don't limit you to only Python inside HTML, though. Their server parses: Python inside HTML, HTML inside Python, plain ol' Python scripts, and Karrigell services. It may not integrate as well as PHP does, but it's pretty damn good.