Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

William Chen #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions context-free.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@

## Who is this programming language for?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you specify that it's vector-based.

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider how this language differs than those that you mention. While it accomplishes vector-based digital art, it isn't necessarily for people who want to draw every type of image, right? Its really easy to do recursion and automation, so think of how those features of the language alter the intended user.


## What is easy to do in this language? Why is it easy?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think identifying the "terminal shapes" as we called them in class is important. It's also fairly easy to implement randomization.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Yes

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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You and I approached this question differently--I answered it more from the stand point of implementation whereas you considered the output. It's interesting to think about difficulties from both sides of the spectrum (coding and results). So for mine, I focused on the logistics of placement, which I found difficult.

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, and that changes the intended user of the language.


## How did you learn how to program in this language?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here :)

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._

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this explanation--very concise and straightfoward.

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great description


## What do you think is interesting about the ContextFree program you wrote?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, you approached this from describing the product of your script whereas I considered the code itself. I think it's interesting to consider how look at those different sides of the process tell us about the DSL. I think your point of view address the domain itself whereas mine addresses the ease of use. Both useful things to consider.

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.
19 changes: 18 additions & 1 deletion my-dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,54 @@
_What is the name of the language? Link the name to its webpage
(if appropriate)._

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice markdown

The language is [flask](http://flask.pocoo.org/).

# Domain
_Describe the language's domain in five words._

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is obnoxious but technically that's six 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._

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting--would make it easier to integrate cool Python libraries into web design. Do you know anything about the loading time of this? How fast does it fetch the information?

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?_

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good explanation

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its really important to consider the nouns and verbs accessible with the DSL instead of its intended purpose. In the reading, R is mentioned as a language that is very far from the DSL side of the spectrum. Even though it is basically only used for statistics, the lenience it allows its users changes how domain-specific it really is. So what does the framework specifically allow you to do, or even more importantly not do? How does that change how domain specific it really is?


# Internal or external?
_Is the language implemented as an internal or external DSL?
Justify your answer._

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

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?_

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally sure how this fits into MVC yet? Is the Flask application the C part or the M part?

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would focus more on how Flask differs from other lightweight frameworks. Does its association with python decrease the barrier for entry? Does the specific way things are written reduce the amount of errors that can occur? Because most lightweight frameworks allow for MVC and allow for granular control. Its incredibly important to focus on how it differs from its competitors, what benefits make people want to use Flask over all the others.


# 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?_

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the cost to the developer of using those additional libraries? Increased runtime, difficulty, etc?

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).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused on how having less features allows for more granular control... I do like how you compare Flask to other similar DSLs though.

16 changes: 16 additions & 0 deletions william_chen.cfdg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
startshape shape

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, your picture is crazy cool. Woah.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Its awesome.

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}
}

Binary file added william_chen_variant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.