Language for web site development C++ or php? - language-agnostic

I want to develop a forum like web site. I know C, C++ well but I havent used in web development.I know PHP little bit. Which language should i use?

C++ can and has been used to successfully develop highly scalable web applications. That said, one of the main reasons C++ is not so popular in this category is to do with the lack of standard tools and libraries. There is simply no feature rich library which includes all the necessary boiler-plate code needed to write web applications.
PHP is everything that C++ isn't when it comes to web development - a high-level scripting language designed mainly for web development. The description of PHP on the homepage sums it up nicely:
PHP is a widely-used general-purpose
scripting language that is especially
suited for Web development and can be
embedded into HTML.
If you're developing a simple forum, this decision is a no-brainer: PHP. In addition to the obvious advantages to using it, you'll find the syntax familiar as it is C-like. However, if you have all the time in the world, you're feeling brave and this is for hobbies' sake, do it with C++!

Out of those, for web development, PHP for sure.

C and C++ is not the correct choice to develop for web, so if you know PHP it's better.
also you can try python, ASP.net etc...

To add most hosting does not support c++ and they will not in most case so if you were me I will go for PHP and almost(nearly) all hosting service support it.
Also the lack of function for web development in c++ is also a pull down.

Actually, I wonder why you're not considering to use both! Use PHP for the web interface and write special C++ methods for the more complex actions that you want to take. (Although PHP can handle most of those too.) Basically, this would require less knowledge of PHP and your C++ knowledge stays usable.
Do keep in mind the hosting restrictions of your webhost, unless you're going to host your site on your own system.
Also, do realize that the use of C++ for web development would restrict you to the more general C++ libraries. C++ can be used to write platform-independent code, just like PHP. But not all libraries are supported on every platform.
Finally, PHP already is a powerful language and there are plenty of add-ins for PHP that you can re-use instead of writing it yourself. Still, most of PHP and all the add-ins are written in C++, even though many people just forget about the fact that the code behind PHP had to be written in some language too. Image manipulation, encryption, complex math, etc... It's all been done before for PHP. But it should not stop you from writing your own extensions...

PHP, Python, ASP, JSP, C#.net all should work

C++ is not commonly used for this purpose. Most shared hosting providers won't allow you to run native executables created by C++ for reasons of security (though I suspect this would be manageable with fine-tuned rights) and portability (eg. you'd have to know which OS the shared hoster's webserver runs on and possibly install additional libraries).
Even if you have your own dedicated server with root access, it might still be difficult to properly integrate an executable as CGI into Apache or IIS.
If you're not bound to PHP or C/C++ for some other reason, you could also try C#. Picking up C# from C++ is very easy and ASP.NET allows you to write your complete website in C#. With ASP.NET MVC, you even have an MVC framework comparable in productivity to Ruby on rails. Many shared hosting providers support ASP.NET and through Mono, it's even possible to host ASP.NET web sites in Linux (I'm doing this with my blog ;-))

Related

Cocoa, Objective-C to HTML?

As far as I've been able to find, there seems to be one option for building websites/web applications in Objective-J with Cappuccino.
The .NET is a huge framework that of course can compile for the web. I don't think it's a stupid question to ask whether or not Objective-C can be used for the same purpose.
Apple doesn't advertise being able to develop websites with Objective-C, but I thought I'd ask anyways.
Other than Cappuccino, is it possible or just completely not possible?
It'd be possible to build websites in Objective-C, the same way you'd be able to do it in C++ or even C.
There are pros and cons to both. The main pro is that these languages are generally more mature, robust and better featured than php, ruby etc. However, since they are not generally used for that purpose (unfortunately), there aren't many frameworks and/or workflows available. The most recognized for Obj-C is GNUstepWeb.
You also have to consider what you're doing. If you're building a web application that involves models, reports, etc, this would be a good way to go. On the other hand, if you're building a smaller website with more common features, chances are one of the "traditional" web-development platforms is going to be a better match.
I thought you might be interested in something like Cappuccino (Aka Objective-J) which is similar to Objective-C (in some ways) but fully designed for creating web application front ends. It compiles to Javascript.
Your question isn't stupid - but it is very broad and hard to answer. Are you talking about outputting HTML? Or are you talking about server side programming? Objective-C using Cocoa, or just vanilla Objective-C?
To start with, anything using cocoa frameworks cannot be compiled for the web. Period. You can imitate the Cocoa frameworks (like Cappuccino does), but it is not a small task.
It is possible to do web development with Objective-c (server-side), but it is not really feasible at the moment because you would have to write the libraries from scratch, and with so many other options out there for web development with complete frameworks (Ruby, PHP, Python, Java, etc) there really isn't any reason to do so.
WebObjects was an Objective C framework, but transitioned to Java a decade ago. However, it still has the Cocoa/Obj C feel, still using foundation classes such as NSArray as well as key concepts like KVC and MVC. The Apple online store and the iTunes Store are two successful examples of web applications written using WebObjects.

What open source web programming languages are more restrictive than PHP?

I learned some java first, and now I'm learning PHP. I am not comfortable with how "free" it is, with things like loose typing. I really liked the way java forces you into good practice. Are there any open source web programming languages that are more restrictive than PHP, in the same way java is?
How about... Java? :D
If normal Java-driven frameworks are (for some reason) unacceptable, then how about Google Web Toolkit - you write code in Java (with all the benefits of the language), but the application is compiled to JavaScript, which can be run on any modern browser. Additionally, it performs some optimization, etc - really worth looking into if you are familiar with Java and want to use that language to write "light" web applications.
If I didn't make it clear before: you write code in Java (you can use all the design patterns, object-oriented features, strict typing, etc., the compiler warns you if there are compilation-time errors, there's very mature Eclipse integration and so on), but the application is compiled to JavaScript - no need for Java plugin in the browser (no Java applets whatsoever). The compilation part additionally optimizes and obfuscates the output JS code so you'll get faster and smaller code, then if you wrote it by hand. The server side is up to you - while it is easiest to use Java there (especially with all the cool stuff coming in GWT 2.1), you easily use PHP, RoR or Django (via JSON or XML).

What platform should you use to build your first web application?

I'm deciding between LAMP and Google App Engine with Python. Mainly this is an educational experience so I'm weighing the potential ease/quickness of developing on App Engine against the value in learning LAMP from the get go (and not being locked into the App Engine way of doing things
It depends on where you come from. If you're already familiar with either PHP or Python, I'd let my choice depend on that.
If you're starting from scratch, there's a few things to consider :
PHP (if you consider the P in LAMP to be that) has the advantage that there is a huge amount of web applications/sites out there that use it. If you're aim is to be able to modify or contribute to lots of other webapps, I think you should go with PHP. On the other hand PHP is easy to mess up and it is hard to cleanly seperate webdesign and code. PHP has no real application outside of web development that I am aware of (I may be wrong).
Python is a real sweet language with a clean syntax and a lot of (third party) libraries. Python has lots of applications outside of web development.
Google App Engine allows for a clean MVC approach in conjunction with Django (among others). A MVC approach allows to cleanly seperate HTML/CSS/Javascript layout stuff and Python Code.
If you master GAE/Python, it's a small step to go to Django, running on (Linux|Windows)/(Apache|Ningx)/(MySQL|several OtherDB's).

How to add bindings to a new language?

So you've got to create your own scripting language built in .NET C#.
What's better now for libraries? (think SDL/OPENGL), generate wrappers with Swig or do it by hand? Any other choice?
Since you're building the language in C#/.NET (which I will comment about later), you should have easy access to the entire .NET library system. This should make it very easy to use existing libraries to make .NET assemblies, and have them exposed to your scripts.
However, I'd question wanting to make a scripting language in C# - There are very good options out there, especially if you take the DLR (dynamic language runtime) into account. You can provide scripting to an existing C# application very easily without making a custom language.
I would recommend using the CLR.
This way, you get the entire FCL, and any third-party libraries that people write in .Net, without having to do any additional work.

What is the Difference between PHP and ASP?

ASP is a Compiled Language or isnt it? sure it is.
PHP is a Interpreted Language.
I also developed once an asp app with the VS 2008 IDE.
But there is a Big difference between ASP and PHP.
What are the Differences?
ASP is a Compiled Language or isnt it? sure it is.
No, it isn't.
The first reason why ASP is not a compiled language is because there is no such thing as a compiled language. A language is neither compiled nor interpreted. A language just is. A language is a bunch of abstract mathematical rules. Interpretation or Compilation are traits of a language implementation, they have nothing to do with the language. Every language can be implemented by either a compiler or an interpreter; most modern high-performance language implementations actually use both and switch between them depending on which one is faster in a particular context.
The second reason why ASP is not a compiled language is because it is not a language. It is a framework. You can write code for ASP in any language for which an ActiveScripting engine exists (e.g. Ruby via ActiveRuby), but most commonly one would write code in either VBScript or JScript.
Which brings us to the third reason: The implementations of VBScript and JScript that ship with Windows, as well as ActiveRuby and all other ActiveScripting engines that I know of, are pure interpreters, they cannot compile. So, even though I wrote above that any language can be implemented using either a compiler or an interpreter, all the language execution engines that are supported by ASP are interpreted.
PHP is a Interpreted Language.
Again: no, it isn't.
Reason one is the same as above: there simply is no such thing as an interpreted language.
And, in contrast to ASP, the vast majority of PHP implementations actually do contain a compiler. Some even are pure compilers, they don't even have an interpreter. (Phalanger, for example always compiles straight to CIL, with no interpretation whatsoever. P8 can either interpret or compile straight to JVM bytecode or both: interpret, gather profile data while interpreting and then JIT-compile to JVM bytecode.)
But there is a Big difference between ASP and PHP. What are the Differences?
ASP is a (language-independent) framework, PHP is a language. That's a rather big difference. (Actually, PHP contains one small bit that would in other languages usually considered to be part of a web framework: webserver integration.)
PHP is highly portable across operating systems, CPU architectures and webservers: there is a PHP implementation for nearly every execution environment, from the JVM to the CLI to Parrot to running natively on pretty much every operating system under the sun. ASP is pretty tightly bound to Microsoft Internet Information Server, Microsoft Windows and the PC platform. (There were some other implementations but they are pretty obscure and no longer available.)
PHP has lots of different implementations (Phalanger, Quercus, Pipp, PHC, P8, Zend), ASP has only one. (Like I said, the two other ones are no longer available.)
The vast majority of PHP implementations are Open Source (I think the only exception is P8), while all three ASP implementations that I know of are proprietary.
PHP is actively developed and maintained, whereas ASP is largely obsolete and has been superseded by ASP.NET.
You could be more specific with your question.
The biggest difference is of course that ASP is programmed in a .NET language and uses the .NET framework as a basis. PHP of course is programmed in PHP and with it's library.
.NET is compiled into bytecode and that bytecode is interpretted/jitted at runtime. There are also bytecode caches for PHP (e.g. APC) and there is an active project that aims to generate native code from it using LLVM.
ASP is interpreted ASP.NET is compiled. ASP is not a language but a framework, you can code ASP.NET in a bunch of languages. ASP.NET runs only on IIS (unless you use Mono and who remembers Chilisoft ASP here?)
I have noticed when trying to add hosting on GoDaddy.com, PHP is for a Linux package and ASP was for Windows package.
ASP is a proprietary, closed-source implementation, PHP is not.