Coding Category Archives - General Assembly Blog | Page 4

What can you do with coding?

By and

What do the most in-demand 2021 jobs and promising careers of the future have in common? Coding skills. At the same time, new applications of coding are making their way into existing roles, expanding job requirements in traditional fields like banking and marketing. Even for non-tech roles, coding skills are seen as a valuable bonus that can give job candidates an edge.

Our digital world buzzes with software code we use every day, from products and services in the form of websites to mobile applications to games and on and on. 

Computer programmer, developer, engineer, analyst  — these are just some of the titles rapidly populating the job boards of Fortune 500 companies, and coding skills are essential requirements in all of them. Arwa Lokhandwala, who teaches our popular Full-Stack Web Development course, breaks down the various titles and what they really mean.

“Most of these terms are used synonymously, but there is some slight difference between them. A computer programmer, for instance, includes anyone who uses a programming language to produce some digital output — this technically includes everyone who codes. A developer uses a wide array of technical abilities, from writing code and creating technical documentation to testing and debugging. An engineer, on the other hand, is a person who has a strong educational background in software engineering, computer science, and mathematics and can apply these concepts to solve or create digital solutions. Finally, the analyst’s main job is to analyze different metrics, understand data captured by these digital solutions, and derive useful insights from them that are beneficial for the business.”

Additional jobs for coding professionals include web designer, software engineer, and chief technology officer (CTO); myriad roles in the fields of web development, technical project management, and quality assurance; plus, almost every founder of a successful startup has a background in coding.

So, what does a typical career path look like? “You can either start out as a software engineer, software developer, or quality analyst. As you progress, you can become lead developer then either go towards becoming an engineering manager, solution architect or product manager,” Lokhandwala advises.

You don’t always have to make a big move to flex your coding muscles. Often newfound coding skills can help you to advance in your existing job. If you’re curious about how this may pertain to you, Lokhandwala suggests offering to solve a particular problem at your company that you think can be automated with coding and see how that affects your role. The next step would be to take a course in a programming language like Python or fast-track your career with a coding bootcamp like our Software Engineering Immersive. Whether you stay at your job or accept a better offer elsewhere, you’ll gain a distinct advantage in the job market and increase your earning potential.

The practical applications for coding language are vast and growing every day. From medical coding to building websites, freelance to full-time, the jobs that use hard coding skills are varied enough to fit every personality and lifestyle.

Lokhandwala sees many exciting new uses of coding on the horizon, all on the cutting edge of computer science. “Some of the most interesting are in the realms of augmented reality and virtual reality. Using artificial intelligence and machine learning to identify the early onset of diseases has huge implications.”

Want to learn more about Arwa?

https://www.linkedin.com/in/arwalokhandwala-b831b/
https://www.instagram.com/code.with.arwa/

Top 5 JavaScript Interview Questions

By

JavaScript is one of the most popular programming languages. Even though there are many JavaScript-based frameworks like React.js and Node.js, the ability to answer some core JavaScript questions will always give you an upper hand during a coding interview.

So, let’s start with the top 5 JavaScript interview questions!

1. What is hoisting?

Hoisting is a default process wherein JavaScript moves all the declarations to the top of the current scope.

Example:

a=20;
console.log(a) // 20
var a;

Even though the JavaScript variable a is initialized and accessed before it’s declared, JavaScript doesn’t throw an error.

What is the Purpose Of Closures in JavaScript?

As per MDN Web Docs,

“Closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment).” 

In simple terms, Closure is under functional programming, and it allows an inner function to access an outer function’s scope, even when the outer function has already returned.

Example:

const cartMode = function() {
    let items=[] // acts like a private variable
    function addItem(item) {
       items.push(item)
       return "Item added to Cart"
    }

    function totalItems() {
      return items.length
    }

    return {
       addItem,
       totalItems
    }

}

const cart=cartMode()
cart.addItem("Bag") // returns Item added to Cart
console.log(cart.items) // returns undefined
cart.totatItems() // returns 1

In the above example, the items variable is accessible to all the inner functions, but it’s not directly accessible from outside. This happens because of closures

3. What is the difference between let, const, and var?

Before ES6, JS had no way to support block-level scope variables. Now, we have:

  • var for creating function-level scope variables.
  • let for creating dynamic block-level scope variables.
  • const for creating constant block-level scope variables.

Example:

var a = 20

if(a > 10) {
  let b = 1
  const a = 2

  console.log(b,a, 'Inner Scope')   // 1 2 Inner Scope
}

console.log(a, 'Outer Scope')   // 20 Outer Scope

4. What is the output of the following code?

console.log("1")
setTimeout(function(){
  console.log("2")
},0)
console.log("3")

Output:

"1"
"3"
"2"

Even though we specified the delay as 0ms, it still prints “2” after “3.” This is because of the Event Loop in JavaScript. 

In this case, first, console.log(“1”) is executed, then setTimeout() is executed; after the specified delay (in this case, 0ms), the callback function is added to Message Queue. Now the main thread only picks up items from the message queue once the current execution is done. So, the main thread first evaluates the console.log(“3”) statement post. Then, it picks up the callback() from the Queue and executes the console.log(“2”) statement. Hence, the above output.

5. The Difference between arrow functions and regular functions?

Arrow functions are new ES6 syntax for defining functions. It looks like this:

const add = (a,b) => a+b
add(2,3) // 5 

The main difference between the arrow function and the regular function is the value of this keyword.

In the case of arrow functions, the keyword assigns a value lexically. What this means is unlike regular functions, arrow functions never create their own execution context. They, by default, take the execution context of the enclosing function, aka, parent. 

Here is another great article explaining this in-depth. 

Conclusion

Preparing for JavaScript Interviews can feel overwhelming, but you now know the JavaScript code, the programming language, and the scripting language; the only way to really answer an advanced JavaScript interview question is to examine things one concept at a time

How to Go From Zero to Hero in JavaScript Fast

By

JavaScript (often shortened to JS) is a lightweight, interpreted, object-oriented language with first-class functions — it is best known as the scripting language for webpages. It is a prototype-based, multi-paradigm scripting language that is dynamic, and it supports object-oriented, imperative, and functional programming styles.

Now, what does all that mean?

Well, it could be a bit overkill to try to explain those topics if you are just starting out in coding or learning JavaScript. In short, JavaScript most often correlates with client-side scripting on webpages. When you use a website, anything you interact with usually involves JavaScript — a search bar on Google or a dropdown menu on Facebook is all JavaScript.

While JavaScript was originally intended for websites, its uses have far surpassed front-end interactive website usage. JavaScript can be used as a server side-language with NodeJS to create desktop and mobile apps or program different electronics (popular YouTuber, Michael Reeves, uses JavaScript on a lot of his quirky inventions). JavaScript has expanded immensely since its inception with tons of different use cases and massive community support.

The Best Places to Learn JavaScript

There are many ways to learn JavaScript — here are some of the best and the most cost-effective ways.

1. freeCodeCamp

With freeCodeCamp, everything runs in your browser. It has a code editor, console, and example browser window all within site. freeCodeCamp can seem daunting at first due to the sheer amount of content it has, but do not worry. If you are looking to learn JavaScript fast, it has a section called “JavaScript Algorithms and Data Structures Certification” specifically for JavaScript. It will take you through learning the basics of JavaScript and even some in-depth topics such as Data Structures and Algorithms.

Everything else freeCodeCamp has to offer is related to website programming. It even has sections on job hunting. If that is something you are interested in, I would recommend the entire site as it has a lot of great content. FCC also has a Youtube channel: youtube.com/c/freeCodeCamp, where it explains a lot of site topics in a video format.

2. Udemy/Youtube

I put these two in the same category since there is a lot of overlap, and you will see that a lot of people on Udemy use Youtube almost like a marketing tool for their full course. Nonetheless, a lot of Udemy courses range from $10–15 with a lot of good material. Really, one or two courses should be enough to learn JavaScript, so there is no need to spend a fortune. A few instructors I liked were Colt Steele and Brad Traversy.

Alternatively, both Colt Steele and Brad Traversy have Youtube channels that are free and have great content for learning JavaScript. Once you get the hang of the basics, I also recommend The Coding Train, which is run by Daniel Shiffman. I enjoyed all of these instructors’ teaching styles — they have great explanations for different concepts. That said, choose someone who best fits your needs and makes things clearest for you

How to Learn JavaScript Fast

As with any language, learning JavaScript requires time, studying, and practice. I recommend you learn the basics, which include:

  • Variables
  • Types of Data:  Strings, Integers, Objects, Arrays, Boolean, null, and undefined
  • Object Prototypes
  • Loops
  • If Statements/Conditionals
  • Functions

After you have those basics down, hop into some code challenges to get some practice. One site I would recommend is codewars.com. It has tons of challenges with varying levels of difficulty. Start at a basic level. Practice until you are comfortable with the above topics.

Another good practice exercise is making a game like tic-tac-toe or a basic calculator. With these exercises, you will be able to tackle different obstacles and exercise the syntax of JavaScript.

JavaScript Quick Tutorial

Variable Declaration

If the above materials are not enough, here is my quick JavaScript tutorial: 

First, we have variables. In JavaScript, there are three ways you can declare a variable:

  • var: function-scoped.
  • let: block-scoped.
  • const: block-scoped, but cannot be reassigned; it also is initialized with an “a” value, unlike “var” and “let.”

Data Types

There are different data types, as mentioned above, but the most important is Objects. Objects are used for various data structures in JavaScript such as Array, Map, Set, WeakMap, WeakSet, Date, and almost everything made with a new keyword.

A small note about null: If you were to check the data type of null through JavaScript, it would evaluate to an Object. This is a loophole that has been utilized by programmers for years. This might not be very common for you early on…

Comments

Comments in JavaScript are signified with “//” for single-line comments or “/* ….. */” for longer blocks of comments. I bring this up now since the examples below have comments.

Loops

If you are not new to programming, I am sure you know what loops are. For those of you who are new to coding, loops are used to iterate or repeat a block of code a certain amount of times or until a condition is met. Loops are often used to go through items in an Array.

The most common loops are the traditional for loops and while loops. A lot of the following is from the developer.mozilla.org and MDN, which is similar to the documentation for JavaScript — here are some of the different loops JavaScript has to offer:

for loop:

for ([initialExpression]; [conditionExpression]; [incrementExpression]) {

  // statement

}

Provided by MDN:

When a for loop executes, the following occurs:

  1. The initializing expression, initialExpression, if any, is executed. This expression usually initializes one or more loop counters, but the syntax allows an expression of any degree of complexity. This expression can also declare variables.
  2. The conditionExpression expression is evaluated. If the value of conditionExpression is true, the loop statement executes. If the value of the condition is false, the for loop terminates. (If the condition expression is omitted entirely, the condition is assumed to be true.)
  3. The statement executes. To execute multiple statements, use a block statement ({ … }) to group those statements.
  4. If present, the update expression incrementExpression is executed.
  5. Control returns to Step 2.

An actual code example of a for loop:

for (let i = 0; i < array.length; i++) {

 // code here

}

For loops are extremely useful and used often. It is very important to understand and master how for loops work. 

do…while loop:

A do…while loop will run code until a condition is false

do {

  // statement

}

while (condition);

while loop:

A while loop is very similar to the do while loop, but the key difference lies when the conditional is checked. In a do…while loop, the code block runs, and the condition is checked after the while loop checks the condition and runs the block of code.

while (condition) {

  // statement

}

for…in loop:

For…in loop is used to loop over objects

for (variable in object) {

  // statement

}

for…of loop:

For…of loop is used typically for arrays or iterable objects. I must stress using the correct loops for arrays and objects to avoid confusion.

for (variable of array) {

  // statement

}

If Statements

If statements depend on whether a given condition is true and perform what is in the first set of the code block. Do not continue to evaluate the subsequent “else” portions. If there are subsequent conditions that need to be checked, the use of “if else” will be needed. If all conditions do not evaluate as true and there is an “else” provided, the “else” portion of the statement will be used. 

if (condition) {

   // statement1

} else if (condition2) {

   // statement2

} else {

   // statement3

}

Functions

There are two ways to write a function: a function declaration and a function expression. The “return” keyword is used in JavaScript to define what a function will return. All subsequent code below a return statement will not run inside a function.

Function Declaration:

function square(number) {

  return number * number;

}

Function Expression:

var square = function(number) {

  return number * number;

}

The key difference between the two is the function declarations load before any code is executed, while function expressions load only when the interpreter reaches that line of code.

Object Prototype/Classes

In order to provide inheritance, JavaScript utilizes things called prototypes.

Here is an example of what the syntax would look like:

function Person(first, last, age, gender, interests) {

  // property and method definitions

  this.name = {

    'first': first,

    'last' : last

  };

  this.age = age;

  this.gender = gender;

  //...see link in summary above for full definition

}

Creating a new instance of that prototype would look like this:

let person1 = new Person('Bob', 'Smith', 32, 'male', ['music', 'skiing']);

If you come from a different coding language, you may be more familiar with the term “classes.”

JavaScript also has something called classes — classes are built on prototypes:

class Person {

  constructor(first, last, age, gender, interests) {

    this.name = {

      first,

      last

    };

    this.age = age;

    this.gender = gender;

    this.interests = interests;

  }

}

How To Run JavaScript

Since JavaScript is one of the core technologies of the Internet, every modern web browser will have built-in JavaScript consoles. There are also many web-based JavaScript compilers and interpreters.

Browsers

All the big-name browsers such as Chrome, Firefox, Safari, Internet Explorer, and Opera will have JavaScript consoles. I will explain the process on Google Chrome, but all the other browsers can be found in a similar fashion.

In Chrome, right-click anywhere in your browser window and select “Inspect.” Then click on the console tab. From there, you can write “JavaScript” right into the console. Another keyboard shortcut can be found by pressing Command + Shift + J on Mac and Control + Shift + J on Windows.

Web-Based

There are a lot of different web-based JavaScript consoles. My personal favorite is Repl.it, but other options include JS Bin, JSFiddle, and CodePen. Of course, if you find one that you are more comfortable with, you are welcome to use it. 

Can I teach myself JavaScript?

The short answer is yes. I do truly believe you can learn JavaScript on your own, but as with anything, it will take time and discipline. There may be times when you want to quit, think you’ve had enough, or question if you are doing it correctly. My answer to those questions would be to follow the free options of Codecademy and freeCodeCamp (above) as they are very structured and give a good foundation for learning. Never get discouraged; you will be surprised at how much you actually know!

So… should I learn JavaScript or Python?

This is a loaded question and could be a whole article in itself, but it really comes down to use cases. Almost everything outside of the coding languages of JavaScript and Python is alike. This includes popularity, support, community, free and paid courses, and versatile uses.

I mention use cases because if you intend to do web-based programming, you will most likely need to know JavaScript; if you focus on web programming, I would recommend learning JavaScript.

If you are more interested in data analytics, artificial intelligence, and machine learning, Python may be the route to go. This is not to say you can only learn one language. If you are up for it, learn both! Python and JavaScript have evolved a lot since they were created, and both can be used for websites, data analytics, artificial intelligence, and machine learning.

How to Easily Run JavaScript in Terminal

By

TL;DR

You can run JavaScript  console in terminal or any command-line interface using Node.js, an open-source, platform-agnostic runtime that executes JavaScript outside a web browser.

Before we take a deep dive into how to run JavaScript in browser, we need to understand few basic terminologies like:

  1. Client-Side JavaScript 
  2. Server-Side JavaScript
  3. Command Line Interface

Client-Side JavaScript

  • JavaScript code executed in the web browser is known as client-side JavaScript. 
  • Client-side JS was originally used to add some interactivity on websites; for example, the Click on Submit button in a form sends form details to the server.
  • The <script> tag within your HTML page is used to write client-side JavScript, which is later executed by the browser.
<script>
  console.log("Client-side JavaScript");
</script>

Server-Side JavaScript

  • When you run JS code outside the browser-like on a web server, it becomes server-side JavaScript.
  • Server-side JS is generally used to write the back-end logic of your web application; for instance, you can check to see if a user password matches the stored DB password.
  • You can run Server-side JavaScript using any command-line interface.

But, what is Command Line Interface, a.k.a.,Terminal?

  • CLI is a text-based interface that allows users to perform some operation in a computer by typing commands.
  • The most common CLI for popular OS’s are:
    • Windows: Command Prompt, PowerShell
    • Mac: Terminal, iTerm

Let’s see how to run JavaScript in these popular CLI’s:

Running JavaScript in Terminal 

Executing JavaScript in Terminal has two steps:

  1. Installing Node.js.
  2. Accessing Node.js in Terminal/Command Prompt.
  3. Running your JS file using node.

Installing Node.js

  1. Go to https://nodejs.org/en/download/; you should see a web page like below:
Screenshot of the node.js website. Node is a key tool to run JavaScript in your terminal.
  1. If you are using Windows OS, click on Windows Installer or else click on Mac Installer for macOS.
  2. Once downloaded, double-click on the installer to install Node.js.

Checking Node.js in Your Terminal/Command Prompt

To open your terminal in macOS:

  1. Open the Spotlight Search Bar (Cmd+Space bar).
  2. Type Terminal: it has an icon like below — open it.
  3. Once opened, type the following command:
node -v

If you see an output like this, v14.15.3 Node.js is installed successfully.

Writing Your JS Code

  1. Create a new file called index.js in your Desktop/folder
  2. Let’s write some code!
const greet = (name=”Everyone”) => {    console.log(`Hello ${name}`);}
greet();

Now, let’s run it!

Running JavaScript in Your Terminal/Command Prompt

  1. Go to “Desktop path” within your Terminal/Command-Prompt:
cd /Users/arwalokhandwala/Desktop/
  1. To run your JavaScript file using Node.js, type:
node index.js
  1. If you see an output like below, then Congratulations! You are successfully running your JavaScript file in your Terminal/Command-Prompt:
Hello Everyone

Passing Runtime Arguments in Node.js

Like in the browser, we use forms to pass custom values to our JavaScript. If you wish to pass runtime values, then you can use process.argv[2]

const greet = (name = "Everyone") => {
   console.log(`Hello ${name}`);
}
greet(process.argv[2]);

In your Terminal/Command-prompt, type:

node index.js ArwaHello Arwa

Conclusion

Node.js makes it very simple to run JavaScript code in your Terminal/Command-prompt and opens a door of opportunities for a web developer.

Why is JavaScript So Popular?

By

Our lives today are dependent on the interactivity that JavaScript provides. If you want to really see how much you depend on it, you can disable JavaScript in your browser for a day. Some pages will load quicker, they’ll be cleaner, you’ll have less ads, no pop-ups, and the battery life of your computer may last longer. But also parts of the webpages simply will not work. Neither will Netflix, YouTube, Google Docs, Google Maps, and much more. We are, to a good degree, dependent on JavaScript to function. Today, virtually every computing device including iPhones, Android phones, MacOS, Windows, Linux, smart TVs, etc.. in the world have JavaScript interpreters installed on them and in active use.

There are over 1.8 Billion websites in the world, and JavaScript is used on 95% of them

The popularity of JavaScript over the years.

JavaScript is by far the most used language according to Github’s 2020 Octoverse Report.

So how did JavaScript get this big? Why did it get so popular? 

The creation story of JavaScript is the foundation of its popularity. 

It begins in the year 1995 at the Netscape headquarters, where young Brendan Eich goes into a ten day sprint of coding and comes out on the other side with a new language. Wow!

As more people used browsers to use and experience the internet, there was a need for a programming language that would give life to the browser. Something that went beyond HTML and CSS. That’s where JavaScript came in to give life to the browser. It’s a language that is capable of doing what all other programming languages do but also has a special relationship with the browser. It changed the way we thought about the internet and ushered a new era of browser based applications. 

Easy setup 

Unlike many other languages, where you need to go download the language in your machine in order to access all of its features and create a development environment, with JavaScript anyone with a web browser suddenly has a development environment right in front of them. Every browser supports JavaScript!  


You can simply open your browser, like Chrome, and navigate to Developer Tools, and start coding away! To write a “Hello World” program is as simple as: 

console.log(“Hello World”); 

You can also use an Integrated development environment (IDE) or code editor like Visual Studio Code where you can create a file with the file extension .js to write JavaScript. Visual Studio Code (VS Code) is more widely used to write code but there are other editors like Atom and Sublime Text which are quite common amongst developers.  

Event-based programming
One of the most impressive features of JavaScript is that it includes event-based programming. It has built-in events like ‘onClick’ and ‘onHover’ that wait for user interaction on a website before executing a specific segment of code. For instance, when you click the night-mode toggle, that is an event which triggers a JavaScript code segment that changes the CSS across the whole website from light colors to dark colors. 

JavaScript can be used to generate dynamic contents on a website as well. Different HTML tags can be generated based on user input. For instance, if you are on Facebook and you click into a comment box to type your comment on someone’s post, in that moment your click was an event that executed a code block in JavaScript that led to the generation of an HTML tag to display your comment.

End-to-end programming with Node.JS 

While JavaScript has been given the title of The Language of the Browser, in 2009 with the release of Node.JS, a runtime environment that runs JavaScript code outside a web browser changed the fate of the language. Node.JS lets developers use JavaScript to write server-side scripting. Consequently, JavaScript’s popularity was dramatically increased because Node.JS represents the idea of “JavaScript everywhere” paradigm, unifying all of web application development around a single programming language, rather having a different language for server-side and client-side scripts. 

In other words, now developers can use one single programming language to talk to databases, make HTTP requests, generate dynamic content, and create interactive user experiences/interfaces. This led to the Rise of Web Applications that we are experiencing today. In addition to having a unified web-application development, JavaScript also became the go-to language for many companies because now the engineering teams only had to worry about a single programming language which made it easier to debug and save costs in the overall development process. 

In 2013 AirBnb launched their site and became the first to utilize the full-stack JavaScript solution. This approach allowed for code to be executed on the server-side and rendered in the browser with subsequent actions being handled by the exact same code on the client side. This inspired several other companies to do the same and today we have products and services like LinkedIn, Netflix, Uber, PayPal, eBay, Groupon, GoDaddy, CitiBank and many more using Node.JS. 

JavaScript Libraries and Frameworks

The popularity of JavaScript led to the creation of several libraries and frameworks that have made application development efficient and performant. Today, libraries like React JS, jQuery, D3.js, etc.. are used in most applications across the world. Frameworks such as Angular, Ember JS, and Vue JS provide optimal performance and organization to build large applications. 

Active Community 

Amongst the programming languages, JavaScript has one of the largest communities according to Stackoverflow. In addition to that community, Node.JS has over a billion downloads across the world and is one the most widely used technologies. 

These are just a few of the reasons why JavaScript is so popular. With the change in paradigm that led to the rise of web applications, unifying the web application development, cross browser support, and the plethora of libraries/frameworks available, the world of the internet has been fully invested in the growth of JavaScript. Furthermore, since JavaScript is a high-level interpreted language that is easy to understand, it is the one of the best languages to learn if you want to enter the world of programming and explore the amazing possibilities of web-application development. 

What is a JavaScript library?

By

JavaScript is one of the most widely used programming languages in the world. It’s a scripting language used by developers to create interactive user interfaces that display dynamic content. It is s referred to as The Language of the Web Browser because it is the most commonly used language to build web applications and works well across all web browsers

As the popularity of JavaScript increased and more people were using it to build websites and applications, the JavaScript community recognized that certain patterns in the code were being used repeatedly to accomplish the same tasks.

This re-writing of code and recognizing that certain JS functions need to be implemented multiple times led to the development of JavaScript libraries and frameworks. For instance, reoccurring animations and interactive forms that appear in different places on a website or app were repetitive tasks that could be automated by using a code snippet as needed without writing code every time.

Generally speaking, JavaScript libraries are collections of prewritten code snippets that can be used and reused to perform common JavaScript functions. A particular JavaScript library code can be plugged into the rest of your project’s code on an as-needed basis. This led to faster development and fewer vulnerabilities to have errors.

What is jQuery?

There are many libraries and frameworks available to JavaScript developers today, but the concept of a JavaScript library was initiated with the creation of jQuery. jQuery is a JavaScript library designed to simplify HTML, DOM (Document Object Model) manipulation, and event handling, CSS animations, and Ajax. At the time, the jQuery library shortened the syntax and simplified the code, making it easy to understand and increased web developer productivity. 

All a web developer had to do was install jQuery and use prewritten code snippets to manipulate the virtual DOM. For example, if a developer wants to add an autocomplete feature in a search bar on their site, they would insert the appropriate jQuery code snippet into the project’s code. When a user enters text into the search bar, the jQuery code snippet retrieves the feature from the jQuery library and displays it in the user’s modern browser. 

What is React JS?

In 2011, Facebook created a JavaScript library called React, which specializes in helping developers build user interfaces or UI’s. React

JS is a web component-based library and an open source JavaSscript framework that helps developers design simple views for each state of the JavaScript application. React is also extremely smart in that it does a lot of heavy lifting in terms of efficiently updating and rendering the right components when there is a change in data or the state of the JavaScript application.

Today, React is the most popular JavaScript library, and companies use it all over the world like Uber, Airbnb, Facebook, Netflix, Instagram, Amazon, Twitter, and much more. 

The web component-based library allows developers to avoid the pitfalls of rewriting code and dealing with complicated debugging. With React, you can reuse and recycle different components across the web application or other products.

Components such as navigation bars, buttons, cards, forms, sections, and the like can all be reused like little building blocks that make the web application. A library like React dramatically increases the development speed with fewer bugs and makes extremely performant applications. 

Library vs. Framework 

Perhaps one of the most common topics of discussion in the software community is the difference between a library and a framework. As we see above, jQuery and React are libraries with prewritten code snippets that we can use and reuse to build applications.

So while JavaScript libraries are a specialized tool for on-demand use, JavaScript frameworks are a full toolset that helps shape and organize your website or application. In other words, libraries are about using what is needed for the task, while frameworks provide you with all the tools you could need even if you don’t particularly need all of them. 

Think of it like cooking some pasta. When using a JavaScript library, you simply grab the pot, pan, ingredients to make the pasta, and plates to serve. You only require only the things you need to make pasta. When thinking about a JavaScript framework, imagine an entire fully loaded kitchen. Another way to think about it can be that JavaScript libraries are like pieces of furniture that add style and function to an already constructed house. At the same time, frameworks are templates you can use to build the house itself. 

Examples of an open source JavaScript framework includes Angular, Ember JS, and Vue JS. These are some of the most popular frameworks with large communities and support systems. Frameworks provide a structure to base your entire application around, and developers can safely work within the structure’s rules.

The advantage of frameworks is the overall efficiency and organization. The disadvantage is that a developer has less freedom to work around the rules and conventions specific to a particular JS framework. Libraries, on the other hand, give developers more freedom to use different code and snippets but do not provide the type of structure and convention that comes with a framework.


Learn how to create a javascript library with General Assembly.

Portfolio Project Spotlight: Software Engineering Immersive

By

Every graduate of our Software Engineering Immersive programs gets the opportunity to work on a portfolio-grade final project. The experience gives students a chance to apply their newfound skills in programming languages and problem-solving to real-world issues and scenarios, as well as gaining invaluable insights and impactful results that they can use to stand out in their job searches.

Here are a few of our instructors’ favorites.


Save the ocean

Jiha Hwang, a visual interaction designer at Lopelos Project Group, created an app to raise ocean pollution awareness, allowing users to share tips for reducing plastic use. She used Rails, React, and PostgreSQL to build the app and deployed it with Heroku.


FRIDGIFY

Sathya Ram and Marichka Tsiuriak, now both front-end developers, created this eater-friendly organizational tool using MongoDB, Express, React, and Node. The animated web app allows you to categorize the contents of your fridge and track their expiration dates.


SETTLERS OF CATTAN

Bryant Cabrera, now a software engineer at Amazon, built a web-based adaptation of this popular board game. Powered by HTML, CSS, JavaScript, and jQuery, the app allows players to test their logic and negotiation skills just as they would in person.


15 Data Science Projects to get you Started

By

When it comes to getting a job in data science, data scientists need to think like Creatives. Yes, that’s correct. Those looking to enter this field need to have a data science portfolio of previously completed data science projects, similar to those in Creative professions. What better way to prove to your future data science team that you’re capable of being a data scientist than proving you can do the work?

A common problem for data science entrants is that employers want candidates with experience, but how do you get experience without having access to experience? Suppose you’re looking to get that first foot in the door. It will behoove you to undertake a couple of data science projects to show future employers you’ve got what it takes to use big data to identify opportunities and succeed in the field.

The good news is that we live in a time of open and abundant data. Websites like Kaggle offer a treasure trove of free data for deep learning on everything from crime statistics to Pokemon to Bitcoin and more. However, the wealth of easily accessible data can be overwhelming, which is why we’ve taken it upon ourselves to present 15 data science projects you can execute in Python to showcase and improve your skills in data analytics. Our data science project ideas cover various topics, from Spotify songs to fake news to fraud detection and techniques such as clustering, regression, and natural language processing.

Before you dive in, be sure to adhere to these four guidelines no matter which data science project idea you choose:

1. Articulate the Problem and/or Scenario

It’s not enough to do a project where you use “X” to predict “Y”; you need to add some context to your work because data science does not occur in a vacuum. Tell us what you’re trying to solve and how data science can address that. Employers want to know if you can turn a problem into a question and a question into a solution. A good place to start is to depict a real-world scenario in which your data project would be useful.

2. Publish & Explain Your Work

Create a GitHub repository where you can upload your Jupyter Notebooks and data. Write a blog post in which you narrate your project from start to finish. Talk about the problem or question at the heart of the project, and explain your decision to clean the data in a certain way or why you decided to use a certain algorithm. Why all this? Potential employers need to understand your methodology.

3. Use Domain Expertise

If you’re trying to break into a specific field such as finance, health, or sports, use your knowledge of this area to enhance your project. This could mean deriving a useful question to a pressing problem or articulating a well-thought-out interpretation of your project’s results. For example, if you’re looking to become a data scientist in the finance sector, it would be worthwhile to show how your methods can generate a return on investment.

4. Be Creative & Different

Anyone can copy and paste code that trains a machine learning algorithm. If you want to stand out, review existing data science projects that use the same data and fill in the gaps left by them. If you’re working on a prediction project, try coming up with an unexpected variable that you think would be beneficial.

Data Science Projects

1. Titanic Data

Working on the Titanic dataset is a rite of passage in data science. It’s a useful dataset that beginners can work with to improve their feature engineering and classification skills. Try using a decision tree to visualize the relationships between the features and the probability of surviving the Titanic.

2. Spotify Data

Spotify has an amazing API that provides access to rich data on their entire catalog of songs. You can grab cool attributes such as a song’s acoustics, danceability, and energy. The great thing about this data source is that the project possibilities are almost endless. You can use these features to try to predict genre or popularity. One fun idea would be to better understand your music by training a machine learning classifier on two sets of songs; songs you like and songs you do not.

3. Personality Data Clustering

You’ve probably heard the phrase, “There are X types of people.” Well, now you can actually find out how many types of people there really are. Using this dataset of almost 20k responses to the Big Five Personality Test, you can actually answer this question. Throw this data into a clustering algorithm such as KMeans and sort this into K number of groups. Once you decide on the optimal number of clusters, it’s incumbent on you to define each cluster. Come up with labels that add meaning to each group, and don’t be afraid to use plenty of charts and graphs to support your interpretation.

4. Fake News

If you are interested in natural language processing, building a classifier to differentiate between fake and real news is a great way to demonstrate that. Fake news is a problem that social media platforms have been struggling with for the past several years and a project that tackles this problem is a great way to show you care about solving real-world problems. Use your classifier to identify interesting insights about the patterns in fake versus real news; for example, tell us which words or phrases are most associated with fake news articles.

5. COVID-19 Dataset

There probably isn’t a more relevant use of data science than a project analyzing COVID-19. This dataset provides a wealth of information related to the pandemic. It provides a great opportunity to show off your exploratory data analysis chops. Take a deep dive into this data, and through data visualization unearth patterns about the rate of COVID infection by county, state, and country.

6. Telco Customer Churn

If you’re looking for a straightforward project that is extremely applicable to the business world, then this one’s for you. Use this dataset to train a classifier that predicts customer churn. If you can show employers you know how to prevent customers from leaving their business, you’ll most definitely grab their attention. Pro tip: this is a great projection to show your understanding of classification metrics besides accuracies, such as precision and recall.

7. Lending Club Loans

Like the Telco project, the Lending Club loan dataset is extremely relevant to the business world. Here you can train a classifier that predicts whether or not a Lending Club loanee will pay back a loan using a wealth of information such as credit score, loan amount, and loan purpose. There are a lot of variables at your disposal, so I’d recommend starting with a handful of features and working your way up from there. See how far you can get with just the basics.

Also, this is a fairly untidy dataset that will require extensive cleaning and feature engineering, which is a good thing because that is often the case with real-world data. Be sure to explain your methodology behind preparing your dataset for the machine learning algorithm — this informs the audience of your domain expertise.

8. Breast Cancer Detection

This dataset provides a simpler classification scenario in which you can use health-related variables to predict instances of breast cancer. If you’re looking to apply your data science skills to the medical field, this is certainly worth a shot.

9. Housing Regression

If classification isn’t your thing, then might I recommend this ready-made regression project in which you can predict home prices using variables like square footage, number of bedrooms, and year built. A project such as this can help you understand the factors driving home sales and let you get creative in your feature engineering. Try to involve outside data that can serve as proxies for quality of life, education, and other things that might influence home prices. And if you want to show off your scraping skills, you can always create your dataset by scraping Zillow.

10. Seeds Clustering

The seeds dataset from UCI provides a simple opportunity to use clustering. Use the seven attributes to sort the 210 seeds into K number of groups. If you’re looking to go beyond KMeans, try using hierarchical clustering, which can be useful for this dataset because the low number of samples can be easily visualized with a dendrogram.

11. Credit Card Fraud Detection

Another project idea for those of you intent on using business world data is to train a classifier to predict instances of credit card fraud. The value of this project to you comes from the fact that it’s an imbalanced dataset, meaning that one class vastly outweighs the other (in this case, non-fraudulent transactions versus fraudulent). Training a model that is 99% accurate is essentially useless, so it’s up to you to use non-accuracy metrics to demonstrate the success of your model.

12. AutoMPG

This is a great beginner regression project in which you can use car features to predict their fuel efficiency. Given that this data is from the past, an interesting idea you can use is to see how well this model does on data from recent cars to show how car fuel efficiency has evolved over the years.

13. World Happiness

Using data science to unlock what’s behind happiness? Maybe you can with this dataset on world happiness rankings. You can go a number of ways with this project; you can use regression to predict happiness scores, cluster countries based on socio-economic characteristics, or visualize the change in happiness throughout the world from 2015 to 2019.

14. Political Identity

The Nationscape Data Set is an absolute goldmine of data on the demographics and political identities of Americans. If you’re a politics junkie, it’ll be sure to satisfy your fix. Their most recent round of data features over 300,000 instances of data collected from extensive surveys of Americans. If you’re interested in using demographic information for political ideology or party identification this is the dataset for you. This is an especially great project to flex your domain expertise in study design, research, and conclusion. Political analysis is replete with shoddy interpretations that lack empirical data analysis, and you could use this dataset to either confirm or dispel them. But be warned that this data will require plenty of cleaning, which you’ll need to get used to, given that’s the majority of the job.

15. Box Office Prediction

If you’re a movie buff, then we’ve got you covered with the TMDB dataset. See if you can build a workable box office revenue prediction model trained on 5000 movies worth of data. Does genre actually correlate with box office success? Can we use runtime and language to help explain the variation in the revenue? Find out the answers to those questions and more with this project.

How is Python Used in Data Science?

By

Python is a popular programming language used by both developers and data scientists. But what makes it so popular and why are so many data scientists choosing Python over other programming languages? In this article, we’ll explore the advantages of Python programming and why it’s useful for data science.

What is Python?

No, we’re not talking about the giant, tropical snake. Python is a general-purpose, high-level programming language. It supports object oriented, structured, and functional programming paradigms.

Python was created in the late 1980s by the Dutch programmer Guido van Rossum who wanted a project to fill his time over the holiday break. His goal was to create a programming language that was a descendant of the ABC programming language but would appeal to Unix/C hackers. Van Rossum writes that he chose the name Python for this language, “being in a slightly irreverent mood (and a big fan of Monty Python’s Flying Circus).”

Python went through many updates and iterations and by the year 2008, Python 3.0 was released. This was designed to fix many of the design flaws in the language, with an emphasis on removing redundant features. While this update had some growing pains as it was not backwards compatible, the new updates made way for Python as we know it today. It continues to be well-maintained and supported as a popular, open source programming language.

In “The Zen of Python,” developer Tim Peters summarizes van Rossum’s guiding principles for writing code in Python:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

These principles touch on some of the advantages of Python in data science. Python is designed to be readable, simple, explicit, and explainable. Even the first principle states that Python code should be beautiful. In general, Python is a great programming language for many tasks and is becoming increasingly popular for developers. But now you may be wondering, why learn Python for data science?

Why Python for Data Science?

The first of many benefits of Python in data science is its simplicity. While some data scientists come from a computer science background or know other programming languages, many come from backgrounds in statistics, mathematics, or other technical fields and may not have as much coding experience when they enter the field of data science. Python syntax is easy to follow and write, which makes it a simple programming language to get started with and learn quickly. 

In addition, there are plenty of free resources available online to learn Python and get help if you get stuck. Python is an open source language, meaning the language is open to the public and freely available. This is beneficial for data scientists looking to learn a new language because there is no up-front cost to start learning Python. This also means that there are a lot of data scientists already using Python, so there is a strong community of both developers and data scientists who use and love Python.

The Python community is large, thriving, and welcoming. Python is the fourth most popular language among all developers based on a 2020 Stack Overflow survey of nearly 65,000 developers. Python is especially popular among data scientists. According to SlashData, there are 8.2 million active Python users with “a whopping 69% of machine learning developers and data scientists now us[ing] Python (compared to 24% of them using R).”4 A large community brings a wealth of available resources to Python users. Not only are there numerous books and tutorials available, there are also conferences such as PyCon where Python users across the world can come together to share knowledge and connect. Python has created a supportive and welcoming community of data scientists willing to share new ideas and help one another. 

If the sheer number of people using Python doesn’t convince you of the importance of Python for data science, maybe the libraries available to make your data science coding easier will. A library in Python is a collection of modules with pre-built code to help with common tasks. They essentially allow us to benefit from and build on top of the work of others. In other languages, some data science tasks would be cumbersome and time consuming to code from scratch. There are countless libraries like NumPy, Pandas, and Matplotlib available in Python to make data cleaning, data analysis, data visualization, and machine learning tasks easier. Some of the most popular libraries include:

  • NumPy: NumPy is a Python library that provides support for many mathematical tasks on large, multidimensional arrays and matrices.
  • Pandas: The Pandas library is one of the most popular and easy-to-use libraries available. It allows for easy manipulation of tabular data for data cleaning and data analysis.
  • Matplotlib: This library provides simple ways to create static or interactive boxplots, scatterplots, line graphs, and bar charts. It’s useful for simplifying your data visualization tasks.
  • Seaborn: Seaborn is another data visualization library built on top of Matplotlib that allows for visually appealing statistical graphs. It allows you to easily visualize beautiful confidence intervals, distributions, and other graphs.
  • Statsmodels: This statistical modeling library builds all of your statistical models and statistical tests including linear regression, generalized linear models, and time series analysis models.
  • Scipy: Scipy is a library used for scientific computing that helps with linear algebra, optimization, and statistical tasks.
  • Requests: This is a useful library for scraping data from websites. It provides a user-friendly and responsive way to configure HTTP requests.

In addition to all of the general data manipulation libraries available in Python, a major advantage of Python in data science is the availability of powerful machine learning libraries. These machine learning libraries make data scientists’ lives easier by providing robust, open source libraries for any machine learning algorithm desired. These libraries offer simplicity without sacrificing performance. You can easily build a powerful and accurate neural network using these frameworks. Some of the most popular machine learning and deep learning libraries in Python include:

  • Scikit-learn: This popular machine learning library is a one-stop-shop for all of your machine learning needs with support for both supervised and unsupervised tasks. Some of the machine learning algorithms available are logistic regression, k-nearest neighbors, support vector machine, random forest, gradient boosting, k-means, DBSCAN, and principal component analysis.
  • Tensorflow: Tensorflow is a high-level library for building neural networks. Since it was mostly written in C++, this library provides us with the simplicity of Python without sacrificing power and performance. However, working with raw Tensorflow is not suited for beginners.
  • Keras: Keras is a popular high-level API that acts as an interface for the Tensorflow library. It’s a tool for building neural networks using a Tensorflow backend that’s extremely user friendly and easy to get started with.
  • Pytorch: Pytorch is another framework for deep learning created by Facebook’s AI research group. It provides more flexibility and speed than Keras, but since it has a low-level API, it is more complex and may be a little bit less beginner friendly than Keras. 

What Other Programming Languages are Used for Data Science?

Python is the most popular programming language for data science. If you’re looking for a new job as a data scientist, you’ll find that Python is also required in most job postings for data science roles. Jeff Hale, a General Assembly data science instructor, scraped job postings from popular job posting sites to see what was required for jobs with the title of “Data Scientist.” Hale found that Python appears in nearly 75% of all job postings. Python libraries including Tensorflow, Scikit-learn, Pandas, Keras, Pytorch, and Numpy also appear in many data science job postings.

Image source: The Most In-Demand Tech Skills for Data Scientists by Jeff Hale

R, another popular programming language for data science, appeared in roughly 55% of the job postings. While R is a useful tool for data science and has many benefits including data cleaning, data visualization, and statistical analysis, Python continues to become more popular and preferred among data scientists for a majority of tasks. In fact, the average percentage of job postings requiring R dropped by about 7% between 2018 and 2019, while Python increased in the percentage of job postings requiring the language. This isn’t to say that learning R is a waste of time; data scientists that know both of these languages can benefit from the strengths of both languages for different purposes. However, since Python is becoming increasingly popular, there’s a high chance that your team uses Python, and it’s important to use the language that your team is comfortable with and prefers.

What is the Future of Python for Data Science?

As Python continues to grow in popularity and as the number of data scientists continues to increase, the use of Python for data science will inevitably continue to grow. As we advance machine learning, deep learning, and other data science tasks, we’ll likely see these advancements available for our use as libraries in Python. Python has been well-maintained and continuously growing in popularity for years, and many of the top companies use Python today. With its continued popularity and growing support, Python will be used in the industry for years to come.

Whether you’ve been a data scientist for years or you are just beginning your data science journey, you can benefit from learning Python for data science. The simplicity, readability, support, community, and popularity of the language — as well as the libraries available for data cleaning, visualization, and machine learning — all set Python apart from other programming languages. If you aren’t already using Python for your work, give it a try and see how it can simplify your data science workflow.

The Newbie’s Guide to Android Development

By

Android101_DripArt1

This is the first post in our Android 101 series. Sign up to learn more about the world’s most popular operating system. 

In the last 10 years, Android has made a name for itself, not only with its candy-themed platform updates, but also with its widespread, and unexpected, success. In its lifetime, the open-source Android operating system has grown to include 1.4 billion active users and 80% of smartphones today run Android software. Over 1 billion Android phones were sold in 2014 alone.

Mobile app development in the programming community is the minority – just over 9% of total developers in the world say they’re focusing on mobile devices, according to Stack Overflow’s 2015 developer survey. Of these mobile developers, however, Android developers make up the larger group, with 44.6% self-identifying as Android developers, compared to 33.4% who say they are building for iOS. Even so, many companies struggle to find enough developers with the technical skills to complete their Android projects. This trend is likely to continue as the overall number of smartphone users – and Android users, specifically – continues to grow.

Continue reading