Swift has many outstanding features of the most advanced languages today
There are many ways to order a smart device (laptop, desktop, smartphone, tablet .) to do exactly what you want. The most accurate but complex way is to write command lines with . machine code (binary code) or use assembly code. When writing the assembly code, you will have to write each detailed statement for very small operations, such as changing some of the memory, changing the color of a pixel on the screen . in other words, all the operations The smallest action that hardware can perform.
If you write an Assembly code (or machine code), you can perform the most complex, right-to-expect behavior. But, obviously, when using low-level languages (low-level languages: far from human language and close to machine language) such as machine code or assembly code, application programming becomes extremely boring. , hard and very easy to make mistakes. Writing Safari or even Flappy Bird with Assembly code would be impossible.
Therefore, you will need high-level programming languages. Instead of executing every small command from the programmer, the computer will receive a "high" command from the coder and execute this command itself. High-level languages are similar to human languages in that they have a very clear syntax, with specific limits on the placement of words that language users need to follow.
Swift has a high-level structure: simple, accurate, not redundant lexic or operator
To understand the difference between high-level programming languages and low-level programming languages, imagine when you asked a close friend to give you a Coca can. If you use a high-level programming language, you will say "Hey, throw me a Coca can on the table!" , and this friend will know how to perform this behavior. If you use Assembly language, you will have to say the full paragraph: "Sit up. Put your feet on the floor. Use your hands as a fulcrum. Get up from the sofa. Step one step with your right foot. Step with your left foot "Take the Coca can with your right hand. Turn to me. Take a step with your right foot .".
In short, in low-level languages, you will have to describe all the independent behaviors needed to perform the entire task. Even if you forget to order "use your hand as a fulcrum", your friend (computer) may fall (error) when performing the task.
It is this that forces people to use high-level programming languages. Among high-level programming languages, C is the most "classic" language. This is the ancestor of many other popular programming languages today, from C ++, Objective-C, C # to both Java and PHP. Among the influenced languages / variants from C, Objective-C is Apple's traditional choice and also the foundation for building iOS and Mac OS.
But, when C was up to 40 years old and when Objective-C was 30 years old, Apple needed change. The answer is Swift.
The script programming language, often called scripting language, is becoming more popular than it used to be. Typically, high-level programming languages will need to be compiled into machine code to be able to execute. The compilation process done by the compiler is when high-level statements (such as "getting a Coca can") are converted into small, simple commands that the computer can perform.
Based on the language specific syntax, the commands that human (programmers) can read will be converted into machine code, and if the compilation process succeeds, you will get a real application. the. Note that uncompressed source code files will not make sense to the CPU at all.
However, compiling the source code may take a long time. As mentioned above, if you have not included the source code in the compiler, you will not know whether the code lines you have written actually work perfectly. In many cases, errors in your code will not be detected until the compiler performs its task, and even when compiled, you will have to run the program to detect the errors. rest. All of this makes the software application process very slow.
Script languages are different from these languages. You can run the script you just wrote right away, from one line to the next. You can check your results without waiting for the compilation process. This makes the application development process much quicker and easier.
However, script languages also have their limitations. The first limitation is about functionality: they cannot do complex tasks like other compile languages. Worse, they are limited in processing performance. This makes script languages much more limited than compile languages and is not used to implement programs that require optimal hardware power.
Swift promises to bring 35% higher performance than Objective C
As such, scripting languages such as Python are easy to write and test (test), but they are not powerful and are not fast enough to perform complex application tasks. In other words, Python is not really suitable for writing heavy games, which require the maximum use of the power of the device. Traditional programming languages (such as Objective-C) provide performance when running on iPhone / iPad, allowing creating complex applications like iMovie or Call of Duty. However, using Objective-C often comes with a large amount of compile time and application testing. Learning to write Objective-C is also a long process, which can be difficult for less experienced programmers.
If all of Apple's promises are fulfilled, Swift will bring all the strengths of both traditional scripting and compile languages. In some benchmark tests, Swift gives faster performance than Python and is even faster than Objective-C. On Apple's Xcode IDE (programming software) suite, Swift source code will be graphed based on real-time playground features. This means that programmers can run and test Swift source code as easily as Python does.
In the example given at WWDC, a programmer took to the stage to perform a graphic of flying up / down for the balloon periodically. To do this, he needs to use a simple mathematical function: sine function. Sin creates a pretty wavy graphics, and so the sine function will be quite perfect for our example.
In the demo stage on the WWDC stage, the Swift programmer was able to impose on the motion of the balloon easily. He can monitor the sine function change value when running his program, based on a simple chart displayed in Xcode. This makes it easy for developers to visualize the movement of the balloon.
In the same examples, you can adjust the movements very easily. Recently, an application developer even uses Swift to create a primitive version of Flappy Bird within . 17 minutes! Usually, the software development process requires programmers to write code, perform compilation (through the compiler), then run the program and . hold their breath hoping. Depending on the size of the application, the process of compiling and testing the application may take a few seconds, a few minutes or longer.
Impressive graphics on iOS 8
The ability to develop mobile applications and test your results in real time will help the programmer's code process become much faster and easier. Also, not having to run compiler programs and testing programs too often will save the hardware power for developers. Instead of focusing on testing, testing small features, Swift programmers can spend more time to perform higher-level integration tests more carefully.
The second benefit of Swift is that the code is very short and easy to read. In Apple's presentation, 3 lines of Objective C code can be encapsulated into 1 line of code Swift. This will accelerate the application development process and increase the efficiency for future maintenance / patching.
Finally and perhaps most importantly, if Swift creates lower-pressure Objective-C hardware hardware applications, we will enjoy a more impressive gaming experience on iOS devices. When combining Swift and Apple's new Metal platform, even the old A7 processor can deliver the most impressive graphics experience.
Swift's biggest weakness will be the young age of this programming language. More specifically, to use Swift, developers will have to re-learn a completely new programming language. The technology industry often prefers to master the latest, coolest technologies. However, the iOS application segment has also become so big that thousands of people have spent months to master Objective-C; Objective C training for iOS has become an important industry; There are companies that only focus on this programming language (and iOS). Since Swift will definitely replace Objective-C, iOS application developers will take a considerable amount of time to master Apple's new language. This can reduce the rate of development of Apple application ecosystem.
Another concern is garbage applications. Since Swift will make the application development process much easier than before, the number of poor quality apps that appear on the App Store might increase. However, this is not really a real concern for Apple and Apple users. Through this transition period, Swift will help bring iOS and Mac applications to a new level.
Theoretically, Swift is promising to be the "perfect" programming language for application developers. What Apple needs to do is make sure its promises will become reality.
We are so used to technology companies launching impressive numbers as evidence that their products are the best, more advanced than all "old" products and competitors. . But, in the programming world, things are not so simple. It will take a long time for developers to verify what Apple says. It took a long time for the mobile industry to understand the benefits of Swift. This is a huge change, so big that you won't be wrong to say that for the mobile app development industry, Swift is as important as the App Store when it first came out.