Javascript or not?

saw the article – You Used JavaScript to Write WHAT?

IMHO….

I thought that article was a very bias view of javascript. I do agree that javascript has much performance issues but the argument about Halo 4 on javascript and not having javascript enabled doesn’t seems quite right.

I meant games usually have system requirements, example, directx installed, certain OS etc.

In that likeness, javascript enabled could very well be one of that list of system requirements. If the user really want to play that game, he could have turned on his javascript or find javascript support. Its the same as, now if we say Halo4 is on flash, flash would have to be installed and enabled also (Oops you need flash 9… flash 8 doesnt work!)

I feel that one of the capabilities of javascript is the concept of fat client. If we have to go to the server for every single request that its not really bandwidth effective. I guess many of us realised that nowadays, OS comes with a default web browser, its like an “installed” environment for you already.

 Of course, end of the day I still agree with the author that Halo4 on javascript sound really like a bad idea because of the performance issues and its limitations.

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine

The Explore Scala Series – Overview

I thought of reading up scala and come up with a simple series of scala tutorials, at the same time, help myself familarise with the language. The idea of functional language really attracts me, of course in java 1.6, there’s support for scripting language,s

Features

  • Object-Oriented
    • Everything is an object
    • Numbers are objects also (have methods)
  • Functional
    • Every function is a value
    • Supports higher order functions
  • Statically typed
  • Can ineract with java directly

Everything is an object

As mentioned above, number is also an object, i.e they have methods and behave like what we know for a typically object. So instead of

object A{
   def main(args: Array[String]){
      println(1 + 1);
   }
}

We could have

object A{
   def main(args: Array[String]){
      println(1.+(1));
   }
}

where in here + is a method of Number.

Functional Example

object A{
 def add(num1: int, num2: int): int = {
 	num1 + num2
 }

	def sub(num1: int, num2: int): int = {
 	num1 - num2
 }

	def op(f: (int,int) => int, para1: int, para2: int): int= {
 	f(para1,para2)
 }

	def main(args: Array[String]){
 	println(op(add, 1,2)) //takes in an add function and 2 para
 	println(op(sub, 1,2)) //takes in a sub function and 2 para
 }
}

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine

Scalable java – Scala

Hello World in java:

public class HelloWorld {
    public static void main(String args[]){
    	System.out.println("Hello World!");
    }
}

Hello World in scala:

object HelloWorld{
 def main(args: Array[String]){
 	println("Hello World!")
 }
}

Into the details(decompiled form):Java:

import java.io.PrintStream;

public class HelloWorld
{

    public HelloWorld()
    {
    }

    public static void main(String args[])
    {
        System.out.println("Hello World!");
    }
}

Scala:

public final class HelloWorld
{

    public static final int $tag()
    {
        return HelloWorld$.MODULE$.$tag();
    }

    public static final void main(String args[])
    {
        HelloWorld$.MODULE$.main(args);
    }
}
//--------------------------------------
import scala.Predef$;
import scala.ScalaObject;

public final class HelloWorld$
    implements ScalaObject
{

    public HelloWorld$()
    {
    }

    public void main(String args[])
    {
        Predef$.MODULE$.println("Hello World!");
    }

    public int $tag()
    {
        return scala.ScalaObject.class.$tag(this);
    }

    public static final HelloWorld$ MODULE$ = this;

    static
    {
        new HelloWorld$();
    }
}

Seems like there’s more stuff for a simple example like this.
But the language seems quite cool.
Several powerful factors includes:

  • compiling to java bytecode(as you can see from above, meaning that it runs on the JVM (hmm… its quite interesting that it is said to be scalable when its running on JVM, but anyhow, gotta explore further)
  • functional language, yet borrows ideas from OO (definitely a very attractive feature)

I’m still quite new to the language but probably I will compare (syntax-wise) java with scala when I’m doing slides for my java tutorial class 🙂

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine

Web X.0?

Web 2.0 has been the buzz word for quite a while. We are really moving in the collaborative way. From a “search-get” style(1.0) to a “search-get-share” style(2.0). I’m thinking that in web 3.0, it will be more web services centered/API style. Its true that currently many sites have been adopting it already(like facebook, google etc) but i guess we just need one major party to bring the whole hype up.

Saw this article

http://www.bin-co.com/blog/2008/01/defining-web-20-at-3-levels/

Thought the Design section was quite interesting.

  • Simple Design
  • Lots of white space
  • Nice icons
  • Badges
  • Big Wordings
  • Gradients
  • Reflections
  • Shadows

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine

Amy Editor

Its interesting to see that there are very similar projects to what I have been working on – WikiSpy.

WikiSpy is actually an application to the tiddlycard system. Tiddlycard is an adaptation of tiddlywiki that the group of us have been working on.

Anyway, back the what WikiSpy is, basically if you have played around with tiddlywiki, the wiki posts are in the forms of tiddlers, so building on top of comet, I’ve managed to allow multiple users to concurrently write and delete text from a tiddler.

Of course Amy Editor seems much nicer and more well developed

http://www.april-child.com/amy/website/

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine

Modified comet messaging paths

Normal messaging
Basically when a user publish a message to a channel, on the comet server, the server will broadcast the message to all the subscribers of that channel. In most cases, the author of this message is usually a subscriber of that channel also.

normal comet process
Some modification to the paths that could be done on the server side:

Others Only
In this case, let’s assume that the publisher is also a subscribe of that channel, in normal cases, the publisher would get a copy of the message, but we could tweak it slightly that now the publisher no longer receive its own messages.

only_others.jpg

Author Only
In this case, there might be cases where we want to find out some information about a channel but we don’t want other subscribers to receive it. In most cases, this is due to security reasons where you don’t want other subscribers to know certain things, or it could be to prevent unnecessary flooding. Of course in this picture, the diagram should be interpreted slightly differently, instead of treating the blue arrow as the same copy of the message from the red arrow, the blue arrow should be more relevant information provided by the server. One such information could be the list of subscribers to that channel. Due to the nature of such information, it would not be desirable to broadcast the list to everybody everytime any of the subscribe make such a request.

only_author.jpg

 Directed messaging
In this case, we are trying to simulate P2P communication, where a subscriber can talk to another subscriber.

only_author1.jpg

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to FurlAdd to Newsvine