Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a DSL and where should I use it?

Tags:

I'm hearing more and more about domain specific languages being thrown about and how they change the way you treat business logic, and I've seen Ayende's blog posts and things, but I've never really gotten exactly why I would take my business logic away from the methods and situations I'm using in my provider.

If you've got some background using these things, any chance you could put it in real laymans terms:

  • What exactly building DSLs means?
  • What languages are you using?
  • Where using a DSL makes sense?
  • What is the benefit of using DSLs?
like image 748
crucible Avatar asked Sep 03 '08 14:09

crucible


People also ask

Where can I use DSL?

A DSL connection works better when you are closer to the provider's central office. The farther away you get from the central office, the weaker the signal becomes. The connection is faster for receiving data than it is for sending data over the Internet. The service is not available everywhere.

What is DSL good for?

DSL broadband internet runs through landline phone wires. Moderate range DSL speeds of 10-25 Mbps are great if you're looking for affordable internet for light use, like checking email, streaming video on one or two devices, and occasional gaming.

What is the most commonly used DSL?

ADSL is the most widely deployed form of DSL technology. Most homes and small businesses currently using DSL technology use ADSL. Characteristics of ADSL are as follows: ADSL is used to transmit digital information on preexisting phone lines.

Does DSL work on any phone line?

Whereas dial-up internet blocks phone signals from using the line, DSL operates at higher frequencies than phone signals do. Because it doesn't interfere with phone service, DSL can be an always-on solution.


1 Answers

DSL's are good in situations where you need to give some aspect of the system's control over to someone else. I've used them in Rules Engines, where you create a simple language that is easier for less-technical folks to use to express themselves- particularly in workflows.

In other words, instead of making them learn java:

DocumentDAO myDocumentDAO = ServiceLocator.getDocumentDAO(); for (int id : documentIDS) { Document myDoc = MyDocumentDAO.loadDoc(id); if (myDoc.getDocumentStatus().equals(DocumentStatus.UNREAD)) {     ReminderService.sendUnreadReminder(myDoc) } 

I can write a DSL that lets me say:

for (document : documents) { if (document is unread) {  document.sendReminder } 

There are other situations, but basically, anywhere you might want to use a macro language, script a workflow, or allow after-market customization- these are all candidates for DSL's.

like image 62
Tim Howland Avatar answered Sep 17 '22 14:09

Tim Howland