An Algorithmic and Social Introduction to Computer Science (CSC-105 2000S)


How might the control structures you learned yesterday help you write JavaScript applications?

Adan

Cathy

Ivy

well, referring to conditionals and repetition, the most obvious ways in which they would help in writing JavaScript applications is in saving time. especially repetition. that way you don't have to repeat yourself and type the same thing in over and over. (or copy and paste it either.)

conditionals allow you more flexibility in that you can write something into the program that doesn't always have to apply. being able to specify when and where you want something to happen gives you more control over your page. i don't know how much more specific i can get than this.

Jae

If by control structures, you mean the password code, it seems to be useful on the web as a method of getting people to pay for entrance into a site. Some job search websites want you to enter a credit card number before they will send you a password to their on-line services/web-page information, and I am sure there are many other examples of this type of thing.

If control structures is a broader term, meaning just the javascripts we learned in class, then I think they have a variety of uses. I was particularly interested in e-mail buttons because I think that giving easy options for people to contact the website is one of the ways and individual or organization can have excellent opportunities for discourse with others. Clocks were not that interesting to me, but I see them being useful for page update-type applications and, in the case where user information could be logged, studying patterns of website-user interaction which might contribute to a businesses marketing techniques.

I have some concerns about the way information takes up space on computers, and I think that in some cases the bulk of programs that are launched at the opening of web pages that interrupt the speed at which a person can browse through a variety of pages because they demand such initial interaction detract from the purpose of the internet. Moreover, the more things you have in a webpage's design, the longer it takes to load. The internet should prioritize emphasizing information transmission more than increasing design applications that can be distracting to users (like color changing to preferences by people). I think it would be more efficient to have a control that you can choose the basics in the beginning as default-type settings. By all means, web-pages should be interesting and fun, but sometimes I just want to scream at pop-up windows and computer alert

Jeana

Confused by the question. (Ok.)

Jeff

First, I am going to attempt to define a control structure. It is an algorithm that controls the order of executions.

 
If (condition) then (do something)
else (do something else)

In JavaScript it can be:

if ( navigator.appName == 'Netscape' ) {

document.write( '<embed src = "originaldedodedo.wav" autostart="true" hidden="true" loop="true" ></embed>' );

} else if ( navigator.appName == 'Microsoft Internet Explorer' ) {

document.write( '<bgsound src = "originaldedodedo.wav" loop="-1">' );

} 

First, control structures enable to the page to customize to the user. If I am running Netscape then I have different options based on Netscape than I do if I was running I.E.

Second, control structures control time and give the algorithm an order. If the user activates a menu bar then the control structure might be:

If onClick is on pulldown then act (onClick="document.pulldown.src") then the control structure gives the order of operations.

Third, control structures can activate a different algorithm than the user picked. An example could be that the user wanted to download a game. The user would onClick a button to beginning to download and the algorithm would activate the download. A separate algorithm could then be activated opening a link to a hint book to that game or could advertise a game upgrade.

Fourth, control structures can determine how long a user should wait for a webpage to open before it decides that the webpage is unavailable. If no response from http://www.nytimes.com in 5000 milliseconds then return return "Page not found" or "Page not found: Click refresh or make sure you typed the url correctly or both"

Joel

I am not exactly sure what control stuctures are, but if they are referring to replacing the current document, using a JavaScript code file, conditionals, and repitition, then I would say that they help you execute different functions, but I wouldn't say they necessarily help you "write" JavaScript. However you can use them to update the document, write XHTML code, do different things depending on various settings you've received, and create a loop, respectively, using these JavaScript intructions/applications.

Kevin

Even though I missed class, I see all kinds of nifty things that can be done with conditionals and repetition in JavaScript. Of most interest to me, though, is the idea that these things will let the page creator to do fancier things with their pages than just menus and such. I think it allows the author to include more interactive things in their pages, like interactive graphics and such, and allows more user-author interaction than just the traditional "what you see is what you get" Web page. (strange that I'm already using the word "traditional" in regard to Web pages, such a young medium) I think all pages should strive toward a higher level of interactivity.

Liz

I'm not sure I completely understand the question. I guess that the things such as loops and conditionals are a way of refining what you want your page to do. I've found with many things that if you have a basic knowledge of something, you can usually accomplish a lot with it, but the ways you have to do things aren't always the easiest or most efficient. The more intricate control structures you learn, the more refined your work can get, so there isn't a lot of superfluous work being done. Thus, what we have learned of JavaScript is helpful because we can specialize the functions of our pages without wasting a lot of effort.

Sam

Well, most directly I learned something productive from the searching process, finding out how many different JavaScript programs that there are on the web. Downloading the source code of a function and uploading it onto an existing page is a quick route to installation. I know it's a shortcut, but it is a legitimate means to construct a web page. So in this respect, I learned how to improve a Javascript program by upgrading the applications and learned how to easily install them.


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS105/2000S/Questions/question.25.html

Source text last modified Wed Feb 16 08:16:01 2000.

This page generated on Mon Mar 6 09:56:15 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu