CSC/ECE 517 Fall 2012/ch1 1w9 av: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 35: Line 35:
== Examples ==
== Examples ==
=== PHP ===
=== PHP ===
[PHP<code>http://en.wikipedia.org/wiki/PHP</code>] is an OODSL that is commonly used for web development.
[http://en.wikipedia.org/wiki/PHP<code>PHP</code>] is an OODSL that is commonly used for web development.
=== OODSL compiler for FPGA ===
=== OODSL compiler for FPGA ===
An object oriented domain specific compiler was developed for programming Field Programmable Gate Arrays.<ref>Object-Oriented Domain Specific Compilers for Programming FPGAs[http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=920835&userType=inst&tag=1]</ref> The compiler allows the hardware programmer to make use of object-oriented style while programming. The research paper claims that this way of programming the hardware reduces the design time several times and still result in an optimal performance.
An object oriented domain specific compiler was developed for programming Field Programmable Gate Arrays.<ref>Object-Oriented Domain Specific Compilers for Programming FPGAs[http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=920835&userType=inst&tag=1]</ref> The compiler allows the hardware programmer to make use of object-oriented style while programming. The research paper claims that this way of programming the hardware reduces the design time several times and still result in an optimal performance.

Revision as of 22:14, 14 September 2012

An OODSL is a Domain-specific language (DSL) that exhibits characteristics that have traditionally been attributed to Object-Oriented Languages

Although OOP languages and Domain specific languages have been around for several years, OODSLs are relatively new.


Overview

The general purpose programming way of ordering hash browns at Waffle House

There is a plant called a potato, which is a tuber, a root plant. Take the potato, harvest it, wash it off, and chop it into little cubes. Put those in a pan with oil and fry them until they are just turning brown, and then drain the grease away and put them on a plate. OK, next I want cheese. There’s an animal called a cow...

The OODSL way of ordering hash browns at Waffle House

Scattered, smothered, and covered

For a person who works at Waffle House, or goes there regularly to eat, it is a no brainer that the second method is much more efficient. There is no absolute rule that determines when an application becomes an OODSL. Example: it can be ba

OODSL can be of 2 types:

Internal External

OODSLs take advantage of the context within which communication takes place. By using implicitly understood jargon,

internal, external

History

OODSLs cannot be spoken about without first a brief introduction to Domain Specific Languages and the Object-Oriented programming paradigm.

In a nutshell, DSL is a language that is specific to a particular domain. DSLs are different from general purpose programming languages like C++ and Java. They take advantage of the fact that there are groups of users who rather than communicating every single thing, are able to implicitly understand certain terms and notations. This makes communication much more efficient for such a group. Eg: 2 basketball fans will talk in basketball jargon. Not everyone will understand what zone defence, 3 pointers and jump ball mean. The jargon serves the specific purpose of easing communication between 2 basketball fans. Some would argue that DSLs have been around for a far longer time dating back to even before the advent of computers. Subway maps, electronics circuit diagrams all demonstrate properties of a DSL. Since then, DSLs have come a long way. Domain Specific Languages (DSLs), as they are spoken about now, have been around since the 1970's and their origin can be traced back to a tool called Draco. Since Draco, computers have made it possible to design a whole host of other useful DSLs. Some of the more popular ones among them are SQL, Prolog, Verilog, HTML etc.

Object-Oriented Programming (OOP) is a programming paradigm that tries to apply real world principles to make programming easier. OOP has been around since the 1950's. Starting with Simula and Smalltalk, OOP languages have come a long way since then, and has grown to become one of the most popular programming paradigms employed worldwide. Some of the modern object oriented languages include static languages like C++, Java, C#, and dynamic languages like Perl, Ruby etc.

OODSLs, that bring out the features of both DSLs as well as OOP languages are a fairly recent invention. OODSLs have been around since the 1980's/1990's. They are now primarily used in the realm of web development, game development, and are also used in certain specialized industries like music.

Examples

PHP

PHP is an OODSL that is commonly used for web development.

OODSL compiler for FPGA

An object oriented domain specific compiler was developed for programming Field Programmable Gate Arrays.<ref>Object-Oriented Domain Specific Compilers for Programming FPGAs[1]</ref> The compiler allows the hardware programmer to make use of object-oriented style while programming. The research paper claims that this way of programming the hardware reduces the design time several times and still result in an optimal performance.

Tools for Creating OODSL

When creating an OODSL, one can either choose to scratch from the scratch or use a tool that is already available to create the language. Creating a language from the scratch gives flexibility to the programmer to define it the way he wants to but it takes a lot of time. In general, some tools are used to create Domain Specific Languages. This is because it not only saves time but also helps to make the language easy to use.

Boo

Boo<ref>Boo Home[2]</ref> is an open source object oriented language to create Domain Specific languages. Defining basic data structures like array, hash, variables etc are inherently supported in Boo and it makes creation of them easier. Although Boo is a statically typed language, these restrictions can be bent once in a while so that the type of objects can be found and manipulated in run time as well (Duck typing).

Visual Studio

Visual Studio has Domain-specific language tools that are designed to help the designer to build a language focusing on the language grammar and characteristics rather than internal details of the compiler.<ref>Domain specific development[3]</ref> The tool shows visual tools that helps focus on the business requirements of the OODSL rather than worrying about the internals of its working.

Groovy

Groovy <ref>Groovy Home[4]</ref> is a dynamic language for the Java Virtual Machine. Also, the syntax is groovy is similar to that of Java making designing of new DSLs easier and similar to programming in Java.

OODSL vs. non-OODSL

When defining a DSL, choosing whether to go with a OODSL or a non-OODSL depends on several factors like the domain for which it is defined, existing DSLs for that domain etc.

Advantages and Disadvantages

Conclusion

References

<references/>