-
Notifications
You must be signed in to change notification settings - Fork 13
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
Hannah Y #7
Open
younghkb
wants to merge
1
commit into
hmc-cs111-spring2016:master
Choose a base branch
from
younghkb:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hannah Y #7
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,73 @@ | ||
# Context Free | ||
|
||
## Who is this programming language for? | ||
## Who is this programming language for? | ||
This programming language appears to be aimed at those interested in math | ||
and computer science and want to use those concepts in an artistic manner. | ||
To create anything interesting, basic knowledge of what a program/rule is, | ||
recursion, etc is necessary. Also, commenting mimics that use in C/Javascript, | ||
further suggested this is aimed at those with some programming experience. | ||
However, knowledge of more advanced concepts, like class structure or | ||
control flow, is not necessary to create beautiful pictures, making this | ||
more accessible. It seems like a good way to either build confidence with | ||
programming or to program just for aesthetic pleasure. | ||
|
||
|
||
## What is easy to do in this language? Why is it easy? | ||
Recursion and randomization is very straight-forward in this language. This | ||
becomes quickly evident when looking through the first lesson provided. To | ||
randomize, all one has to do is create multiple rules of with the same name. | ||
Then, after the name, one puts a number that indicates its weighting relative | ||
to the other same-named rule. This controls how likely one of them is to show up. | ||
To use recursion, all one has to do is put the rule inside of itself and size it | ||
smaller than the starting rule. The renderer determines when it will be too small | ||
to be seen and stops the recursion there. This is especially convenient, as it | ||
means the user can implement a limited form of recursion without having to consider | ||
base cases, weird edge cases, etc. | ||
|
||
|
||
## What is hard to do in this language? Why is it hard? | ||
For me, the hardest part of this language is understanding how the positioning, | ||
sizing, etc will render. The scale and positioning system is very unintuitive to | ||
me, and I found myself surprised by how my changes appeared when rendered. I | ||
think that adding some sort of reference/grid option that shows how the positioning | ||
works would be useful for gaining intuition. This probably is not necessary for | ||
more advanced users, but for beginners it could prove helpful. Another concept | ||
I found confusing was how layering works in this program. For example, in | ||
Photoshop, one can create layers for different objects to specify their | ||
respective z-positioning. However, it was unclear how to control this Context | ||
Free and also what the standard seemed to be. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have to ask if this is really an intended use case of the DSL though. |
||
|
||
|
||
## How did you learn how to program in this language? | ||
To first acquaint myself with Context Free, I looked through the code for the | ||
welcome image. I took parts of it and copy-pasted it into an example image | ||
to play around with the code and get a general sense of how it worked. This is | ||
how I figured out to use startshape and which rules were built-in. However, | ||
I did not have a good sense of what the specifications were for shapes and how | ||
to use them. To learn these, I turned to the two lessons listed under the help | ||
menu. This was highly useful. I additionally discovered the recursive | ||
properties of Context Free and how other rules could be included in a program. | ||
When I was confused about other things I wanted to make happen, I refered to the | ||
examle images to find the code for the properties of interest. In general, | ||
I found that learning by example was effective for this language. | ||
|
||
|
||
## 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 appears that it compiles all of the | ||
different rules. It then refers to these rules as necessary. It starts by | ||
going to the rule associated with the startshape command, and then follows | ||
the rest of the as necessary. | ||
|
||
|
||
## What do you think is interesting about the ContextFree program you wrote? | ||
From an exploring the language perspective, I was able to take advantage of | ||
both recursion and randomization in creating my image. I also played with | ||
formatting features, like positioning and lightening the black. Furthermore, | ||
I used a library to add text. From a artistic standpoint, I tried to have the arrows | ||
lead into the spiral and used the black boxes to frame the edges. As for what it | ||
means, I have no idea, but it is meant to be visually appealing in the way the | ||
eye follows the lines. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
startshape STUFF | ||
|
||
include i_pix.cfdg | ||
|
||
rule STUFF { | ||
TURN1 { y 10} | ||
TURN2 { y 10} | ||
TURN3 { y 10 } | ||
SQUARE {y 3.7 size 7 3.7} | ||
SPIRAL { y 2} | ||
TITLE1{ x -2.3 y 3.5} | ||
SQUARE { x 10 y 4 size 3 15} | ||
} | ||
|
||
rule TITLE1 { | ||
W_5by5 { x 0 b 1 size 1} | ||
H_5by5 { x 1.2 b 1} | ||
Y_5by5 { x 2.4 b 1} | ||
|
||
} | ||
|
||
rule ARROW { | ||
TRIANGLE { size 0.5 } | ||
SQUARE { x 0 y 5 size 2 4 } | ||
} | ||
|
||
rule SPIRAL { | ||
ARROW { size 0.5 } | ||
SPIRAL { y 0.6 | ||
rotate -6 | ||
b .003 | ||
size 0.995 } | ||
} | ||
|
||
rule TURN1 { | ||
MAYBE { } | ||
TURN1 {x -1 y 1 size 0.7} | ||
TURN1 {x 1 y -1 size 0.7 } | ||
} | ||
|
||
rule TURN2 { | ||
MAYBE { } | ||
TURN2 {x -1 y 2 size 0.7} | ||
TURN2 {x 1 y -2 size 0.7 } | ||
} | ||
|
||
rule TURN3 { | ||
MAYBE { } | ||
TURN3 {x -1 y 3 size 0.7} | ||
TURN3 {x 1 y -3 size 0.7 } | ||
} | ||
|
||
rule MAYBE 20 { | ||
TRIANGLE { x 0 y 0 size 0.3 } | ||
} | ||
|
||
rule MAYBE 10 { | ||
TRIANGLE {x 0 y 0 size 0.3 rotate -3} | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,67 @@ | ||
# Language | ||
_What is the name of the language? Link the name to its webpage | ||
(if appropriate)._ | ||
Bootstrap, http://getbootstrap.com/ | ||
|
||
|
||
# Domain | ||
_Describe the language's domain in five words._ | ||
Front-end web development beautification | ||
|
||
|
||
# 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._ | ||
I'm going to assume this question intends to ask what happens when a | ||
Bootstrapped program runs. Bootstrap is a JS/HTML/CSS framework that | ||
contributes to both the functionality and aesthetic during web development. | ||
It provides consistent formatting for elements like tables, headers, etc and | ||
implements basic interactive tools like radio buttons, dropdown menus, etc. | ||
(Note that it does not do any work to connect client to server.) | ||
|
||
|
||
|
||
# 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?_ | ||
Bootstrap is more on the domain-specific side of the spectrum. It does not nearly | ||
have the expressivity to implement things like loops or advance logic. It mearly | ||
has the ability to implement predefined web interactions and appearance. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might help to reference the text here. |
||
|
||
|
||
# Internal or external? | ||
_Is the language implemented as an internal or external DSL? | ||
Justify your answer._ | ||
|
||
I claim that Bootstrap is an internal DSL. It is created using common web dev | ||
languages (HTML, CSS, etc) to be use in conjunction with those very languages. | ||
Furthermore, it displays the characteristic of being built with particular | ||
components of its base languages in order to deal specifically with user interface | ||
features, which Fowler lists as a key attribute of an internal DSL. Note that | ||
at least JS and HTML can do much more than just UI work. | ||
|
||
# Host language | ||
_What language(s) was (were) used to implement the DSL?_ | ||
JavaScript, HTML, CSS, LESS, and Sass | ||
|
||
|
||
# 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?_ | ||
This tool allows for easy, straightforward beautification during web dev. | ||
Given that people tend to take better formatting more seriously, it is useful | ||
when quickly prototyping an idea in a larger corporation. For a smaller developer, | ||
it can help them save time by easily making a clean web page without having | ||
to put in the effort to learn design principles and the intricacies of languages | ||
like CSS (a not-especially difficult but surprisingly finicky language). | ||
|
||
|
||
# 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?_ | ||
The use of bootstrap means loss of control over the design of the webpage. If a | ||
developer chooses to use this, they will be unable to make specific modifications | ||
in terms of spacing, coloring, etc as easily because Bootstrap takes over those | ||
features. Additionally, the website has less personality and is more generic, | ||
which is not as good a strategy when trying to stand out. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great explanation!