Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Hashim Warren
Front End Web Development Techdegree Student 1,207 PointsBecome a PHP Developer - why is Javascript & CSS last?
I'm on the "Become a PHP Developer" track and I'm learning from scratch. I thought I would stack my knowledge and go from HTML to CSS to Javascript to PHP.
But I see that CSS / Javascript comes after. Why is that?
Nick Pettit
Treehouse TeacherHm, that is strange. Our PHP teacher Hampton Paulk might be able to shed some light on this.
3 Answers
Hampton Paulk
5,093 PointsRyan Duchene has made several valid reasons why we could explain CSS and JS being placed at the end of the track. The simple answer is that you learn the basics of css during the Build A Simple Website Basics stage of the track and we do not need to have a deep understanding of JS to get you started on the courses involving PHP. However, you do need these skills to be a well rounded PHP developer, or any web developer for that matter, so we use these at the end to round out your skills. This does not mean that they will not be rearranged as new content is released into the track. Hope this answers your question Hashim Warren.
Ryan Duchene
Courses Plus Student 46,022 PointsI can't answer the CSS question; it does seem kind of odd to me that you go from HTML to PHP to CSS.
But I think I can answer the JS question. When I started programming (if you can call HTML/CSS "programming"), I thought the same way you do now. Finish HTML/CSS, go on to JavaScript, and then try PHP/MySQL.
I think the reason why Treehouse teaches PHP before JavaScript is because, in most cases, client-side scripting (i.e., JavaScript) is a popgun compared to server-side scripting (PHP, Ruby, etc.). Unless you're going to be working on the next Google Maps, JavaScript will not play much of a part at all in your site or app.
Much of what client-side programming can do (1) is getting shifted to CSS as new CSS features get wider support and as CSS gets more powerful; or (2) can be accomplished entirely through the use of server-side scripts (PHP), but the inclusion of client-side scripts in these situations simplifies the process for the end user. Even Ajax requests--which are by far and large the best function of client-side scripts, in my opinion--are usually unnecessary (but helpful) to use.
And even if you are working on building the next Google Maps, you still have to build the server-side script that responds to the client's request. And you don't actually need to use client-side scripts to embed Google Maps into your site, anyway.
Now, don't get me wrong. Every developer should have at least have a rudimentary knowledge of JavaScript. It can do a lot of neat tricks, particularly in giant applications like Gmail and the aforementioned Google Maps.
But those tricks are--well, tricks. The real stuff is server-side.
This is just my personal opinion. Other people may very well think differently, and I'm not saying they're wrong. This is just what I've witnessed.
EDIT: Changed some references to JavaScript to client-side programming/scripts.
Colin Marshall
32,861 PointsI'd like to point out that frameworks, like Node.js, are becoming popular that use JavaScript server-side.
Ryan Duchene
Courses Plus Student 46,022 PointsIndeed. But this is not client-side programming; it is server-side. The vast majority of JavaScript usage is for the client, and not for the server.
I guess I should have made it more clear that I was talking about client-side programming, rather than JavaScript in general.
Hashim Warren
Front End Web Development Techdegree Student 1,207 PointsRyan Duchene does your advice still apply is I'm primarily building portfolio / lead gen sites on Wordpress?
Thanks for your detailed response!
Ryan Duchene
Courses Plus Student 46,022 PointsI'd say that it applies almost universally: everything from a basic HTML/CSS site all the way up to giants like Facebook and Twitter.
We have two great examples right here on Treehouse. First, the Shirts 4 Mike project. There isn't a single bit of JavaScript/client-side scripting on that site--everything is accomplished by PHP, with help from the Apache .htaccess file and the MySQL database system. But it's PHP doing all the heavy lifting--manipulating data, sending emails, and formatting individual pages correctly--without any help from JavaScript at all.
The second great example is the Treebook Ruby on Rails project. Notice that every bit of the project's functionality is dictated not by client-side scripts, but by the server-side Ruby programming.
I've only completed the first Treebook course and a single badge in the second, but I know some Ajax functionality is added in the second course. I'm not saying client-side scripting is useless; clearly, it's being used right here for some pretty good stuff.
And then we have other examples of this, as well. Take a look at the Treehouse site itself, for instance. There's JavaScript everywhere: appropriately styling the two-column design with the navigation sidebar, styling shadows appear at the top of the page, making Ajax requests to the server to update info, powering dialogs and modals.
But everything is tied back to the server-side programming. Treehouse has terabytes of content stored on its servers, from the video it's so famous for to the images on the front-end of the site to all the user data to all the courses.
Something has to control all that data. And that something is server-side programming.
All the client-side scripts do is add some functionality that users find more convenient. A gallery here for photos. A slider on the front page. A sticky navigation bar. Some pretty cool tricks.
But they're just tricks.
This continues all the way up to Facebook. Yes, JavaScript powers the bulk of of the functionality of Facebook's web APIs and SDKs, as well as the normal modals, dialogs, and Ajax requests for the end user.
But Facebook has over 1.15 billion users for more than 16% of the world's population. It has an ad system that generated over two billion dollars in the last quarter alone.
Something has to control all that data and functionality that Facebook provides. Something has to respond to the requests made through the APIs and SDKs. Something has to create news feeds for users by assembling recent posts by other users. Something has to keep track of all those users in the first place--and their data, including friends, family, likes, and history. Something has to manage the 3000+ photos that get uploaded to Facebook every second.
That "something" is server-side programming.
I could go on and on and on with all the things we've got today: Twitter, Dropbox, YouTube, Reddit, the entire Google arsenal including G+, and hundreds of others (those are just the most obvious ones).
All those services are powered through server-side programming. Not client-side.
Sorry for going on a long, drawn-out post about this. I'm just trying to draw my point out, I guess. :D
(I only did a quick Google on a lot of the numbers above; they may not be entirely accurate)
James Barnett
39,199 PointsJames Barnett
39,199 PointsTagging Nick Pettit on this one