Friday, July 5, 2013

Coding - An Essential Skill for 21st Century Onwards?

“For most people on Earth, the digital revolution hasn't even started yet. Within the next 10 years, all that will change. Let's get the whole world coding!" - Eric Schmidt, Executive Chairman, Google

“Software touches all of these different things you use, and tech companies are revolutionizing all different areas of the world...from how we shop to how farming works, all these things that aren't technical are being turned upside down by software. So being able to play in that universe really makes a difference." - Drew Houston, Founder & CEO, Dropbox

“One of the most important skills any entrepreneur should learn is to program a computer. This is a critical skill if you want to start a tech startup, but a basic knowledge of code is useful even in traditional fields, because software is changing everything." - Reid Hoffman, Executive Chairman & Co-founder, LinkedIn

“Whether you want to uncover the secrets of the universe, or you just want to pursue a career in the 21st century, basic computer programming is an essential skill to learn." - Stephen Hawking, Theoretical Physicist, Cosmologist, and Author

This is where the world is moving towards as very clearly indicated by these "game-changers" on Code.org.

Here's my first attempt at learning coding myself. I've started with Java, and successfully did a small exercise:

Exercise: Loop through and print out all even numbers from the numbers list in the same order they are received. Don't print any numbers that come after 237 in the sequence.

951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544, 615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941, 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470, 743, 527


Solution: And here is the AscendingOrder.java program:


public class AscendingOrder {
     public static void main(String [] args) {
       int[] numbers = {951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544, 615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941, 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470, 743, 527};
    int x = 237;
       for (int i = 0; i < x; i++) {
       int el = numbers[i];
       if (numbers[i] == 237) {
          break; }
    if (el % 2 == 0) {
    System.out.print(el + ", ");
}
}
}
}


Upon running the program, you get the following result:

402, 984, 360, 408, 980, 544, 390, 984, 592, 236, 942, 386, 462, 418, 344, 236, 566, 978, 328, 162, 758, 918,