What to do after learning basic PHP? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have learned extremely basic PHP (I think so) using Lynda Tutorial. After that, I feel, I got some grip on that language. My ambition is to become a web developer! After some googling, I planned to learn some more advanced and practical php by using websites like PHPSCripts, Webapps etc..
But, now I'm in a confusion! After my studies, when I seek for a web developer position & got selected, how will I work, by just knowing some language basics?
Can you guys help me to become a good web developer, what will I have to learn & how to learn?
Also, can I get the steps to do a practical PHP project.

As a web developer it is important to have client and server side skills. But there are few web developers which are excellent at both... But knowing the basics and where to look for info is definitely a good starting point.
I would recommend to work through the following list(s) in the order presented. If you feel comfortable with a topic, move one. Even though that in reality you will often have to go back and forth during the learning process...
Client Side
HTML / XHTML
CSS
a JavaScript Library (e.g. jQuery, prototype/scriptaculos, etc.)
Server Side - Infrastructure
familiarize yourself with shell scripting if working on Linux (e.g. bash, etc.)
Webserver (e.g. Apache)
PHP Server
Databases (e.g. MySQL, PosgreSQL, etc.)
Server Side - Programming
PHP
SQL
Advanced Topics
After getting familiar with the basics...
AJAX (this is placed here because it is a client/server topic, not because it is advanced...)
Object Oriented Programming (OOP)
Security issues
Source Control Management (SCM) -> (e.g. git, etc.)
Model View Controller (MVC) software architecture
PHP Frameworks (Zend Framework, Symphony, CakePHP, Agavi)
Unit Testing (e.g. PHPUnit)
Object Relational Mapper (ORM) for PHP (doctrine, Propel)
Usually this keeps you busy for a while. At least it kept and still keeps me busy... ;)

Here are few suggestions:
Read these advanced/practical php articles on phpro.org
Learn the basics of OOP
Familiarize yourself with php frameworks and CMS
Familiarize yourself with HTML/CSS/Javascript
Try to make clones of other websites
Try to volunteer in open source projects, you may get started at:
openhatch
sourceforge

Im my opinion, A good webdeveloper MUST know:
HTML
CSS
JavaScript
After this, it's important to know:
Jquery
XHTML
Crossbrowsing (diferences of IE X Firefox x Chrome, etc)
Rationale:
HTML: it's the base of web.
CSS: in 2010, it's the base of web.
JavaScript: only the basic, to understand jquery after.
Jquery: you can solve a lot of problems quickly and it's large used.
XHTML: because your page may broke in modern browsers, if has a <br>, not a <br/>
Crossbrowsing: there is more than one browser in the world.

Just keep on practising. You will likely need solid HTML / CSS skills as well as PHP since the two go hand-in-hand - it's also useful to learn MySQL. Spend lots of time going through the tutorials on the excellent tizag.com as well as Lynda.
Once you're comfortable with all that and you're ready to move onto something more advanced, it's worth looking into Wordpress customisations and plugin development - that has the advantage of being pretty easy to use, with an awesome support community, and a whole bunch of mature code that you can look through yourself to get more familiar with how the language is used in the real world.
After that, try a framework like CodeIgniter or CakePHP - these are awesome for your productivity but do make sure you're comfortable with the basics first as the learning curve can be pretty steep and you want to reduce frustration as much as you can. :-) Learning design patterns will also be helpful at this stage.
One thing that will always be important to you, your users, your applications, and your potential employers is code security. I can't stress this enough. As soon as you put an application into real-world use, you have a moral and professional obligation to make that application secure. http://www.addedbytes.com/writing-secure-php/ <- read, digest, read other guides. Security is the single most important thing that a PHP developer can learn.
Above all, have fun! The best developers tend to be the ones that get genuine enjoyment out of what they're doing. You might find yourself eventually leaning in a different direction and using completely different technologies, so always keep your eyes open and be prepared to learn new things even if they don't necessarily 'fit' your current skillset. Also the more general knowledge you have about programming patterns, the better you will become in individual languages. Remember that it's an organic process so you will need to let it develop naturally - but help it along by exposing yourself to as much as possible (foreign language teachers call this 'immersion' :-) )

Regarding PHP
Make a small project using PHP, so you know that you know.
Learn a (MVC) framework like CakePHP or Agavi.
Read this SO answer.
Regarding Web Development in General
Know about CSS, XML, XHTML, XSLT, W3C validation, HTML5, JavaScript, AJAX (and most other acronyms you come across).
You will find there are various libraries which make your life easy, use them. And there will be one browser that will make your life difficult, but you will have do deal with it.

A solid web developer needs an understanding of HTML, CSS, JavaScript, and the server-side scripting language of her choice. But still more important is a solid foundation in programming. You don't have to be an expert computer scientist, but you need to understand how to structure a program and how to solve problems in a sensible way.
Most professional web development involves database access of some sort. Teach yourself SQL, and use a real SQL -- not Access -- for the effort. You can run MySQL or Postgres on a laptop these days, and it's free.
Learn to design databases well. Learn about normal forms, and indexes, and so forth. The time you spend on that will pay off in spades.
Take a while to study up on security. Look at the security bugs that have afflicted high-profile projects and sites. (Hint: they're pretty much mostly about trusting untrustworthy data, or else relying on old out-of-date infrastructure, but the consequences include site defacement and the compromise of valuable information.)
And then, take on a charity project somewhere. You won't get turned down, and you'll cut your teeth, so to speak. Just make sure you're not storing social security numbers or something crazy like that, because charity workers are often vulnerable to social engineering attacks.

the very very first thig to do is to learn Object Orientated Programming (if you haven't).. then you might want to start learning the MVC pattern... and then you must decide either you star using frameworks (like cakePHP, Symphony,Zend) or you prefer using CMS (like joomla or wordpress)... on the process you might also want to learn javascript using a framework (mootools, jquery or prototype)...
Edited: i forgot about databases and sql!! wow.. there's a lot to learn!

The only way to become a good programmer on a certain platform, is to study something more than just tutorials. Read a book, at least. Then the rest comes with practice.
A good way is to also learn a specific platform (depending on what they work with). Some work with Wordpress, so once you know basic PHP and how to use it with databases, and how to work with databases, you would be able to quickly make some basic information websites. Others use Joomla, Drupal, DLE, to quickly build websites, without having to hurt their heads with full backend and frontend architecture. If you need a more general approach, to be able to make more specific web applications, use frameworks like Zend, CakePHP, Symfony, CodeIgniter.
Also, besides knowledge of PHP, to build a small website by yourself, you will also need to know HTML, JavaScript (with AJAX, possibly a framework like jQuery), SQL.
And last but not least, you will need to learn how to protect the site against XSS, SQL Injection and other security threats.

Learn Object Orientated Programming (OOP for short).

Watching any programming tutorial is different than watching any movie. You need to have practice and have experiments form different angle of codes. Prentice and research is only way to get into the deep of any language. If you think you have well understanding about php then try to make some small application like phonebook which have database connection. After that you can move for any frame work like laravel, cakephp. But I always recommend to do at least one small project with raw php before move for any framework because when you come from raw php you will start loving working with frameworks otherwise you will may feel boring to learn again something new as my point of view.

Related

Is AJAX enough? Should I learn a PHP framework? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I started learning programming 4 months ago. So far I already know some javascript(and jquery), php, ajax html and CSS. Yesterday I saw for the first time in one of the stack forums a question about PHP frameworks (zend, codeigniter...etc).
I hope these questions are not very stupid, because I am a beginner so I don't know much about this world yet, but my questions are:
1- Do I need to learn how to use a php framework if I just one to build ONE website?
2- Do websites nowadays rely more on AJAX + some php OR just PHP + some javascript?
3- How long does it take to learn and master a php framework like zend?
1) You don't need to learn a PHP framework, and in fact if it's the first website you've ever built I'd suggest building it without a framework just to get a feel for how PHP works when building a site. This way you understand things like database connections, session management, etc. that is often done behind the scenes with frameworks. Then later on try building it with a framework to get an idea for the design patterns and other features that a framework has built-in to avoid code repetition, security holes, etc.
2) I don't know what the difference between AJAX + some PHP and just PHP + some javascript. AJAX is a part of Javascript, it isn't a separate technology on its own.
Some websites use a lot of AJAX, some don't. It really depends on what you want the website to do and your particular design: AJAX can provide a smoother feel to the site, but can have complications when it comes to things like back buttons and bookmarks.
3) Depends on what you're doing with the framework: if you're only using 10% of the features you certainly won't become a master in any amount of time. It also depends on the complexity of the framework: I haven't used Zend but I know that the more complex the framework, the longer it will take you to learn it.
Learn as many thing as you can. PHP is a good start, becouse it's very popular and easy to learn and use. There are many great frameworks written in PHP (Symfony, Zend, Kohana, etc.). However, it's not a nice, well designed language at all. Keep it in mind, don't stop at php, learn it then make progress.
b) You will be able to build a large variety of sites with PHP+JS+HTML
ps.: AJAX is a technology, and as a knowledge, it doesn't worth so much as is.
Ajax is just a technology to call server side scripts from Javascript. The server side script being PHP. So, if you intend to use Ajax, you need to know PHP.
As for PHP frameworks, its good to build a few website from scratch using PHP to get a better understanding, but eventually, its better to adopt frameworks. Frameworks implement a lot of the functions and methods you need. No point re-inventing the wheel.
The answers to your questions are very subjective, but what I suggest is:
No you should not learn a framework to build one website. Just go and build it in any way you can. Frameworks usually carry a lot of additional concepts and methodologies. You will have to invest quite some time to understand how they work, but it will be really hard to understand why they work that way. Doing a website is a great experience, so just go and build something.
Lets say websites mostly rely on HTML / PHP / JavaScript. Ajax is just an additional capability, which you are already focusing too much. It's great that you know what Ajax does, but you should concentrate more on the essential things, like number one.
Lets say it takes two years of constant interest in the field. So at first you learn the syntax of PHP, then you start to know how HTTP works, then you experiment with HTML and JavaScript/jQuery/Ajax a bit more, then you try a Framework. You keep trying until you become a master. Zend Framework is one of the most comprehensive, so it will take a while to study how it works and all the related technologies it brings with it.
My final advice is to stay focused, build something, see what challenges it brings, solve those challenges and eventually become a master. Good Luck!
Question One - The short answer is: it depends on the type of site you're building. The frameworks you're talking about were built to streamline web application development, which make extensive use of databases and object-oriented principles. If you're planning on building a site with mostly static content, I wouldn't bother learning a framework just yet.
Question Two - Again, it depends on the site. The concept of AJAX has many applications, but most sites employ it to make a site more interactive (e.g. not refreshing the page to load new content). For sites with primarily static content, AJAX has fewer uses.
Question Three - It can take a while to 'master' a framework. I'm not that familiar with the ones you mentioned, but learning a framework is less about understanding it's syntax/quirks and more about learning how to approach a problem their way. Again, it depends on what you're doing.

Advice for a novice PHP enthusiast

I am totally new to PHP, I want to know whats the difference between PHP,CakePHP and Joomla.
Which IDE is most commonly used for developing PHP based web applications.
How Ajax is implemented in PHP, is it through JQuery only or there's something more to it.
Which will be the ideal book that covers most of the basic and advance concepts.
PHP is a programming language.
CakePHP is a framework written in PHP.
Frameworks establish a basis for quickly developing applications by providing you with a lot of functionality that you would have to write in plain PHP for most applications anyway. For example, secure database access, session management or pagination. These are all tedious things you have to care about, but that are basically the same for every app. It also establishes a certain structure for your project.
Joomla is a CMS, a content management system, written in PHP.
CMSes are pre-built systems you can use as-is, that allow you to manage your content. They're extensible and customizable, but often not to the degree that an app written in plain PHP or using a framework can afford, or not easily so. There's a lot of functionality in there already though that you don't need to write at all.
AJAX is not implemented in PHP at all.
AJAX just means that Javascript asks your server for data and the server delivers it.
A typical PHP page responds to requests with a complete HTML webpage. For AJAX requests your server instead responds with XML, JSON or plain text, whatever you decide. It works exactly the same way as responding with an HTML page.
Javascript is a programming language.
jQuery is a library written in Javascript.
See framework, the definition is almost the same.
For IDE recommendations, do a search.
PHP is a programming language
CakePHP is a framework
joomla is a CMS
AJAX - php is executed server-side and as such isn't something "implementing" ajax. The original call comes from client-side javascript that is not limited to JQuery. JQuery is a javascript library.
Ajax isn't implemented in PHP. Ajax is client-side technology. PHP is server-side. I started using Eclipse's PHP IDE, but I found the debugger to be more of a hassle than it was worth. I'm still using the IDE, but I'd probably be just as well off with a plain text editor.
You might want to check out Zend (www.zend.com). Most of their tools are commercial based, but they have some free tools that help you run PHP on your own machine.
I don't personally use a PHP framework, so someone else will have to help you with that one.
When I was first introduced to PHP, I was directed to these free instructional videos.
While they don't directly address your question, I'd be wrong to not perpetuate the kindness by sharing them with a new, novice enthusiast.
Good luck!
You are asking a lot of questions at once, which are fairly simple questions but the real answer is you need to learn a bit more about web development in general in order to give yourself a broad knowledge of the web development ecosystem. Stack Overflow is not good at giving you 'how do I program in PHP', it's better for specific questions like 'how do I sort an array by string size' or something like that. For learning how to program, you need to learn this yourself.
The wikipedia page on web development gives a very broad overview of how things like server-side, client-side etc fit together - so broad as to not be particularly useful for those wanting to achieve anything in particular, but suitable for people coming across web development from not knowing the difference between an application and a programming language. An equally broad knowledge of http is also helpful, and since you brought it up, it also looks like you are having difficulty understanding what ajax is.
For PHP specifically, the PHP manual contains everything you need for all but the most obscure questions, providing you have picked up a few programming skills already - and if not, I recommend you take a course or something, since if you haven't been programming since you were a child you probably won't take to this kind of thing quickly.
A little-known but powerful solution for AJAX in PHP is Xajax. It allows you to call PHP functions asynchronously as AJAX calls, making it by far the most familiar solution for people familiar with PHP but not Javascript.
Beware, however, that a huge portion of the users are based in Europe so the help forum can be VERY difficult to understand and official documentation is similarly spotty.
I personally always advise against using a book to learn--stick to quality websites (which ones become very obvious very quickly) By the time something is put into print, it's usually out of date or has been superseded by better technique. While the basics don't change much, there are many day-to-day things that experienced developers use regularly that you won't find in a book. I also advise learning the basics of development first (object oriented theory, logic progression, arrays, etc) before learning the specifics of any language. PHP.net can define specifics all day, but it's far more difficult and time consuming to learn MVC theory on the fly. Finally, if you have some money, I can't say enough good about Zend's certification training.

Going from a framework to no-framework [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've been developing in PHP for about 8 years as a hobby. In 2009, I picked up codeigniter and since then I've not managed to get a single project developed.
I find it slows me down trying to work out how to modify it to work the way I want, when if I was working in pure PHP, I'd know, or I'd be able to quickly find a snippet for.
I've tried CodeIgniter, Kohana and Symfony. I love the ease of use (and I've also started using doctrine as an ORM which massively sped up my database work), but I find projects are taking me 3-4 times the amount of time it took in pure PHP. I get bored and frustrated when I can't find a solution to a problem I've previously solved in pure PHP.
Has anyone gone back from using frameworks to a no-framework approach. Is there anything like a basic security framework (prevent XSS, filter posted data, provide a cleaning function for use with databases)? I think something like that would benefit me much more than a full scale framework. I think learning to work with frameworks has taught me a lot, but I'd be happier working with my own code.
Current versions of PHP5 include much of the security framework you're looking for as part of the standard library.
Use filter_input_array to declaratively sanitize stuff coming in from the outside.
Access your database via PDO with parameterized SQL to prevent SQL injection attacks.
Use the following PHP settings to make your site more resistant to session fixation and cookie theft:
session.use_only_cookies (Prevents your session token from leaking into the URL)
session.cookie_httponly or the httponly attribute to session_set_cookie_params() (Protects against scripts reading the session cookie in compatible browsers)
More suggestions and PHP example code available on Wikipedia.
You can also use the httponly attribute with setcookie().
Nothing fancier than basic templating and header-setting is required for new HTTP and HTML5 features:
HTTP Strict Transport Security (Helps protect against WiFi exploits.)
X-Frame-Options (Restrict embedding of your pages. Good against phishing.)
HTML5 IFrame Sandbox Attribute (Sandbox 3rd-party ads/badges/videos. Already in WebKit. Likely to be at least partially implemented in Firefox 11.)
Content Security Policy (Firefox 4's new security framework, complimentary to the sandbox attribute. Now also being implemented in Chrome.)
If you're accepting HTML as input, I recommend grabbing HTML Purifier and calling it via a FILTER_CALLBACK line in your filter_input_array setup. Its whitelist-based approach to input security makes a great (and very powerful) first line of defense against XSS.
As far as I can tell, PHP doesn't come with a mechanism for protecting against cross-site request forgery, but I'm sure Google can help you with that one. The OWASP Security Cheatsheets include a section on it if you want to implement your own protection.
Out of curiosity, I decided to also start looking at standalone components and here's what I've found so far:
Templating:
PHP Template Inheritance (Regular PHP plus template inheritance)
TWIG (Django/Jinja2/Liquid-style syntax including autoescape and sandboxing. Compiles to cached PHP for speed.)
Dwoo (A faster, more featureful, PHP5-ish successor to Smarty. Includes a compatibility system for existing Smarty templates.)
Stuff I still haven't looked into properly:
Route dispatching (Only found RouteMap and Net_URL_Mapper so far. Thanks, cweiske.)
ORM (Just in case bare PDO isn't your thing)
I don't believe in frameworks... I have worked in many of them.
Reasons for hating MVC frameworks:
1) Code bloat, I purchase premium classes that assist me in development. Such as form classes or SQL classes.
2) I believe that MVC frameworks are not easily portable especially when using dependency managers.
3) I believe that you actually write more code with a MVC framework then if you had to use a boilerplate with a ton of useful classes that handle authentication etc.
4) Most frameworks also cater for just one or two databases natively.
I would suggest finding a form framework with authentication and text editor & a sql framework like madoo + a email class...
90% of your application is always forms , sql & ajax CLASSES - the rest can just be acquired when needed
I am a minimalist and I struggle with the idea of having code in my application that is not doing anything ... just in case I need it does not work for me.
With that much experience behind you, you must have your own set of favorite libraries, hand pick them and come up with your own simple framework. Framework or no framework (and which one at that) depends on the kind of project at hand, no glove fits all. So i would strongly suggest that if you feel that the existing frameworks are slowing you down, spend sometime and come up with a framework which works as per your needs.
Based on your statement that you've been using PHP as a hobby, as well as your profile statement "Slowly getting there", this seems like a learning curve issue. You don't appear to have the depth and breadth of experience to a) understand how to work within the structure that the framework imposes and b) you are thus unable to benefit from the efficiencies that the framework enables.
I urge you to stick with it. Go back to the beginning with the video tutorials. Find and read other peoples code until you understand it. Build your projects from the bottom up - start simply, and add functionality. Follow the forums, trying to answer questions yourself before reading replies.
I've been programming professionally for almost 20 years, across a variety of platforms, and it still took me a while to become comfortable with CI. But now that I am, I wouldn't go back to pure PHP (for my own projects) unless I had a site of sufficient scale that it exposed quantifiable performance issues (think Twitter).
Zend Framework is really super for that. You can use as much or as little as you want. Its all coded in php and open sourced so you can just hack at it and make it your own. The different component are not dependant on eachothers as much as in other frameworks.
You could build yourself a simple framework using some components from Zend without any problems.
Check it out!
I Know exactly the way you feel. I started 4~5 years ago in PHP (I came from Delphi, lol), and started in pure php. What I had back them was a "CMS Panel like" wich just read all tables fields and create the form. After sometime I reached somehow in the knowledge of PHP Frameworks, I tried CakePHP for first and didn't liked, after, got into Yii wich in my opinion is pretty intuitive and easy-use (With it's Gii generator it rocks pretty much). I Tried Symfony, ZF2, Laravel, Yii2-Beta and some frameworks for RAD, but still I wasn't feeling fast enough like before the frameworks.
Happened that I developed my own framework (It was naturally, not exactly that I woke up some day and said "I'm going to create a new framework", happened with the time) . I Know it's a bad bad bad practice and "wheel reinvention" move, BUT, I now develop my projects much faster (more than PHP only).
Since it's code is a total MESS, I started about one month ago to reformulating my framework, now it uses composer, follows common rules that exists between the php frameworks, is MVC.
Why I'm reformulating ? Because if someone needs to repair a project of mine it will not be a another world thing.
So I Understand you.
My Advice is, prepare your tools (call it a framework, a preset-app or whatever people names it), and use it the way you feel better, but still follow some common rules (Like MVC, "easy to module" things wich you can replace in case of broken.
For basic security, I use a custom filter method that wraps up my superglobals. Its syntax needs some getting used to, but is simpler than the PHP filter_var() API and doesn't let you slip sanitization:
$_GET->text("inputvar") or $_POST->name["field"]
It also allowed inline $_REQUEST->sql() escaping. But for database work keep using parameterized SQL, or your DAL/ORM of choice.
I did a one day study of ToroPHP and found it quite nice. It is a minimalist framework targetted to RESTful applications. This makes it possible to keep the server side code modular, without having to deal with bloat of any framework.
I don't know what is troubling you but codeigniter is a great framework.It has nice documentation and since lots of people use codeigniter you will find all the help in its documentation,or forum or on stackoverflow.I have worked on many frameworks (Codeigniter,CakePHP,Zend,Spring 3.0, Ruby on Rails),but I must say codeigniter has the best documentation.There are lot of things in codeigiter which are automatically handled and you don't have to worry about security.
Working on core PHP is like re-inventing the wheel. Well the most important thing is that moving from a core to framework will need lots of your effort once you are used to it, you will start loving it.Also Ruby on rails is also a great framework once you know its ins and outs you can have double speed.

Is there a high-level language for the web?

Preamble
To build dynamic web-sites, we have to master at least four languages:
HTML for the structure of web pages
CSS for layout and design
JavaScript for interactivity
A language for business rules or dynamic driven data
In addition, there's SQL for persistent storage, Memcache for sessions and caching, APIs for the many different content management systems. We should also consider interacting with OpenID, Facebook, Twitter, OpenSocial in building a web application, for it to be interesting.
All in all, it's an utter mess!
If you take into account two objectives:
Teaching web development to kids
Staying productive as a team
Question
What high level systems exist that unify HTML + CSS + Javascript + (Insert High Level Language here, PHP preferred)?
Background
I am a software engineer with 15+ years of experience as project lead and developer with technologies like Broadvision, Autonomy, Enterprise Java, and Oracle.
During recent years, I have focused on the developing community websites, using Drupal or PHP frameworks such as CakePHP. I like web development and enjoy the impedance mismatch between the technologies involved. Still the inevitable conclusion I come to is there must be a better way.
I am the father of two sons (13 and 9), and while I don't want them to become programmers I would like them to comprehend computers as more than gaming machines. I like to motivate them to tinker a bit with web development to express themselves.
Whenever I show them bits and pieces, I would love for them to have a toolset that allows them to create "interesting" results in an hour or two on a Sunday afternoon.
GWT goes someway towards being a high level toolkit, letting you write Java to produce Javascript.
"Links is a new programming language designed to make web programming easier. . . Links eases the impedance mismatch problem by providing a single language for all three tiers. The system generates code for each tier; for instance, translating some code into Javascript for the browser, some into a bytecode for the server, and some into SQL for the database."
At first I wasn't going to post this, since it's a research project, not a production system; but all these answers saying "that's how it is, deal with it" begged for a counterexample.
Web programming is an inherently multi-discipline craft.
The primary reason for this is because of seperation of concerns...the reason that HTML and CSS and JavaScript, SQL, etc, are not mashed together in one language is because they each have seperate goals, caveats, pitfalls, and strengths.
Can you imagine trying to debug a site that has SQL, CSS, JavaScript and PHP code mixed together in the same source files? You may have already had the misfortune of doing so. Sadly, there are literally thousands of sites written like this, and it is a complete nightmare trying to debug or add to such messy amalgamations of presentation, data, and structure.
All in all, an utter mess! How is one
supposed to teach web development to
kids?
I think the most important thing is teaching the fundamentals of programming and making them stick. Variables, logic, pointers, memory management, algorithms, data structures, etc.
When you have the fundamentals of programming, it's easy to work in multipe languages, pick up new ones, and easy to change with the times. This is an invaluable skill for something as constantly-evolving and trend-based as web programming.
In my opinion people new to programming should be started at lower level languages, like C for example. People should be tought the intrinsic, fundamental concepts of programming and should gain knowledge of what is going on behind the scenes before even being shown a higher level language like PHP or Python.
I think that this attitude towards teaching programming will have the effect of breeding better web developers as well as providing a barrier of entry that will weed out people that don't have the interest or intelligence. I think the result of this type of attitude will be better developers, better software, and ultimately more powerful languages and tools.
How is one supposed to teach web development to kids?
An army of kids in web development is what has degraded our profession since now just about anyone calls himself a programmer while it's getting harder and harder for us to get distanced from them and get decent pay.
Many languages and technologies to master? It's a good thing. Let there be some entry barrier to join the ranks of developers.
ADDED: By following comments I can see I have not made myself entirely clear. I say nothing about the age, be it 10, 30, 50 or 80. It's all about attitude. Whether a person understands and accepts the fact that there is much more to the profession than moving controls with a mouse in some designer or CMS. There is a lot of knowledge to be gained, including basics of CS, algorithms, data structures, databases, architecture, extensibility, maintenance, performance, scalability, usability, marketing and much more that belong to the workshop of a professional software developer. I a person is ignorant of those and doesn't make a move to educate themselves and strive to become more and more proficient, they do not belong to the profession. And let this opinion be biased.
The closest I think you'll get is .NET. There are many frameworks for many languages, but none that I know of that handle absolutely everything. Beside that you must not attempt to convince children that programming is a walk in the park. It's a difficult career, that requires a lot of study and keeping-up. We work with technologies that are here today, and gone tomorrow.
If you think about it, programming isn't any different than carpentry, or aeronautics. Just about any profession you chose will require you to learn a lot of different things to be better at what you do.
How are you supposed to teach web development to kids? Wow, that's a thorny one. How does one go about teaching them surgery, or intellectual property law, or civil engineering? Or for that matter auto mechanics, or plumbing, or general contracting?
Have you thought about popping in a Sesame Street tape?
Elmo doesn't like it when you trivialize his profession.
Software industry is suffering from unqualified individuals doing nothing but creating poor quality products and at the same time distancing this profession from becoming a true engineering discipline. This isn't something to get certified on. For the love of god, don't 'teach' anyone software development. Explain to them that making great software only comes out as a result of years of experience and wealth of knowledge of past and current technologies. The worst you can do is introduce yet another half-baked developer creating work for others working with them. Tell them to get educated. I know this isn't the answer you probably wanted to hear, but I wanted this to be read.
I think the problem with web development is that it was not originally designed for what it is used today. We build rich client applications inside a browser with HTML+CSS+JavaScript plus whatever serverside technology generates it. Yes, it works, but it's a pain, especially with those annoying browser incompatibilites. The existence of Flash and Silverlight proves this. They let you build your app with one single technology, still inside the browser. The downsides of needing a plugin for your content is obvious though.
The languages are the least of your worries. It's the problem domain that they work with that is complex. Using different languages actually makes things more manageable because a) It makes the boundaries explicit and b) the languages can be optimised for the domain.
Programming (PHP/JS) and document format (HTML/CSS) are 2 different things.
Learning to program in PHP and JS at the same time will also be difficult.
You should focus on HTML and JS on the client at start. You could then let them program javascript on the server as well. This will make it only one programming language, and focus on HTML over CSS to start with.
Once they've learned the basics of JS and HTML, you can teach them a more widely used server side programming language (like PHP, Ruby, etc) and CSS.
Django can take you part of the way through its cleanness. It is focused around productivity. Teaching is not easier than any other language/framework, but look at it this way: when taught this tool, your students are well equipped in their knowledge of how easy it should be. They will never accept Java servelets or similar nightmares after having learnt Django.
Check out Opa: http://opalang.org/
This is an up and coming web development technology. It looks quite promising. I have done a lot of web development over the past couple years and if I had to make a prediction which up and new framework/language/technology is going to be the primary way websites are developed in ~5-10 years I would say it will be Opa.
The documentation is great, the community is great, the tutorials and responsiveness to questions asked of the team working on the project is excellent. Overall they seem to have an attention to detail in regards to developing this new framework that seems to be unmatched.
Many technologies to master is not a good thing. We need a Visual Basic for the web, no matter what the elitists say.
You need different languages for different purposes. In most web applications there's actually quite a bit going on, so you need the different languages and solutions.
If the goal is to unify on a single language, you can do that. You can use Javascript on the server, and then build the pages using document.createElement() and apply styles to them directly to the styles property. And on the server, store your data directly in files with Javascript.
Obviously this wouldn't work out that well. HTML is not perfect, but there is a reason it is so ubiquitous-- it does what it does simply and well. CSS is both convoluted and too simplistic, but the underlying idea of defining overrideable rules to express your design is sound. And SQL may be a pain to understand at times, but expressing database queries this way is expressive and actually works pretty well.
That being said, I'm not saying there is or should be one architecture. There shouldn't be. Each project should use an architecture in line with its requirements.
On your next project try to simplify: do you really need a database? Can you combine the view layers to simplify, either using something like GWT, Applets, Flash or .NET? Do you really need to serve up your content in a browser (which introduces CSS, HTML and Javascript complexities), or can you just write an application?
I think your approach might need to be rethought. Take this for what it is, my opinion, but I would think this ordering might work better.
Top Priorities: (no particular order)
Develop problem solving skills
Be productive as a team
Next:
Basic Programming skills (PHP, Python, etc)
After they know how to solve problems as individuals and as a team they can move onto specifics such as:
Client/Server model
Markup (HTML, XHTML, XML, etc)
Styling (CSS)
Client-side scripting (JavaScript / jQuery)
Server-side scripting (PHP, Ruby, etc)
Build up their knowledge of what's involved piece by piece rather than jumping into the deep end off the bat - they'll be quickly overwhelmed.
At this point you can start to introduce things like file I/O and databases.
This will give them a fairly comprehensive skill-set. From here they can really start learning.
In addition, one may have to deal with SQL for persistent storage, Memcache for sessions and caching, APIs of content management systems, OpenID, Facebook, Twitter, OpenSocial etc. to build anything interesting.
These are whole topics unto themselves, you can't bite them off all in one chunk. Especially if you're taking these people from 0. Before you can build something interesting you have to learn to build something mundane.
HTML5 will probably be more in the vein of what you're looking rather than Flash or Silverlight but it's not quite here yet...Though support is building.
Baby steps, Olav - if this were The Matrix you could download all that info in one shot but we're not there...yet ;-)
For the moment, and near future, web development is the synergy of many different technologies working together to deliver an interesting user experience.
Well, that's my 2 cents
The multi disciplinary nature of web development is one of the things that makes it a joy to work in, especially in a team environment.
To work well as a team, you naturally come together with a group of people with a range of expertise, from UI/graphics people down to DBAs and sys admins. Even within a single layer of the group (for example back end programmers) each person generally specialises in a different set, for example some people may have more experience up towards UI, others down towards data.
I would take this variety any day, compared to working in a room of 10 java programmers all working on some middleware application.
If you simply want to teach them to write dynamic websites, set them going through the HTML tutorial on w3schools.com and once they're done, find yourself a decent looking stylesheet that they can include and set them going with PHP. That'll get them up and running as a hobby, and if they want to do more, they can start piecing together extra knowledge, like CSS and JavaScript.
Ruby on Rails goes quite a way towards unifying all of those, but for CSS it leaves you out in the cold (though there are probably a few frameworks for RoR that make CSS obsolete, but then you have another markup language, I think), and you still need Javascript (though it does write a lot of Javascript for you, and all DB code).
On the other hand, about your kids: programming is for programmers. On a Sunday afternoon to put something together in a few hours, you would need to know a framework, and buy some plugins, and get everything up and moving without much work. Something like Drupal or Joomla, where they sell templates (for Joomla you can buy packs of hundreds) and plugins to do all kinds of things. And when that fails, your kids should probably know how to go on ODesk and drop $100 to get something done on your framework. Learning to programming is good if you want to be a programmer. Otherwise, it's best to learn what you need to hire good programmers or buy good predone components, and have the cash to do it.
Last point about the kids: let them play video games. That is the best training that they can get for whatever the future holds in store on the computer side. Video games let you investigate, play, and relax with the computer. Once you have that, learning HTML, CSS, Javascript, and some application stack is cake.
angularjs could be an option. it is inteded for single-page-applications and runs on a nodejs-stack and does some template-javascript "magic".
example (template/code):
It binds(via auto-generated-client-side-js) the value from the input-field to the the heading(h1).
If you type something to the input field, the text in the heading gets updated.
And you don't have to write the frontend-js.
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<h1>Hello {{yourName}}!</h1>

How to use PHP for large projects? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
The question has been asked: No PHP for large projects? Why not? It's a recurring theme and PHP developers--with some cause--are forced to defend PHP.
All of these questions are valid and there have been some responses but this got me thinking. Based on the principle that you can write good code in any language and bad code in any language, I thought it worth asking a positive rather than negative question. Rather than why you can't, I wanted to ask how you can use PHP for large projects.
So, how do you write a large, complex, scalable, secure and robust PHP application?
EDIT: While I appreciate that the organizational aspects are important, they apply to any large project. What I'm primarily aiming for here is technical guidance and how to deal with common issues of scalability. Using an opcode cache like APC is an obvious starter. Cluster-aware sessions would be another. That's the sort of thing I'm getting at.
For the most part, the problems with php are not so much with the language. The problems come from the coupling of a low barrier of entry and the lack of any infrastructure to avoid common programming problems or security problems. Its a language that, by itself, is pretty quick-and-dirty. Nevertheless, it still has many advantages for large-scale web apps. You'll just need to know how to add in some level of infrastructure to avoid a lot of the common web programming blunders. See - What should a developer know before building a public web site for help with this.
You need to learn about the reasons php can make your web app to be insecure or problematic and learn to mitigate those problems. You should learn about how to use php to securely access your database. You should learn about avoiding SQL injection. You should learn about evil things like register_globals and why you should never ever use them. In short, you should do your homework about your tool before just diving in for a real-world, large-scale, web app.
Once you are educated, it comes down to you'll probably want to build a framework or use a preexisting framework that will mitigate these problems. Popular frameworks include PEAR and Zend.
Also, useful questions that might help:
What should every php programmer know?
What should a developer know before building a public web site
Using PHP for large projects isn't different than with any other language. You need experience and knowledge in writing maintainable and extendable source code. You need to be aware of security pitfalls and performance concerns. You need to have researched your problem domain and be well familiar with it.
In the end, same as any other language - what you need are high-quality and well-motivated developers.
i know, this is a little out of date, but still, i'll tempt an answer ...
use Haxe/PHP ... i could delve into details ... but if you look at the language, its features, and the nice way the PHP API is encapsulated into something rather consistent, you will soon see, what PHPs problems are ... and also, you have all the benefits of Haxe in the end ...
edit: this was a serious answer ... Haxe/PHP automatically solves a lot of problems mentioned in the post flagged as answer ...
register_globals is turned off ... you get your parameters through the php.Web
using the SPOD-layer (same API for php) for the database automatically takes care of escaping (and will automatically provide your model (and templo is quite a good template engine, so that should help for your views))
having a typed language, you are more likely to write better code ... plus language features as generics and enums are very powerful ... and there is a lot of compile time magic in Haxe that is also of interest ... a more powerful language is always good to adress complex problems ...
if you want to use other PHP frameworks, you only need to write the external classes and everything will work as expected ...
i think Haxe is a very good answer to "large", "complex", "secure" and "robust" ... scalability does not come from Haxe itself of course ... but still, if you check out haxelib, then you find many things, that would help for scalability ... such as memcached (you will have to change neko.net.Socket to php.net.Socket in memcached.Connection) ...
if you really want to use the PHP language, and not just the platform, Haxe won't help you of course ...
You do as you would in any other language or any other enviornment.
There are a couple of simple steps in project development:
Organization; You need to organize everything, having documentation, uml diagrams and other pre-work done, before you start programming.
Structure; Before you start coding and also aftter starting, you need to have a focus on structure, meaning that you always need to do it correctly and not do any spagetthi solutions. Keep code simple and well commented.
These two points, are simple and apply in all development areas, despite the language. Keep it simple and well documented and you will find that developing a large scale web app in PHP is as easy as it would be in ASP.NET, Ruby or whatever.
However when we come to the development stage, you need to get a nice IDE, use a good database, use a repo., get an MVC / Template system, this runs in the "Structure"-part though.
Just as a side point, splitting the application into different layers: DLF ( Data, Logic, Front ). Use at least these three layers and you will find that the development will go easy.
Use Model-View-Controller framework. It's been said, yes. And, have at least one engineer for each part.
Model: Your DBA should write the Model code. No should else should be allowed to write SQL statements.
View: The one with the best knowledge of CSS and Javascript should do the view part. He/she should write the least PHP code, he is the one using PHP variables.
Controller: She's the real PHP coder, and also back-end server engineer, hopefully, with or without using other script languages.

Categories