diff --git a/context-free.md b/context-free.md index 8d9c470..74d0844 100644 --- a/context-free.md +++ b/context-free.md @@ -2,21 +2,27 @@ ## Who is this programming language for? +This programming language appears to be for anyone interested in vector-based digital art that does not want to go through the hassle of learning a more complete graphics editor, like Photoshop. Although the language itself is not extremely complicated, it seems geared toward someone who has some programming experience. ## What is easy to do in this language? Why is it easy? +I found it simple to generate recurring simple shapes because most of the basic shapes are built in (SQUARE, TRIANGLE, CIRCLE) and the language seems to lend itself to recursion quite nicely. ## What is hard to do in this language? Why is it hard? +I felt that doing something akin to painting, sketching, or any other form of hand-drawn art would be extremely difficult in this language. The programming language must be constructed from a series of lines and shapes; without control over every pixel, it's hard to create something that is not vector-based. On a related note, it's difficult to create any image intentionally in the sense that the programmer has to figure out what shape to recurse on, how to do the recursion, among other things. ## How did you learn how to program in this language? +I learned how to program in this language primarily through examples, such as the Welcome message and user submitted code on the website. Although there was documentation, I found it difficult to follow without more in-depth examples or images. I found experimenting with different values for each rule and noting the visual output helped a lot more than reading through the documentation. Seeing examples and experimenting with them on my own really helped solidify my understanding of the language. After getting a basic understanding of the language, I started playing around with the recursion and shapes until I found an image that I liked. ## What is the underlying _computational model_ for this programming language? _We don't yet have a great definition of the term "computational model". For now, try to come up with the clearest, most concise explanation of what happens when a ContextFree program runs._ +When a ContextFree program runs, it parses the code and creates an image on the canvas as it reaches terminals. Much like a context-free grammar, it starts with a root symbol (the startshape) and uses a series of user-defined rules to render an image. ## What do you think is interesting about the ContextFree program you wrote? +I found it interesting how significant small adjustments to the grammar can affect the final image. By changing the starting shape, the scaling factor, or the rotating factor, the final image can look completely different! I also found it interesting how complicated an image made from repeating circles can be. diff --git a/my-dsl.md b/my-dsl.md index e3ab62a..15d8d7b 100644 --- a/my-dsl.md +++ b/my-dsl.md @@ -2,37 +2,54 @@ _What is the name of the language? Link the name to its webpage (if appropriate)._ +The language is [flask](http://flask.pocoo.org/). # Domain _Describe the language's domain in five words._ +Light weight framework for web development # Computational model _We don't yet have a great definition of the term "computational model". For now, try to come up with the clearest, most concise explanation of -what happens when a ContextFree program runs._ +what happens when your DSL program runs._ +When a Flask program runs, it is interpreted as a Python program. The following explains how a complete web application built with Flask might execute, and also showcases the Model-View-Controller model: + +1. A user issues a request for the domain's root URL to go to the homepage. + +2. Some URL routing mechanism will map the URL to a Python function. + +3. The Python function finds a web template which will fetch any images, CSS, etc. + +4. The rendered HTML is sent back to the URL routing mechanism, which sends it to the browser. # DSL-ness _Fowler writes about a spectrum of languages, from general-purpose languages to "purely" domain-specific. Where does the DSL you chose fall on this spectrum, and why?_ +Flask is closer to the domain-specific end of the spectrum, as it is specific to web development. Because Flask is an intenral DSL, it contains all the programming logic of Python; however, because it was written and is used primarily for URL routing, HTML templating, and database manipulation, I think it is definitely considered more domain-specific (specific for web development) than general-purpose. # Internal or external? _Is the language implemented as an internal or external DSL? Justify your answer._ +Flask would be considered an internal DSL, as it uses a general purpose language (Python) in a particular way (web development). # Host language _What language(s) was (were) used to implement the DSL?_ +Flask is written in Python. # Benefits _Identify one potential benefit of the DSL: how is a programmer's life or a company's bottom line made easier by the existence of this language?_ +By building a web application with Flask, developers take advantage of the lightweight framework, avoiding much of the overhead typically attributed to a more "full stack" web framework. Additionally, Flask provides more flexibility and granular control with its minimal framework, leaving design choices ultimately up to the developer. Flask also allows developers to take advantage of the Model-View-Controller model, which also contributes to more granular control. # Drawbacks _Identify one potential drawback of the DSL: what does a programmer or company lose by using this DSL instead of a general-purpose language?_ + +One disadvantage of Flask is the lack of many features normally included in a "full stack" web framework, such as a data abstraction layer, form validation, etc. As such, for larger projects, web applications built with Flask require several additional libraries to fulfill these features -- several describe Flask as a "build what you want and bolt on whatever you need" framework, whereas other frameworks are described as an already complete package. However, it is worthwhile to note that not including these features make most of the aforementioned benefits possible (lightweight framework, granular control, flexibility). diff --git a/william_chen.cfdg b/william_chen.cfdg new file mode 100644 index 0000000..7d408da --- /dev/null +++ b/william_chen.cfdg @@ -0,0 +1,16 @@ +startshape shape +rule shape { +shape1 { r 40 } +} + +rule shape1 { +shape2{} +shape1{r 10 s 0.9 x 1 b .1 hue 9 sat 1} +} + +rule shape2 { +CIRCLE { } +CIRCLE { s .9 b 1} +shape2 { y 0.2 s 0.99 r 7} +} + \ No newline at end of file diff --git a/william_chen_variant.png b/william_chen_variant.png new file mode 100644 index 0000000..356e969 Binary files /dev/null and b/william_chen_variant.png differ