2010年11月28日 星期日

Dynamic programming languages advantages in Web development

Dynamic programming languages are very popular in recent years. It is said that using dynamic programming languages like Python and Ruby(In the following sections, dynamic programming language refers to Python and Ruby) takes only one-third to one-fifth development period of traditional programming language like Java to create an equivalent program. However, they also have a disadvantage that they run normally slower than traditional programming languages Since there is no the best programming language without specifying a context, today we are going to discuss about the advantages of dynamic programming languages over traditional language in web development. There are 3 advantages. They are duck typing, Metaprogramming and framework.

Duck typing is dynamic typing that the functions and attributes set of an object defines the current semantics, but not the inheritance form certain class or implementation of certain interface defines it [1]. In duck typing, when you invoke a member function or access a member attribute of an object, you actually send a message to it. If it can handle it, it handles it. If not, it raises an error. Duck typing allows programmers to be more productive because of three reasons. First, programmers write fewer codes for declaring the objects. Second, programmers most likely don’t need to wait the compilation time like in most static typing programming languages. Third, programmers do not need to implement code for checking or typecasting an object. All the above factors affect the development time in the coding aspect. Moreover, duck typing enables the development of some very important framework for web application development like Ruby Rails or Django for Python which are almost impossible to be developed in traditional programming languages like Java because it doesn’t have duck typing. Duck typing in dynamic programming languages save a lot of development time on all kinds of applications including web applications and provide great framework which traditional programming languages cannot offer.

Metaprogramming is to write a program that write or manipulate other programs as their data [2]. In fact, it is about to write a program which create another program according to its data at run time. This feature is not used by most programmers in normal case, but it is in fact one of the most important features for creating a generic framework or library and programmers may get benefit directly from these framework or library. This is also another reason that those frameworks like Ruby Rails or Django for Python is not possible to be created by traditional languages like Java. Overall, Metaprogramming is the key for creating great framework like Ruby Rails or Django for Python for web application development in dynamic programming languages.

Framework is the key advantage among all advantages that dynamic programming languages have. Here Django for Python will be used as an example for analyzing how this framework affects the productivity of web application development and Java will be used as an example for our comparison. Django’s design philosophy is to reuse any modules or what we call apps and bundle these reused modules or apps into a larger application. A killer feature of Django is the apps called admin interface. This admin interface is code generated UI interface that allows the users to manipulate the data in database like listing, searching, filtering. This is in fact the job that many Java developers do everyday. There are other languages that offer the same or similar functions, but none of them offers to a level matched with Django. The admin interface can work out of box without any modification or customization and can be more beautiful and have even more features than a hardcoded admin interface created by programmers. With the new tools on hand, programmers can be more productive and concentrate on high level design like what database items the page should show or which field should be allowed to be deleted by the users. From this example, we can know that a good framework is really important for any programming languages to be productive in web application development. Django admin interface is not the only example for this, but we are not going to dig into the details of other example. With the great framework like Django and Rails, dynamic programming languages are becoming even more powerful than any traditional programming languages.

In conclusion, dynamic programming languages are more powerful than traditional programming languages in web development because they have duck typing, Metaprogramming and mostly important great frameworks. However, as I have already stated in the first paragraph that dynamic programming languages are normally slower than traditional programming languages. The most important thing is to select the right tools for right place and dynamic programming languages win in the game of web applications development.

Reference

沒有留言:

張貼留言