Thursday, December 4, 2014

Advanced Blog Post 12/4/14

For the last two weeks in advanced computer science I have been learning more about c++, as well as various other small things. Most recently I completed the general trees lab. I wasn't entirely satisfied by the method through which I generated the tree because, while it was random, there were certain types of trees that it would never generate. For example, it could never generate a tree in which multiple children at the same level had children. So a tree that looked like this would never be created.

A way that it could be improved would be to add some sort of option to either add children to a random child or to go back up to the root and choose another random branch entirely.

As a side note I learned how to make popups in html. It takes forever in blogger because if there's a single mistake it doesn't tell me where the mistake is, it just doesn't work which can be frustrating. But the realization that there is the option to write all of my blogs in html has made writing blogs a lot more entertaining (and time consuming).

I am currently working on the UIL programming problems in class. So far I have been able to do all the problems pretty easily (although I have only done two because I got distracted and had to finish general trees and write this blog). I don't think I will have much trouble completing eight of the problems though. I actually enjoy doing the UIL problems because it is a fun way to practice coding while solving things that occasionally cause me to have to think to find a solution. I've done the problems in java so far but plan on also doing a few in c++ to get some more practice with the language.

Sunday, November 23, 2014

Webapp Blog Post 3

The Google App Engine eliminates the need to worry about web servers interacting with data that is spread around two many different locations around the world. The data repository is called a High Replication Datastore and uses the Paxos algorithm to replicate data across datacenters. Entities are data written to the datastore. Each entity has a key that uniquely identifies it in the database. There is also the option with each entity to designate another entity as a parent entity, making it the child of the parent entity. In this manner the datastore entities form a hierarchical structure. The hierarchical structure consists of ancestors, descendants and root entities. Ancestors are anything above the entity (its parents or its parents parents, etc.), descendants are anything below the entity, and a root entity is an entity without a parent. An entity descending from a common ancestor with another entity is said to belong to the same entity group as that other entity. These groups have a parent key, which is the common ancestor's key. This key identifies the entire group and ancestor queries which query of an entity group refer to the parent key instead of the specific entity key. A primary strength of the datastore is that it is very resilient in the face of catastrophic failure.

Sunday, October 19, 2014

HTTP GET vs HTTP POST Requests

The primary difference between HTTP GET and HTTP POST requests is that HTTP GET request asks for data from the specific resource while the HTTP POST request submits data to be processed. For example, in the Guess Number lab the get() method in my code responded to the HTTP GET request from the browser by writing a response that output "Good luck!" with a form asking for the initial guess a submit button. The form then uses an HTTP POST request to provide the guess to be processed by the post() method in my web application.

There are also other differences between HTTP GET and HTTP POST requests. HTTP GET requests include the parameters in the URL, are used for fetching content, have a maximum length dictated by the maximum URL length, are okay to cache, and should not change the server. HTTP POST requests include the parameters in the body of the request, is used for updating data, has no maximum length, is not okay to cache, and can change the server.

Tuesday, October 14, 2014

Vectors and Arrays Advanced Computer Science

After working with both arrays and vectors in c++, the primary difference I see between the two is that while arrays are of fixed length, vectors can constantly be added to by inserting new elements. This naturally inclines both of these different data structures to be effective for different tasks. While arrays are very good for programs in which I know exactly how long of an array I need, vectors are good for performing operations in which the length of the vector either changes or depends on the value of an alternate variable. For this reason, I find vectors to be much more useful. They also are useful in that they store with them their size and their capacity (how many elements could potentially be stored in the currently allocated memory block). Vectors also change the amount of memory they are allocated as their size changes and the memory they took up is freed when they are destroyed. The trade off of all of the benefits of vectors is that for small, short-lived arrays vectors are not as efficient. One example of when vectors came in handy was when doing the lab that the group presenting vectors designed. In the lab I had to iterate through thousands of triangle numbers to find the one that had over 500 multiples. This would have been impossible to do with arrays because I didn't know how many triangle numbers it would take to come to an answer (it ended up being a lot). However, with vectors, I was able to continue to add triangle numbers to the first position of the vector and expand the size of the vector until I reached the triangle number I wanted. Overall, I like using vectors more than arrays, but both data structures have their own advantages and disadvantages and which one to use depends largely on the situation at hand.

Sunday, September 28, 2014

Web Applications Blog Post 1


Learning HTML/CSS

I think that the way in which we learned HTML and CSS in the class was fairly effective. I enjoyed the different projects and think that those were the most helpful things we did. The powerpoints were also beneficial, but sometimes felt like an information overload because we went through them very fast. I didn't like using codeavengers. While it was sometimes helpful the majority of the time it was just regurgitating what was taught in the powerpoints and was not particularly innovative in how it did so; I didn't really like that codeavengers felt very tedious and was very particular about what it wanted. I would frequently do things correctly but not exactly how they wanted it, which was very frustrating. It felt a lot like busy work when we were doing it. I think that doing projects is the best way to learn to code because it forces me to figure out how to do things and I learn as I look things up while I go along. While the html projects were a little frustrating, I still learned a lot while I was doing them and think that they were worthwhile.

I learned the most when doing the Stanford assignments we did in class because they were very challenging. I had to spend a lot of time googling things and working with others to figure out how to make the assignments look right. The biggest thing I learned while doing the projects was the importance of divs, classes, and ids in organizing html to make for cleaner code and easier css. While these things are not necessarily visible on the page, they are very useful in organizing the page. Overall, I think that I learned a lot about HTML and CSS formatting and am much better prepared to use it effectively on projects in the future.

Friday, August 29, 2014

Algorithm Ted Talk (Advanced Computer Science)

I thought the most interesting part of the TED Talk was the idea that the algorithms that are written to do various things are beyond the control of the humans that created them. Many of the algorithms that are floating around on the internet are not understood by anyone and I find it very interesting that there are algorithms so complex that what they are actually doing is unknown. The possibility raised by the speaker that its possible that these algorithms could suddenly just stop working was something I had never previously considered. Almost everything is controlled by algorithms, many of them incredibly complex. When these algorithms stop working, it may be nearly impossible to figure out why, or even to know that they are no longer working.

The other part of the TED talk that I found interesting is how much money is poured into infrastructure that works solely towards knocking micro seconds off the amount of time it takes to send a single transaction. The idea that mountains are tunneled through by companies just to gain a seemingly intangible edge over the competition is incredible. The amount of time being saved by multi million dollar investments is less than the amount of time it takes for me to even click my mouse. The complexity of the algorithms involved and the amount of money poured into these fiber optic cables underground is astounding.

Overall the TED talk altered how I think about algorithms. I didn't realize the scope and importance they have in everything I use in my daily life, from watching videos on Netflix to driving my car. The TED talk taught me that there is a whole world of complex algorithms operating beneath the surface of the internet that i'm entirely aware of yet have a significant impact on my life, and that these algorithms can be studied and dissected in the same way that one might observe and dissect living organisms.

Tuesday, May 27, 2014

End of Year Reflection

 Throughout the year AP Computer Science has consistently been one of if not my favorite class to go to. While on B days, I often dread going to physics and sitting through an hour and a half of lecture, A days are not like that - and much of this is due to having computer science third period. While comp sci is not perfect, nor is it always enjoyable, it still maintains a relaxed atmosphere that makes the course not feel so much like an AP course. I took computer science because I am interested in computer science, not so I could gain some sort of exemption from college classes, and this probably influences my perspective of the course when looking back on it, but regardless I enjoyed computer science much more than I can say for many of my other classes. I took pleasure in coming each day to learn new aspects of java and programming as a whole, despite not loving every topic. There were parts of the class that felt unnecessary, parts that I forgot immediately after the lecture and never relearned, and parts that I wish we could have covered in more depth, but that is intrinsic in the nature of any class. Overall I had a positive experience that I feel has influenced the career I plan on pursuing in the future, whether it be engineering, computer science, or something entirely different I haven’t yet decided upon. AP Computer Science is one of the few classes that I can say that for.

 There were many things I liked about the class. Foremost among these is the labs. Some of the labs I feel could use improvement, among these the localization lab, gridworld labs, and pong lab, but others like the recursion lab I felt were very helpful. The localization lab falls under the category of labs that I feel is a good idea but just seemed too easy. It wasn’t really a bad lab, I just didn’t get any sense that I was really learning much new from it and upon finishing, I was left wondering if Weston and I had perhaps missed another page of things we were supposed to do or looked at the lab in too simplistic a way. Having said that, it was a good review of scanners and arraylists as well as a small introduction to abstract classes; I just feel it could have been fleshed out a little more. I understand that it is very difficult for you to make something like gridworld interesting, and that you were using previous AP problems for the gridworld labs, but they still felt boring and tedious. There is probably nothing you can do about it, but I felt it worth mentioning that the gridworld labs were among my least favorite labs of the year. As for the pong lab, I don’t feel entirely correct in putting it in the can be improved category of labs because it was also one of my favorite labs. However, I think there were elements of it that do warrant being placed in that category. I think the instructions in some areas could be clarified, and that implementing the collisions was a nightmare. My primary suggestions would be to put somewhere that by default only certain keys work to move the paddles, and also to provide a clearer explanation perhaps in pseudo code or a general algorithmic outline of how the collisions should work. With a few clarifications in the code and instructions, I think the pong lab would easily be the best lab we do. The recursion lab was one of the most helpful labs in my opinion. While practicing on coding bat I was a little confused by the concept of recursion, and it was not until I did the labs that I really felt I had a pretty good grasp on it. Overall, for me the labs were the most important part of the course and I can’t imagine learning computer science not through labs. Programming is a very experiential skill, and I think that doing labs is the only way to really learn the material.

Monday, March 24, 2014

5th Six Weeks

     This six weeks we have learned recursion and various methods of sorting lists as well as searching methods. An important concept we have been introduced to is the idea of efficiency, adding an additional element in deciding how to structure programs. Rather than just looking at how to solve a problem, I must also look at how to best and most efficiently solve a problem. Sorting algorithms we have learned include bubble, selection, insertion, and quick sorts. I like quick sort the best because it tended to have the shortest run time out of all the sorts when we tested it in the sorting lab. Between the binary and linear searches we learned I like the binary search much more because it is much faster and better in almost any situation. Recursion is a difficult topic to learn initially, but doing the labs and playing cargo bot helped me learn the concept, although I am still working on understanding it more fully. The thing I had the most trouble understanding when learning recursion was that I have to trust that the program will work. Instead of explicitly solving the problem, I have to establish the base case and through doing recursion allow the program to figure the rest out. It is also difficult to establish when recursion is necessary. After learning recursion, there is a tendency to want to use recursion to solve every problem I am confronted with, but often recursive solutions are not the best ways to do problems. I also started to learn how to combine HTML, Javascript, and CSS into one program in my free time because I was bored on Sunday. I discovered the website jfiddle.net and built a basic calculator using a combination of these three languages, something that took me way too long but I was proud of nonetheless. I found that while codecademy is helpful in learning syntax, when making actual programs it is more helpful to browse through other people's code and see how they did things in their programs, so I consequently spent a lot of time on stackoverflow looking at other people's solutions to issues.

Sunday, February 9, 2014

Semester Two First Six Weeks

It has been a little over a month since my last comp sci blog and I have advanced a lot in that time, moving on to increasingly complex concepts like polymorphism, interfaces, inheritance, composition, and ArrayLists. My favorite concept we've covered in that period is ArrayLists because having the power to so dynamically modify arrays has proven itself to be extremely useful and saves a lot of time. I also like that we have moved on to longer and more complex labs like the pong lab, my favorite lab so far this year. I enjoy using the graphics library to actually create visual elements that my code modifies. It is much more satisfying than simply outputting written results to the console and allows for a wide degree of flexibility in how I choose to implement things as well as chances to do weird and funny things like randomly changing the ball's color, direction, speed, or visibility. The pong lab also presented a lot of frustration as Weston and I struggled with implementing collisions before finally figuring out how to detect collisions by projecting the ball's path forward and bouncing when it would hit in the next frame thanks to help from Evan. This offered a newfound insight into the challenges that can sometimes arise when creating more complex programs, although pong is relatively simple. However, this frustration made finally finishing pong that much more rewarding. In addition the new ways of structuring classes we are learning about, while sometimes confusing, are interesting. Before this I had never really considered the idea classes only defining what methods will go in a different class or what the purpose of such a class would be. I still don't entirely understand the use of interfaces but as I begin to understand them I also get a greater appreciation of how they could be useful, especially when working on larger projects. I also enjoy doing AP free response questions because they allow me to see what type of problems I will be asked on the AP as well as my progress throughout the year. Overall I continue to enjoy comp sci and look forward to continue to learn more java during the next two six weeks.

Sunday, January 5, 2014

Beginning of Second Semester Blog Post

As the new year comes we exit the first semester and enter the second semester of AP Computer Science. I was very happy with the first semester and during it I learned the basics of computer science from the simple data types like integers, doubles, and booleans, to more complex concepts like strings, objects, arrays, loops, and parameters. Each new topic has challenged me in its own way, but overall I have not found the course to be overwhelmingly difficult, something I hope remains true. As for what more Mr. Stephens can do for me as a student to make the next semester better there is very little to say, as I was satisfied with almost all of the first. I sometimes felt like I had too many worksheets over the more enjoyable programming aspects of the class, but I understand that these worksheets are very important. Even the not so fun aspects of computer science must be learned and the worksheets are an invaluable tool to try out the new concepts we learn on problems and get feedback. The personal feedback we get on worksheets is one of my favorite aspects of the class because what we're doing never really feels like busy work, it is all valued enough to be corrected and returned to us. The labs always successfully teach us new ideas through directly experiencing them and their uses, and the quizzes remain short and a helpful insight into what AP questions will look like. There is much more that I as a student can do to make my semester better. I would like to work on doing the worksheets faster so I get them back by the quiz date, improving the algorithms I use in labs to try to emphasize efficiency over simple brute force approaches I tend to use a lot, and stay a little bit more focused in class so I don't find myself having to study more than I would like outside of class. Overall it was a good first semester and I look forward to the second.