Microsoft and DSLs

ruby

    Sponsored Links

    Next

  • 1. "of" keyword? inverse dot syntax...
    Hi, Consider this: some_data.to_s.split("\n").each{|item| puts item} how about an alternative syntax for the dot operator: each{|item| puts item} of split("\n") of to_s of some_data or, more intelligently: this_school.students.addresses.map{|address| a.all_as_one_sentence} map{|address| all_as_one_sentence of address} of addresses of students of this_school Just wondering if this is a possibility? :) julian.

Microsoft and DSLs

Postby ptkwt » Sat, 19 Feb 2005 18:04:17 GMT

Found in the Software Developers Magazine Agile newsletter in my inbox 
this morning.  Since there has been some discussion of DSLs (domain 
specific languages) in recent days I thought it might be pertinant.

It seems that M$ isn't totally happy with UML so they're trying a 
different approach to modelling:

"Luckily, the OMG isn't the only modeling game in town. Microsoft
has struck out on its own, a strategy that has clearly served it well
in the past, and is suggesting a new approach to modeling: Domain
Specific Languages (DSLs). As the name implies, a DSL is aimed
at addressing a specific task. For example, you could define a DSL
to model a Web services-based architecture or the physical schema
of a relational database. This is a far different approach than UML's
general, wide-purpose models. For example, UML class diagrams
can be used for conceptual modeling, object-oriented analysis
modeling, object-oriented design modeling, logical data modeling and
physical data modeling. DSLs can be visual or textual, and are
described in detail in the book Software Factories (see review below),
and the concept is being implemented in the upcoming version of
Visual Studio." 

This is one case where M$ seems to be on the right track (did I say 
that?:).  I am not a fan of UML, but I am a fan of DSLs.  And Ruby is 
great for creating DSLs.

Phil

Re: Microsoft and DSLs

Postby Austin Ziegler » Sat, 19 Feb 2005 21:38:49 GMT


[...]

FWIW, the author of that statement is wrong. UML cannot be effectively
used for either logical or physical data modeling. It's too based in
object modeling. People who use UML for ER/data modeling are making a
huge mistake. There's far better modeling methodologies out there than
UML.

Other than that, I agree -- the move toward DSLs is encouraging. The
one thing that would be useful with DSLs is encouraging people to
share their DSL specifications and implementations so that people can
work from similar concepts. This won't necessarily lead to a "unified"
DSL (which is undesirable) but it will reduce the likelihood of
duplicate work that is just slightly mismatched.

-a
-- 
Austin Ziegler *  XXXX@XXXXX.COM 
               * Alternate:  XXXX@XXXXX.COM 



Similar Threads:

1.UML and ER modeling (was: Microsoft and DSLs)

"Austin Ziegler" < XXXX@XXXXX.COM > schrieb im Newsbeitrag
news: XXXX@XXXXX.COM ...
> On Fri, 18 Feb 2005 18:34:51 +0900, Phil Tomson < XXXX@XXXXX.COM >
wrote:
> [...]
> > "[...]This is a far different approach than UML's
> > general, wide-purpose models. For example, UML class diagrams
> > can be used for conceptual modeling, object-oriented analysis
> > modeling, object-oriented design modeling, logical data modeling and
> > physical data modeling.[...]"
>
> FWIW, the author of that statement is wrong. UML cannot be effectively
> used for either logical or physical data modeling. It's too based in
> object modeling. People who use UML for ER/data modeling are making a
> huge mistake. There's far better modeling methodologies out there than
> UML.

Just curios: what do you think are the major shortcomings of URL that make
it inappropriate for ER modeling?

Kind regards

    robert

2.User defined loops (applicable to DSLs)

We've been having this discussion about defining your own while loop in a 
thread about Haskell and I thought I'd change the subject in case people 
who had no interest in Haskell were avoiding it ;-)

In article < XXXX@XXXXX.COM >,
Phil Tomson < XXXX@XXXXX.COM > wrote:
>In article < XXXX@XXXXX.COM >,
>Robert Klemme < XXXX@XXXXX.COM > wrote:
>>
>>"Phil Tomson" < XXXX@XXXXX.COM > schrieb im Newsbeitrag 
>>news: XXXX@XXXXX.COM ...
>>> In article < XXXX@XXXXX.COM >,
>>> Robert Klemme < XXXX@XXXXX.COM > wrote:
>>>>
>>>>
>>>>I'm surprised about "retry", too.  His analysis sounds all very 
>>>>resonable -
>>>>only that "break" does not work for me but "return" does:
>>>>
>>>>>> def my_while(cond)
>>>>>>   break unless cond
>>>>>>   yield
>>>>>>   retry
>>>>>> end
>>>>=> nil
>>>>>> i = 0
>>>>=> 0
>>>>>> my_while i < 10 do
>>>>?>   puts i
>>>>>>   i += 1
>>>>>> end
>>>>0
>>>>1
>>>>2
>>>>3
>>>>4
>>>>5
>>>>6
>>>>7
>>>>8
>>>>9
>>>>LocalJumpError: unexpected break
>>>>        from (irb):2:in `my_while'
>>>>        from (irb):7
>>>
>>>
>>> Hmmm...  break works find for me in 1.8.2.  Time to upgrade?
>>
>>Yeah, maybe.
>>
>>>>Btw, can anybody think of a way to make my_while return the result of the
>>>>last block evaluation?  It seems impossible because the return occurs 
>>>>before
>>>>the yield...
>>>>
>>>
>>>
>>> How about:
>>>
>>>  def my_while(cond)
>>>    return @ret unless cond
>>>    @ret = yield
>>>    retry
>>>  end
>>
>>Not thread safe.  And I think also not nesting safe.
>>
>
>Yes, I know.  Did you see my later post?  I don't think it made it from 
>the newsgroup to the mailing list.
>
>Here's the code to make it nestable and threadsafe:
>
>  class Whiler
>    def initialize
>      @ret = nil
>    end
>
>    def while(cond)
>      break @ret unless cond
>      @ret = yield
>      retry
>    end
>  end
>
>  outer = Whiler.new
>  inner = Whiler.new
>
>  i=0
>  outer.while i<5 do
>    puts "i: #{i}"
>    j=0
>    inner.while j<5 do
>      puts "  j: #{j}"
>      j+=1
>    end
>    i+=1
>  end
>
>A bit cumbersome, perhaps, but it is definately nestable and should be 
>threadsafe as well.
>

Actually, I figured out a way to make it much more natural:

Change Whiler to accept an optional condition in it's constructor like 
so:

  class Whiler
    def initialize(cond=nil)
      @ret = nil
      @cond = cond
    end
    def while(cond=@cond)
      break @ret unless cond
      @ret = yield
      retry
    end
  end


Define the my_while top-level method like so:

  def my_while(cond,&block)
    Whiler.new(cond).method(:while).call(&block)
  end


Now the user of my_while doesn't need to know that a Whiler class even 
exists.  Usage example:

  i = 0
  my_while(i<10) do
    puts i
    j=0
    my_while(j<10) do
      puts "  j: #{j}"
      j+=1
    end
    i+=1
  end


I think there are some implications for DSLs (Domain Specific Languages) 
in this example.  
The my_while method as defined above (the last one) hides some Ruby 
language details from the user of my_while so that my_while can appear like a 
natural looping construct.  I've created DSLs for people who had 
no idea they were using Ruby underneath; this sort of thing is 
necessary so they don't feel as though they are obliged to learn 
Ruby to use the DSL. 

Another example of why Ruby is so good for creating DSLs. ;-)


Phil

3.Documenting DSLs

Hey, has anyone thought about or worked on a "next gen" documentation
system for handling Ruby DSLs?

I have some code that I'd really like to DSLify, but I don't want to
loose the RDocs. Let me give a simple example.

  # What mysev does.
  class MyService < Service

    register :myserv

    action :foo

    # What foo does.
    def foo
      ...
    end

  end

This is a (simplified but) common pattern is some of my work. I'd love
to write this as a DSL:

  # What mysev does.
  service :myserve do

    # What foo does.
    action :foo do
      ...
    end

  end

Ideally, I suppose the doc tool could be taught that #service
translates into a subclass of Service, and #action translates into a
method. (Not sure how feasible that is though.)

No doubt I could roll my own special documentation tool for my
personal needs, but I already have too much to do. I'd much prefer a
general solution.

T.

4.Microsoft Visual C++ Runtime Library

I am receiving a dialog box with the above title and messages of

Runtime Error!

Program C:\Ruby\bin\rubyw.exe

This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application's support tema for more information.

ruby 1.8.1 (2003-12-25) [i386-mswin32]

A small program with ActiveRecord against SQLServer is causing this.
What is the process to follow this to solution?

5.Microsoft brings Ruby to the browser?

6. Generating Microsoft word document using ruby or rails.

7. Microsoft's C/C++ compiler freely available

8. Microsoft Timestamp (Active Directory)



Return to ruby

 

Who is online

Users browsing this forum: No registered users and 18 guest