Front End Development @ 2015
Front End Development has become much more relevant now that computing devices can handle the load of a javascript application. There's a push now to handle more work on the front, as it lessens the load of a server, thus allowing for more concurrent users.
I'll be giving a summary of the state of Front End Developement as of 2015. This won't be too detailed (if you want detailed, look for a published article on the subject lol), but this should be a great way to introduce yourself or someone you know to the world of web development.
These are the interfaces we communicate with in the web:
HTML A markup language that describes a page. CSS A styling language that makes the markup look how we want it to. Javscript A scripting language to fill the gaps that the first two couldn't do.
Javascript ranks #1 in the world as the most popular language, according to github statistics. In fact, if you look at the statistics, nearly every top language can be used as a web language. Python with Django, PHP, Ruby, C++/C with web interfaces, even shell commands can manage a web application. Since the internet is the most popular part of computing, this should come as no surprise.
With the advent of new exciting standards to the web, and browsers being updated near constantly to keep up with these standards, it's an exciting time to be a web developer. Here's a few new things as of 2015-2016.
Serverside HTML5 Frameworks Languages NodeJS WebGL React+Flux ECMAScript 6 PHP 7 WebCL Angular Scala Ruby on Rails 4.2 WebAssembly Ember Go
Theoretically, anything you can imagine should be possible on the web with enough time/effort. You can always make a native interface to communicate with native APIs, such as the current state of WebCL, where you need a plugin for it to work properly. Whole applications can be written on the web, here's a few examples:
Piskel - A Web Pixel Art Editor which uses the HTML5 Canvas
DeviantART Muro - A web image editor on par with Photoshop/Gimp which uses the HTML5 Canvas
Artstation - A community for professional artists to share their portfolios written in Ruby/Angular
eBay - A selling community for individuals and businesses to sell products.
Unreal Engine - A game engine that can now export Web Games.
So you can build communities, applications that can export files, games with common game engines like Unity or Unreal Engine, and use emscripten to compile languages like C++ to javscript. That should show the true power of web app development.
Front End Development vs Back End Development
Front End Development is developing for the browser, in other words, HTML, CSS, Javascript, and meta information like cookies, HTTP headers, WebStorage, and other browser features.
In contrast, Back End Development is developing for serverside preprocessing systems, such as databases, pipeline systems like Gulp, package management systems like Bower or NPM, shell scripts, server systems like PHP or NodeJS. When you can develop both sides, you're called a Full Stack Developer.
Bear in mind, nearly everyone who's a web dev knows both sides of that spectrum, so choose one you perfer to specialize in the most, since both have a great deal of topics. Here's a few topics that encompass front end development, you'll notice, they're all artistic in nature.
Javascript (Coffeescript, Babel, Typescript, BackboneJS, Angular, Jquery)
A Front End Developer is similar to a User Experience Designer, or UX Designer; the line is hard to define, a front end dev tends to focus more on code, whereas a UX Designer tends to focus more on design/prototyping.
There's no definition of what's good or bad art, but here's a few resources on some of the choices professionals in this field are taking.
Dribbble - The biggest UX Web Community
Codrops - Popular new Web Design Projects
Codepen - A Front End Developer Playground
Yes I know, HTML is really the structure, the model of a website, I'm just trying to go for a theme, hear me out lol. Let me know the theme at the end for a cookie. :3
HTML, or Hypertext Markup Language, is the structure of your website, how things are layed out. Think of it as a text version of folders, where objects are inside other objects in a nested form.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<!--Where you put your css/js-->
</head>
<body>
<!--Where you put your elements-->
</body>
</html>
That's the basic structure of an HTML page, of course, it can get far more complicated if you want it to. :)
<head>
<!--Meta Information-->
<title>My Website</title>
<meta charset="utf-8">
<!--Mobile Stuff-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="mysite-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="mysite-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="mysite-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="mysite-icon-ipad-retina.png">
<!--Twitter-->
<meta name="twitter:card" content="mypicture">
<meta name="twitter:site" content="@MyTwitter">
<meta name="twitter:title" content="My Site Title">
<meta name="twitter:description" content="A Description">
<meta name="twitter:image" content="http://mysite.com/linktoapicture.png">
<!--Facebook-->
<meta property="og:image" content="http://mysite.com/linktoapicture.png" itemprop="thumbnailUrl">
<meta property="og:title" content="My Site Title">
<meta property="og:url" content="A Description">
<meta property="og:site_name" content="MyFacebook">
<!--Google, Bing, Yahoo Robots-->
<meta name="description" content="A Description for Search Engines">
<!--Stylesheets-->
<link rel="stylesheet" href="stylesheets/main.css">
<!--Javascript-->
<script src="js/app.js"></script>
</head>
You can stuff your head element with a ton of information, like giving help to facebook's robots that look at your site when someone links it on facebook (SEO Meta info), icons for iOS (and Android, they take those icons too :P).
There's a ton of elements you can put in your body, I'll just list a few:
<html></html> Creates an HTML document
<head></head> Sets off the title and other information that isn’t displayed on the web page itself
<body></body> Sets off the visible portion of the document
<pre></pre> Creates preformatted text
<hl></hl> Creates the largest headline
<h6></h6> Creates the smallest headline
<b></b> Creates bold text
<i></i> Creates italic text
<cite></cite> Creates a citation, usually italic
<em></em> Emphasizes a word (with italic or bold)
<strong></strong> Emphasizes a word (with italic or bold)
<a href="URL"></a> Creates a hyperlink
<a href="mailto:EMAIL"></a> Creates a mailto link
<a href="#NAME"></a> Links to that target location from elsewhere in the document
<p></p> Creates a new paragraph
<br> Inserts a line break
<blockquote></blockquote> Indents text from both sides
<dl></dl> Creates a definition list
<dt> Precedes each definition term
<dd> Precedes each definition
<ol></ol> Creates a numbered list
<ul></ul> Creates a bulleted list
<li></li> Precedes each list item, and adds a number or symbol depending upon the type of list selected
<img src="name" alt="For Accessibility"> Adds an image
<hr /> Inserts a horizontal rule
<table></table> Creates a table
<tr></tr> Sets off each row in a table
<td></td> Sets off each cell in a row
<th></th> Sets off the table header (a normal cell with bold, centered text)
Table Attributes
<form></form> Creates all forms
<select multiple name="NAME" size=?></select> Creates a scrolling menu. Size sets the number of menu items visible before you need to scroll.
<option> Sets off each menu item
<select name="NAME"></select> Creates a pulldown menu
<option> Sets off each menu item
<textarea name="NAME" cols=40 rows=8></textarea name> Creates a text box area. Columns set the width; rows set the height.
<input type="checkbox" name="NAME"> Creates a checkbox. Text follows tag.
<input type="radio" name="NAME" value="x"> Creates a radio button. Text follows tag
<input type="text" name="NAME" size=20> Creates a one-line text area. Size sets length, in characters.
<input type="submit" value="NAME"> Creates a Submit button
<button type="submit">Submit</button> Creates an actual button that is clicked
There's way more elements, and old HTML 2 and 1 ways to style these elements, but let's pretend those don't exist for now. :P
HTML is only one of the many markup languages you can use in the web, others include XML (Used in SVG elements), and preprocessing languages like haml or jade.
SVG - Vector Art on the Web
Vector Art is art that is defined by vectors (I kinda defined the word with itself lol), which could be scaled to any size, which is important for the new web where a user could be on a mobile device that tells the browser to render 400px wide, but the phone has a 2560x1600 display. (so 1600 px wide in reality, 4x bigger!)
Jade is a simplified version of HTML that allows for things like variables, functions, includes, and inline javascript execution. It's popularity came from NodeJS, which needed a templating system.
Other templating langauges for HTML include:
Haml (The first templating language, a bit more verbose then the others.)
Slim (Looks nearly the same as jade, but was designed for ruby devs)
Markdown (What this presentation was written in!)
And of course, you can always write your own templating language or system.
CSS, or Cascading Style Sheets are a declarative language that can overwrite itself as you write more later. By overwrite later, any css that selects the same stuff as before will overwrite it, but only what you added!
<style>
p {
color: red;
text-align: center;
}
</style>
<p>This is red.</p>
<style>
p {
color: green:
}
</style>
<p>This is now green, but still centered!</p>
That's the Cascading part of Cascading Stylesheet.
By default the browser provides you with some default styles, and these could vary from browser to browser. Therefore, most web applications feature a starter css file that resets these elements, reset.css, at the top of their stylesheet, or as the first imported stylesheet.
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
With this, you can see the syntax of CSS. First, any style declaration with a , is applied to both selected items beside the comma.
Next, you see that comments are denoted with /*comment*/, unlike most languages, you can't use the //doubleslash comment syntax on css (but you can in scss).
Next, you see a : acting as a meta selector, :before and :after acting as selectors for some extra elements that can be created from one element, their "before" and "after".
finally you see that to select an element, you can just use the element's name. div { ... }.
So CSS is built around selecting something, be it an element like the html element, or a Class, a special selector that you can call on with the class attribute of an html element, like so:
<style>
/*In CSS, class selectors are denoted with a period.*/
.red {
color: red;
}
.bold {
font-weight: 500;
}
</style>
<p class="red bold">
Red and Bold!
</p>
Pattern Meaning * Matches any element. E Matches any E element (i.e., an element of type E). E F Matches any F element that is a descendant of an E element. E > F Matches any F element that is a child of an element E. E:first-child Matches element E when E is the first child of its parent. E:link E:visited Matches element E if E is the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited). E:active E:hover E:focus Matches E during certain user actions. E[foo] Matches any E element with the "foo" attribute set (whatever the value). E[foo="warning"] Matches any E element whose "foo" attribute value is exactly equal to "warning". E#myid Matches any E element ID equal to "myid".
There's more patterns than this, but these are what most people use.
SCSS - CSS with Superpowers
Most Web App developers don't write an application with pure CSS, since that can get huge fast. In comes preprocessor languages to the rescue again. SCSS (or "Sass CSS"), is a easier version of CSS, which features things like variables, functions, and includes. (Sounds familiar?)
The file structure of a SCSS project should look like the following:
|- stylesheets/
|- modules/
|- partials/
|- base.scss
|- buttons.scss
|- ...
|- vendor/
|- fontawesome/
|- ...
|- refills.scss
Let's define these sections:
Modules are for any Mixins (functions) or global variables you'll be using in your project.
Partials are for groups of items, buttons, forms, your default html.
Vendor is for 3rd party styles like FontAwesome or Google Fonts.
Try to do everything visual in CSS, using javascript as only a last resort.
Javascript (or ECMAScript) is a web language developed for netscape back in the early 90s, but has since evolved to be the most popular language in the world.
Douglas Crockford (Inventor of JSON) calls it the world most misunderstood language due to:
Bad design at it's earlier spec
To see all the design patterns of javascript, please check out one of Crockford's presentations on the subject.
Typescript - A Superset of Javascript
What I'm about to do is crazy talk.
Talking about languages is like talking about sports teams, you're always going to argue that your team is the best. Same goes for frameworks, game engines, art tools, musical instrument brands, we humans just like to side with something. Javascript has tons of preprocessor languages, Babel, Coffeescript, Dart, and with Emscripten, every language that can be compiled to c++. (So basically everyone lol)
I choose TypeScript for this year, since it's the new cat on the block with Angular 2 coming out, but maybe next year people will work with ES6 exclusively, or maybe Coffeescript might win. (Shrugs)
It does seem like Typescript will come out on top though, it is a very elegant extension to Javascript and intuitive if you have experience with other languages.
//ES5
function User(id, firstName, lastName) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
User.prototype = {
getId: function() {
return this.id;
},
getFirstName: function() {
return this.firstName;
},
getLastName: function() {
return this.lastName;
},
setFirstName: function(firstName) {
this.firstName = firstName;
},
setLastName: function(lastName) {
this.lastName = lastName;
}
};
//ES6
class User {
constructor(id, firstName, lastName) {
this.id = id
this.firstName = firstName
this.lastName = lastName
}
getId() {
return this.id
}
getFirstName() {
return this.firstName
}
setFirstName(firstName) {
this.firstName = firstName
}
getLastName() {
return this.lastName
}
setLastName(lastName) {
this.lastName = lastName
}
}
//Typescript
class User {
private id: number;
private firstName: string;
private lastName: string;
constructor(id: number, firstName: string, lastName: string) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
getId() {
return this.id;
}
getFirstName() : string {
return this.firstName;
}
setFirstName(firstName: string) {
this.firstName = firstName;
}
getLastName() : string {
return this.lastName;
}
setLastName(lastName: string) : void {
this.lastName = lastName;
}
}
//Coffeescript
class User
constructor (@id, @firstName, @lastName) ->
getId: ->
@id
getFirstName: ->
@firstName
setFirstName: (@firstName) ->
getLastName: ->
@lastName
setLastName: (@lastName) ->
Everyone and their mother is scrambling to make a thing, something popular, the next jQuery, whatever.
"Real developers just need jQuery, everything else is a fad."
We have Angular by Google, React by Facebook, Ember by Tilde. You've probably are thinking to yourself:
"Google makes the best frameworks!"
Well a lot of what Google does becomes vaporware. Facebook is evil so nope nope nope, and I've Never heard of this Tilde guy.
We have new languages, databases, frameworks, libraries, and plugins popping up every day. How do you choose?
"Well I'll just use what everyone else uses!"
So you're going to use the old proven stuff because it's safe? What if you could do the same thing faster and easier with something new? What if the new thing replaces the old thing! I'm scared, what do I do!!!
There's no real safe place for fanboys, the web is constantly changing, so be prepared to learn something new, odds are it'll just be a rehash of the old stuff with a few improvements anyway. Is anything really new or original?
If you had to make your decision based on the most popular front end frame work as of 2015-2016, the answer would be: Angular, but next year could be different, bear that in mind!
jQuery - Easy referencing of DOM elements
jQuery is by far the most popular javascript library, to the point where it's ubiquitous with JavaScript. It's basically a selector library, letting you tell it exactly what you want changed just like css.
$( "#button-container button" ).on( "click", function( event ) {
hiddenBox.show();
});
So it's basically $(thisthing).doSomething().doSomethingElse();.
Here's an example of using jQuery to have an icon respond to the page scrolling.
Inside the Machine - How it works!
Behind the scenes, jQuery specified two global variables in the javascript project's scope, the jQuery object, and the shorthand $. Thus when you write $('selector'), what you're really doing is calling a function. jQuery automatically finds whatever you selected, and applies whatever you want to every element of what you selected. These could be:
CSS (.hide(), .show(), .css(jsonobj)) - A wrapper for manually changing the .style attribute of a dom element.
Events (.on(event, callback)) - Really just a shorthand wrapper to regular js events.
AJAX (.ajax()) - An API call to the backend.
Jquery uses the Sizzle selector engine as a means of selecting elements. Here's a very simplified version if it.
function Sizzle(selector, ...) {
//nodeType is the kind of query (#id, .class, etc.)
var nodeType = findSelectorType();
if (nodeType === 9) {
if ((elem = context.getElementById(m))) {
// getElementById can match elements by name instead of ID
if (elem.id === m) {
results.push(elem);
return results;
}
}
}
//...
else if //...
{
push.apply(results, context.getElementsByClassName(m));
return results;
}
//...
}
You can actually add functions to the jQuery object, and thus make jQuery plugins!
Angular - A Complete Front End Solution
AngularJS is a front end framework developed by Google which lets you build web apps quickly. It's designed to have expressive HTML with automatic two way data binding, so there would be no need to write selectors with jquery.
Those areas surrounded by Double Mustashes {{ var }} are expressions, they let you write javascript in html. Rather than selecting an element you want to replace with a variable with jQuery, you can just write the variable where you want it! This two way binding is what made angular become the second most popular framework.
var app = angular.module("baseApp", []);
app.controller("baseController", function ($scope) {
$scope.name = "John";
$scope.newName = function() {
$scope.name = "Jim";
}
});
React is a front end system by Facebook which only offers view controls. The reality is, no one framework tries to be monolithic, including angular, they all separate parts of themselves into modules. Thus, React is meant to be used with Flux, a data flow system.
Which is better, one monolithic framework, or several small components to your application? That question leads to another, do you want to maintain your dependencies, or have someone else do that for you? Extra work might not be a good idea for your team, but it does provide you with more freedom.
NodeJS - Serverside Javascript
There's a real allure in having one language to bind the web together, JavaScript. Not having to use Ruby and JavaScript, or PHP and JavaScript definitely seems more maintainable, and it would be easier to deal with turnover if the front end developer can also manage the back end while they hire a new member to the team.
If you want to learn more about Web Development (Front and Back), feel free to visit any of the following:
Dribbble - The biggest UX Web Community
Codepen - A Front End Developer Playground
Shadertoy - A Shader Playground
Codrops - Popular new Web Design Projects
Scotch.io - Web App Tutorials
W3schools - Beginners guide to making websites
Webplatform.org - Docs for all browsers
Mozilla Developer Network - Tons of Web Documentation
Codeschool - Florida based Web training
Corsera - Free University Courses
SlideShare - Linkedin's Slide Sharing Platform
In addition, to get a feel of what a professional front end web developer looks like, take a look at the following portfolios:
Steven Wittens - WebGL Developer
Stephane Lyver - Compressor.io Dev
Jeff Atwood (Coding Horror) - Web Blogger
There's plenty of free ebooks on front end development (There's more than these, but I selected these out of their brevity and detail):
You Don't Know JS - Kyle Simpson
Eloquent JavaScript - Marijn Haverbeke
Programming JavaScript Applications - Eric Elliott
No book will teach you what years of actually making apps can teach you, so check out some of these completed projects and read the source!
[1] TypeScript vs. CoffeeScript vs. ES6: 2015