For what kind of problems DSL is the appropriate solution? [duplicate]
Possible Duplicate:
When should I use a Domai开发者_JAVA技巧n Specific Language?
For what kind of problems DSL(Domain-specific language) is the appropriate solution?
When dial-up is just not fast enough, you can't get cable where you are at and cannot afford a T1. :)
Do you mean DSL for Internet connection or DSL for domain specific language?
If you mean Domain-specific language, then the case would be you are trying to solve ONE particular problem and you also gonna deal with it over and over again. And also while you dealing this problem, there is no an exact sequence of steps that would works for every times, so you would need some dynamic approaches or patterns that you can apply.
When talk about DSL, mostly the first thing come to people's mind will be SQL, and it's a good example of DSL. First, it solve one problem: communicating with relational database. You don't use SQL to launch rocket or make coffee. Second, we need a convenience way to talk to the database everyday, it's not a one time deal. And third, there is a pattern we can apply to talking to the relational database, those data entries all have their attributes and relations and bla bla bla. That's how comes many kinds to DSL such as HTML, MATLAB and regular expression.
Comparing to the general purpose language, I think the whole idea about DSL is to giving up the ability (and sometimes flexibility) to do anything to gain the advantages to do one thing well enough. Focus, focus and focus.
So I guess the short answer to your question will be, the DSL is for: 1. One particular problem 2. You have to deal with this problem many times 3. You know a pattern that you can apply
For more theory detail, you can reference to http://en.wikipedia.org/wiki/Domain-specific_language
精彩评论