Tuesday, September 14, 2010

Languages & Representations

On Friday (10-09-2010) we finished the subject "Languages" by learning about different web development languages. The most basic way of creating a webpage is by coding in HTML. When you want to have a more advanced layout, CSS can be used, a language specifically suited to webpage layout.

The problem with only coding in HTML or HTML+CSS is that the content on the page is the same for every user. When you want to display a different page for each user, you have to use PHP (or a similar language like ASP) to display content based on user input. A common use of PHP is a login system. The user has to provide his or her credentials, and somewhere in the PHP code a database server will be asked to look for a record with the matching user name and password. When this record exists, the user will be directed to a personal page, and when this record doesn't exist, the user will be asked to log in in again.

Web developers nowadays want more than just a static page though. To be able to update the page without refreshing, Javascript can be used. Due to the increased need for user provided content since Web 2.0, an extension had to be build on top of Javascript, which makes it possible to put data in a database or read data from a database without refreshing the page.

After "Languages" we discussed "Representations". Representations are a very important subject in Computer Science, because it affects file size, ease of use and accuracy. The examples that were provided for representations were JPG and GIF. Both are image formats, but they have a very different way of keeping file size reasonable. JPG uses macro blocks at the smallest level. In these blocks, the pixels only differ in brightness, and not in colour, which results in smaller files, because it isn't necessary to storage brightness and colour for each individual pixel. GIF does store brightness and colour for every pixel, but uses another trick to keep filesizes down: the palette of colours is limited to 256 colours.  Although this results in small files, it also limits the file format in its use. A photo, for example, can't be properly displayed in the GIF format. When you only want to show a drawing with a limited amount of colours, however, GIF is a viable option.

We ended the lesson by looking at the representation of numbers, which is often binary in the digital domain.

No comments:

Post a Comment