علوم کامپیوتر دانشگاه اصفهان

علوم کامپیوتر دانشگاه اصفهان
طبقه بندی موضوعی

5 Programming Languages You’ll Need Next Year (and Beyond)

چهارشنبه, ۸ مرداد ۱۳۹۳، ۰۴:۰۴ ب.ظ




متن کامل در ادامه مطلب


copyright--- source article: news.dcie.com

BY  | 

We’ve reached a bit of a turning point in the world of programming. Ten years ago, programmers were moving into dynamic languages. To many of us, those languages seemed like a bit of a fad, even if they made programming easier. But those languages endured, and today we’re developing software with a combination of old and new tools. That creates the potential for confusion: What languages are best to learn if you want to stay employed?

Before diving into which programming languages will likely prove most popular over the next year or two, let’s look at what makes them so different from one another.

Static vs. Dynamic Languages

When referring to dynamic languages, the term “dynamic” really refers to the variable types in the language. When you write code and declare a variable, dynamic languages let you change the type of data held by the variable when the program is running; those languages that don’t are known as “static” or “strongly typed.” Languages such as C++ and Java are strongly-typed languages, whileJavaScriptPHP, and Perl are dynamic languages.

When you declare a variable in C++, you provide the type of data it will hold (such as integer, float, or string). If you try to store a different type in that variable, the compiler will issue an error and won’t compile the program. The same happens with Java.

But JavaScript, for example, allows you to change types anytime you want, while the program is running. In fact, with JavaScript, you don’t even specify a type when you declare a variable: After you declare the variable, you can store an integer in it, and then later a string, which will replace the existing integer.

Although there was a lot of excitement in recent years over dynamic languages, the concept is roughly fifty years old.

Functional Languages

With the excitement over dynamic languages came an increased interest in functional languages. A functional language is one whereby the functions themselves can be stored in variables and passed around as parameters to other languages. Most languages today support some level of functional programming. C++, for example, has always let you pass around pointers to functions. However, other languages such as JavaScript make it much easier to handle functions as objects. As such, people don’t really consider C++ a functional programming language, whereas JavaScript usually is considered one, and Haskell is usually considered the best example of a functional language.

Garbage Collection

In theory, if you write your code correctly, you should never have any bugs. How does that sound for a nice statement? But when you’re working on a huge project with multiple programmers, there’s one bug that seems to creep up a lot: Memory leaks. A memory leak happens when you allocate a variable, finish using the variable, but forget to free up the memory associated with the variable. If a program does this a lot and the program runs for hours, days, weeks, or more, the amount of memory the program uses will continue to grow, until the system crashes. I think most people would agree that that’s bad.

The thing is, in theory, such a thing should never happen: When you’re done with the variable, free the memory. Easy enough, right? Yet people continue to break that rule, partly because it’s not always that easy. When you store data in a list, and that list gets passed to a function written by somebody else, and some members of the list get copied over into another list, and the original caller doesn’t know that that happened, should the original caller delete the memory or not? It’s not always clear-cut. So language developers have come up with an alternative: Just stop using the variable when you’re done, and the system will notice that the memory is no longer used and clean it up for you. That’s called garbage collection, and it’s an important feature in a lot of newer programming languages. And the idea is sound: If it makes your job as a programmer easier, then you can focus your energy elsewhere in the pursuit of creating great software.

Now I should clarify that there are actually a couple different types of garbage collection: one where the system periodically scans through memory, looking for memory no longer in use; and one where the system keeps tabs on each variable, and as soon as the variable is no longer needed, the memory is deleted. Technically the latter isn’t garbage collection; rather, it’s considered “reference counting,” but the end result is similar in that the variables are cleaned up automatically.

Virtual Machine

When Java came along in the mid-1990s, people griped that it wasn’t immediately compiled to assembly language in the same way as C++. Instead, the Java code is compiled down to something called bytecode. Then at runtime, a system called a virtual machine executes the bytecode, sometimes only then compiling it to assembly code. People complained because when it first came out, it was kind of slow—but that isn’t the case anymore. Many languages run with a virtual machine, including Java and C#. Today, these languages pass benchmarks that keep them speedy.

The Languages

So what languages should you be learning? We’ve picked five important languages for the next year, ones that will likely see a lot of demand on the jobs front, and included some coding examples. Most of these aren’t new languages either. In addition, we’ve added a sixth language as an “honorable mention.”

JavaScript, HTML5, and CSS3Technically, HTML5 isn’t a language. But it is a technology that, along with CSS3 and JavaScript, allows you to build Web-based software applications. And don’t be mistaken: You can create real software applications that run in the Web browser. The great thing is that, when you do so, your apps can run across devices, including mobile ones. A couple years ago, companies such as Facebook took the jump to creating their mobile apps in HTML5. Unfortunately, they were a bit ahead of their time. The technology wasn’t quite ready, and they went back to writing their apps in native code. But in the past two years, browsers have finally started implementing the best HTML5 technologies. The number of jobs listing JavaScript alone is growing. If you want to secure your future in computer programming, this is a technology you must learn. (Also, as a side note, a lot of big companies are using server-side JavaScript as well in the form of Node.js.)

JavaScript Example
This example demonstrates how you can pass a function as a parameter into another function. I’m creating a function, saving it in a variable, and passing that variable into the setTimeout function. There are many resources on JavaScript; for a nice definitive guide, check out the Mozilla Developer Network. For a nice tutorial, take a look at this website.

var myfunc = function() {
alert(‘hi’);
};
setTimeout(myfunc, 2000);

C#: Microsoft created C# about 15 years ago as a new kind of programming language similar to Java; since then, the platform has grown several times over. The language’s syntax looks a lot like Java (which, in turn, bears similarity to C++). The flagship tool for programming in C# is Visual Studio; while there are premium versions of Visual Studio, there are also several free Express versions.

C# is a strongly-typed language, which runs inside a virtual machine. The original version had little support for functional programming, but Microsoft changed that around 2006 when it added several functional programming features. The virtual machine framing C# includes garbage collection.

C# Example
This example is a class called Program that includes a class function called Main. The runtime calls Main when the program begins. The code creates a strongly-typed variable called x of type integer, and prints out its value. To learn more C#, head over to Microsoft’s official site.

using System;
class Program
{
static void Main()
{
int x = 1000;
Console.WriteLine(x);
}
}

Java: Java is approaching its twentieth birthday, and it has continued to grow and mature. In 2004, a coworker of mine referred to it as a “toy language.” While it might have had some growing pains early on, it is certainly not a toy language: it powers large websites and databases, and the Open Office software suite is written in Java. The language is solid, and the future continues to look bright for it.

Java is strongly-typed language, and runs inside a virtual machine that includes garbage collection. It includes functional features, although isn’t a functional language.

Java Example
Java and C# are similar in many ways. Here we’re creating a class that includes a main that gets called when the program starts. Like the C# example, we’re creating a strongly-typed variable of type integer, and printing out its contents. To learn about Java, start at the official documentation.

public class HelloWorld
{
public static void main(String[] args) {
int x = 1000;|
System.out.println(x);
}
}

PHP: PHP is a general-purpose language that is easy to use. The language’s syntax bears some resemblance to Java and C++. On a very simple level, it’s used inside a Web page to embed text that might change. For example, you can have a Web page that includes some PHP code that prints out the current date; the final Web page sent down to the browser will have the date showing the PHP code’s original placement. But PHP is much more than just for printing text on a Web page. It includes a massive library for doing everything from reading and storing data in databases (pretty much any database you can think of), to performing scientific calculations, to processing text. The future remains bright for PHP, as jobs continue to abound.

PHP is a dynamic language and runs inside a virtual machine. (However, thanks to a project spearheaded by Facebook, there are also compilers that convert the PHP code to C++ code, which is then compiled.) Since 2009, PHP has included functional programming support.

PHP Example
This PHP code is embedded inside an HTML document. The PHP code sets the current time zone to Los Angeles, and then prints out the current time. The PHP code itself gets replaced by the output from the PHP code. Thus the final web page will say, “Hello! The current time is” followed by the current time. You can start learning PHP at this website.

<html>
<body>
Hello! The current time is
<?php
date_default_timezone_set(‘America/Los_Angeles’);
echo (strftime(‘%c’));
?>
</body>
</html>

Swift: And now for a brand new language: Swift, from Apple. Normally I wouldn’t pick a brand-new language and suggest people start learning it. But this is Apple we’re talking about, and you can already use this new language to create iOS apps. In fact, there are indications that this is going to be the future of programming for iOS. (Be careful, though; there’s another programming language called Swift that is completely separate.) The syntax looks a lot like JavaScript, but without all the semicolons and parentheses in JavaScript.

Swift is a strongly-typed language, that operates inside a runtime with garbage collection.

Swift Example
This code creates a variable called str that holds a string. Although I’m not providing a type for the variable, the language is strongly typed, and the compiler figures out that I’m storing a string; it does so by looking at the right-side of the equal sign. As such, it assigns a string type to my variable. Then the next line prints out the contents of the string. Learn more about Swift at Apple’s website.

var str = “Hello, World!”
println (str)

Honorable Mention:

ErlangErlang is an older language that was invented in 1986 by engineers at Erricson. It was originally intended to be used specifically for telecommunications needs, but has since evolved into a general-purpose language, and found a home in cloud-based, high-performance computing when concurrency is needed. People are using it to write some really powerful software, such asCouchDB and Riak. The language is a bit unusual in that it doesn’t really look like any other language, and it has some strange ways of handling strings, but it’s pretty easy to learn.

Should you learn Erlang? The reason I bring it up here is because it’s in a bit of a unique situation. There aren’t a lot of Erlang jobs out there. However, if you do master it (and I mean master it, not just learn a bit about it), then you’ll probably land a really good job. That’s the trade-off: You’ll have to devote a lot of energy into it. But if you do, the payoffs could be high.

Erlang Example
For an example in Erlang, I’m going to borrow an existing one. This example comes from this blog that explains a complex “hello world” example. Remember, Erlang is a sophisticated language. If you’re bold and want to go forth with it, check out the aforementioned blog as well as this site.

-module(hello).
-export([start/0]).
start() ->
spawn(fun() -> loop() end).
loop() ->
receive
hello ->
io:format(“Hello, World!~n”),
loop();
goodbye ->
ok

Conclusion

Programming positions will continue to grow. There won’t be any shortage of jobs anytime soon. The key is learning the right technology to land you that great job. You can’t go wrong with JavaScript, C#, Java, PHP (and even C++, which I didn’t include on the list). If you want to start learning Swift, you’ll probably see jobs growing in the coming years. And if you really want to get into some high-powered programming, take a look at Erlang, although you probably won’t land an Erlang job immediately. Regardless of which technology you go with, keep studying, keep learning, and master it.

موافقین ۲ مخالفین ۰ ۹۳/۰۵/۰۸
سعید جزی

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی