Programming & IT Tricks . Theme images by MichaelJay. Powered by Blogger.

Copyright

Facebook

Post Top Ad

Search This Blog

Post Top Ad

Responsive Ads Here

Archive

Post Top Ad

Contact


Editors Picks

Follow us

Post Top Ad

Fashion

Music

News

Sports

Food

Technology

Featured

Videos

Fashion

Technology

Fashion

Label

Translate

About

Translate

Sponsor

test

Weekly

Comments

Recent

Connect With us

Over 600,000+ Readers Get fresh content from FastBlog

About

Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Saturday, January 13, 2018

JavaScript — Null vs. Undefined


Learn the differences and similarities between null and undefined in JavaScript

At first glance, null and undefined may seem the same, but they are far from it. This article will explore the differences and similarities between null and undefined in JavaScript.

What is null?

There are two features of null you should understand:
  • null is an empty or non-existent value.
  • null must be assigned.
Here’s an example. We assign the value of null to a:
let a = null;
console.log(a);
// null

What is undefined?

Undefined most typically means a variable has been declared, but not defined. For example:
let b;
console.log(b);
// undefined
You can also explicitly set a variable to equal undefined:
let c = undefined;
console.log(c);
// undefined
Finally, when looking up non-existent properties in an object, you will receive undefined:
var d = {};
console.log(d.fake);
// undefined

Similarities between null and undefined

In JavaScript there are only six falsy values. Both null and undefined are two of the six falsy values. Here’s a full list:
  • false
  • 0 (zero)
  • “” (empty string)
  • null
  • undefined
  • NaN (Not A Number)
Any other value in JavaScript is considered truthy.
If you’re not familiar with truthy/falsy values in JavaScript, I recommend reading my previous article: JavaScript — Double Equals vs. Triple Equals
Also in JavaScript, there are six primitive values. Both null and undefined are primitive values. Here is a full list:
  • Boolean
  • Null
  • Undefined
  • Number
  • String
  • Symbol
All other values in JavaScript are objects (objects, functions, arrays, etc.).
Interestingly enough, when using typeof to test null, it returns object:
let a = null;
let b;
console.log(typeof a);
// object
console.log(typeof b);
// undefined
This has occurred since the beginning of JavaScript and is generally regarded as a mistake in the original JavaScript implementation.
If you’re not familiar with data types in JavaScript, I recommend reading my previous article: JavaScript Data Types Explained

null !== undefined

As you can see so far, null and undefined are different, but share some similarities. Thus, it makes sense that null does not strictly equal undefined.
null !== undefined 
But, and this may surprise you, null loosely equals undefined.
null == undefined
The explanation as to why this is true is a little complex, so bear with me. In JavaScript, a double equals tests for loose equality and preforms type coercion. This means we compare two values after converting them to a common type. Since both null and undefined are falsy values, when we compare them with loose equality, they are coerced to false prior to comparison.

Practical Differences

All of this is great, but what about a practical difference between null and undefined?
Consider the following code snippet:
let logHi = (str = 'hi') => {
  console.log(str);
}
The code above creates a function named logHi. This function requires one parameter and sets the default of that parameter to hi if it isn’t supplied. Here’s what that looks like:
logHi();
// hi
We can also supply a parameter to overwrite this default:
logHi('bye');
// bye
With default parameters, undefined will use the default while null does not.
logHi(undefined);
// hi
logHi(null);
// null
Thanks to Tim Branyen for the code inspiration.

Summary

  • null is an assigned value. It means nothing.
  • undefined typically means a variable has been declared but not defined yet.
  • null and undefined are falsy values.
  • null and undefined are both primitives. However an error shows that typeof null = object.
  • null !== undefined but null == undefined.

Friday, January 12, 2018

Learn mobile app development with these 10 online courses


Top 10 online courses to help your learn mobile app development plus some advice from the experts on why app prototyping makes all the difference!

Thinking about becoming a Mobile App Developer? You’re in luck! There’s never been a better time to learn mobile app development. Take a look:
For budding developers, it’s time to hop aboard the gravy train. But what’s the first step in learning mobile app development? What courses should you sign up for? Should you teach yourself app development? We’ve got you covered.
And yes, the first step is learning how to prototype a mobile app. Learn why here — plus get our top 10 online courses on mobile app development to get you started right away, no matter where you are!

10 free and paid online courses to help you learn mobile app development

Here are our top 10 online courses to help you learn mobile app development:

1 — Android Development Tips Weekly series on Lynda

Teach yourself app development with this series of Android development tips by David Gassner.
Each week, David shares techniques to help you speed up your coding, improve app functionality or make your apps more reliable and refined.
The tutorials cover developing the app’s user interface, backend processing and open source libraries, to get your coding knowledge off the ground even quicker.
  • Level: Beginner — Intermediate
  • Commitment: approximately 3h per video
  • Price-point: 30-day free trial, from $19.99 thereafter

2 — Mobile App Development for Beginners on Udemy

Dee Aliyu Odumosu’s mobile app development course is ideal if you’re looking to break into iOS.
Learn how to create and customize 10+ iPhone apps (using Swift 3 and Xcode 8) with easy step-by-step instructions. The course begins with implementation of basic elements — UILabel, UIButton, UITextField etc. — Auto Layout and multiple-sized icons, with more advanced classes covering memory issues, storyboarding and displaying rich local notifications.
Note that this course requires you to own and already be familiar with Mac.
  • Level: Beginner
  • Commitment: approximately 33 hours
  • Price-point: $10.99 (New Year discount, was $50.00)

3 — iOS App Development with Swift Specialization on Coursera

This is the ultimate Swift for iOS development course, brought to you by Parham Aarabi and the University of Toronto.
Using XCode, Parham will teach you how to design elegant interactions and create fully functioning iOS apps, such as the photo editing app for iPhone, iPad, and Apple Watch. The course also includes best practices to help you become proficient in functional Swift concepts.
Note that this course requires you to own and already be familiar with Mac.
  • Level: Intermediate (some previous experience required)
  • Commitment: 6 weeks
  • Price-point: 7-day free trial, $49 per month thereafter

4 — Introduction to Mobile Application Development using Android on edX

Learn mobile app development and the basics of Android Studio in Jogesh K Muppala’s introduction to the Android platform.
In this 5-week course, you’ll explore the basics of Android application components as well as Activities and their lifecycle, some UI design principles, Multimedia, 2D graphics and networking support for Android.
  • Level: Beginner
  • Commitment: 6 weeks
  • Price-point: free

5 — Full Stack Web and Multiplatform Mobile App Development Specialization on Coursera

If you’re learning mobile application development for Android and found the above course useful, try this course out next.
Here you’ll have the chance to build complete web and hybrid mobile solutions, as well as master front-end web, hybrid mobile app and server-side development.
  • Level: Intermediate (some previous experience required)
  • Commitment: approximately 20 weeks
  • Price-point: 7-day free trial, $39 per month thereafter

6 — iOS 9 and Swift 2: From Beginner to Paid Professional on Skillshare

Mark Price’s online course for iOS Swift is everything you need to know about iOS 9 development.
This is another great set of classes for novice iOS coders. Build 15+ apps for iOS 9, learn swift 2.0 and publish apps to the App Store. Warmups, class projects and exercises will help you keep on top of the workload.
  • Level: Beginner
  • Commitment: approximately 37 hours
  • Price-point: from $15 a month

7 — The iOS Development Course That Gets You Hired on Career Foundry

Jeffrey Camealy presents the iOS Development course to get your hired.
1-on-1 mentorship from industry experts and real-world projects complement a set of 6 structured modules. The course covers the very basic principles of iOS development and takes you right to the point of submitting an app to the App Store.
  • Level: Beginner
  • Commitment: 6 months
  • Price-point: $4000 (payment plans available)

8 — Get Started With React Native on TutsPlus

Markus Mühlberger’s course for React Native is perfect for anyone who wants to code for multiple mobile platforms.
Learn how to create and customize UI elements, build user interaction, and integrate third-party components into apps for both iOS and Android. Upon completion, you’ll be able to write mobile apps in React Native.
  • Level: Intermediate
  • Commitment: 1.2 hours
  • Price-point: $29 a month

9 — Build a Simple Android App with Java on Treehouse

Ben Deitch’s course will help you build simple mobile apps for Android with Java, without any prior knowledge.
Best-suited to budding Android developers, this course will explore programming in Android and some very basic concepts of the Android SDK. By the end of the course, you’ll have a working knowledge of how a basic app works.
  • Level: Beginner
  • Commitment: 1.5 hours
  • Price-point: from $25 a month

10 — Try iOS on Code School

Gregg Pollack’s tutorials on iOS app development from the ground up and requires only basic coding experience.
Write your first iPhone app code and learn about different UI elements, such as buttons, labels, tabs and images. Upon completion, you’ll be able to connect to the internet to fetch data, build out table views and navigate between different areas of your app.
  • Level: Beginner
  • Commitment: 6–8 hours
  • Price-point: $29 a month
It’s an exciting time for mobile app developers. And as you can see, there are plenty of resources out there to help get your career off the ground. But don’t forget to look at the big picture.
Prototyping is an integral part of the mobile app life cycle. Download Justinmind now and explore a prototyping tool that’s made with the entire product team in mind.

Wednesday, January 10, 2018

JavaScript — Shorthand Variable Assignment


A three minute introduction into shorthand variable assignment

This article will take a (very) quick look at shorthand variable assignment in JavaScript.

Assigning Variables to Other Variables

As you’re probably aware, you can assign values to variables separately, like this:
var a = 1;
var b = 1;
var c = 1;
However, if all variables are being assigned equal values, you can shorthand and assign the variables like this:
var a = b = c = 1;
The assignment operator = in JavaScript has right-to-left associativity. This means that it works from the right of the line, to the left of the line. In this example, here is the order of operation:
  • 1 — First, c is set to 1.
  • 2 — Next, b is set equal to c which is already equal to 1. Therefor, b is set to 1.
  • 3 — Finally, a is set equal to b which is already equal to 1. Therefor, a is set to 1.
As you can now see, the shorthand above results in a, b, and c all being set to 1.
However, this is not a recommended way to assign variables. That’s because in the shorthand variable assignment shown above, we actually never end up declaring variables b or c. Because of this, b and c wont be locally scoped to the current block of code. Both variables b and c will instead be globally scoped and end up polluting the global namespace.

Using Commas When Assigning Variables

Lets look at a new example. Consider the following variable declarations and assignments:
var d = 2;
var e = 3;
var f = 4;
We can shorthand this code using commas:
var d = 2, e = 3, f = 4;
As you see, we are separating each variable assignment with a comma which allows us to assign different values to each variable.
For ease of reading, most coders who prefer using the comma method will structure their variable assignments like this:
var d = 2, 
    e = 3, 
    f = 4;
Best of all, in the shorthand variable assignment shown above, we are declaring all three variables: d, e, and f. Because of this, all variables will be locally scoped and we’re able to avoid any scoping problems.

Want to Learn More Shorthands?

Check out my other articles on shorthand coding techniques in JavaScript:

Closing Notes:

Thanks for reading! If you’re ready to finally learn Web Development, check out: The Ultimate Guide to Learning Full Stack Web Development in 6 months.
If you’re working towards becoming a better JavaScript Developer, check out: Ace Your Javascript Interview — Learn Algorithms + Data Structures.

Why people shouldn’t learn to code



As a scholar, I like arguing against myself. Thesis, anti-thesis, synthesis: the Hegelian dialectic can be one of the more productive and entertaining paths to truth.
And so, in this post, I attack the central thesis of my research: that the ability to program a computer, and the computational thinking that can come with it, is a power that must be democratized.
Why do I believe this? I believe that a severe concentration of power nearly always leads to injustice, and justice is one of my core values. That only 20 million people write the software that shapes the digital experiences of the 7.5 billion people on Earth is concentration of power second only to global income inequality. My research aims to lower the barriers to acquiring the power to code, which I hope will more evenly distribute this power, which in turn will reduce injustice.
Agree with me? Great! But that’s no fun. And it leaves this position open to attack, with no sense of how robust it actually is. My position might even be wrong.
So let’s consider three anti-theses to my thesis.

Ability is an arms race

One critique of my thesis is that the ability to code is an arms race. No matter how easy we make it to learn to code, this greater ease will only amplify the abilities of those who already could. The privileged few who learn to code now will learn younger and faster. All of those talented new engineers that didn’t have jobs before still won’t get jobs at Google because everyone else will be that much more talented. No matter what we do, power will remain concentrated, because the underlying social structures that protect that power will remain unchanged.
This is an instance of Kentaro Toyama’s argument about technology as an amplifier rather than a catalyst of social change. The argument is that technology of any kind, whether a learning technology, a better pedagogy, a simpler programming language, or a better developer tool, will only intensify whatever social structures exist. It’s up to us to change our behavior, our values, and ultimately, our institutions, if we want to redistribute power. More effective learning will not.

Software is evil

Another critique of my thesis is that the software itself is a net loss for humanity. Communication technologies have eroded our relationships, democratization of publishing has eroded truth, platforms have eroded innovation, and automation has eroded our livelihood. There may be some good things that come from digitizing information and automating decisions, but on the whole, they take more than they give. We should therefore have less software, not more, and so we should have fewer people that can code, not more. Like nuclear weapons, we should use software sparingly, if it all.
This argument abounds in pop culture of today. As all dystopian sci-fi has for a century, Black Mirror is popularizing this position, portraying how even small changes in how we use software can lead to plausible and horrifying outcomes.

Software is dangerous

One of the critiques I’ve heard most is the idea that software is too powerful to be democratized. As in medicine, engineering, and law, some knowledge should be regulated, only accessible to people with appropriate training. The risk of allowing everyone have the ability to code is that we increase harm. And perhaps were already seeing the result of unregulated access to the ability to code: software fails, people die. In fact, I analyzed 30 years of software failures reported in the news, finding that about once per month, the news reports at least one death, injury, or threatened access to food or shelter due to software problems. Is all of this faulty software really worth this increasingly frequent harm?
Some countries such as Canada do regulate software engineering. These efforts are often poorly implemented and premature, but not necessarily wrong in principle. We don’t want a billion people to know a little bit about heart surgery. Why would we want a billion people to know a little bit about software development?

Now, to synthesis. How can we reconcile these conflicting stances?
All four of these arguments have a kernel of truth. The small number of developers in the world really do concentrate power, and that does lead to injustice like algorithmic bias, poor software accessibility for people with disabilities, and innovations that primarily serve the privileged classes that created them. And yet, software does cause harm and can be evil. It’s entirely possible that by helping more people learn to code, we’ll just end up with more people with brittle knowledge of how to create software, more bad software, and the same people in power.
The fatal flaw that puts these positions in conflict is that none of them make explicit who will learn to code and what they will do with that knowledge. I envision a world in which a vast majority of educated people understand enough about code not to become engineers, but to advocate for justice. Some of those people will become software engineers, but they will be different, more diverse people, who represent society, unlike the engineers we have now. This larger group won’t make any more software than we would have made otherwise (and therefore won’t cause any more harm or evil than we would have had otherwise). Rather, this new majority of computationally literate citizens will be a political force that demands justice.
This literacy could not be more pressing. For the next century, we will be heavily debating net neutrality, privacy, the regulation of automation. We will be trying to parent in the presence of social media. We will be trying to make objective journalism sustainable and desirable. We need every parent, politician, and person in power to understand what code is and what it isn’t. And we need the 20 plus million developers in the world to reflect everyone, so the software they create serves everyone.
The other fatal flaw in all of the positions above is that they don’t make clear what “learning to code” means. What does everyone need to understand about software to be in a position to advocate objectively? It’s not necessarily knowing a programming language. It might mean knowing what programming languages are and are not capable of. It might mean understanding the intersection between computing and policy. It might mean understanding how software is engineered and who engineers it, so everyone can comprehend what any particular policy proposal they’re voting on would actually mean in practice. Some of these ideas have made it into our curricular standards and assessments, but most have not. We need to understand what this knowledge is and invent ways of teaching it effectively.
Software is not going away. It will continue to be evil and dangerous. It will continue to bring joy and prosperity. But it will not bring social change, and it will not provide universal access to knowledge about computing. That’s up to us.

Interested for our works and services?
Get more of our update !