JavaOne 2009 Slides

JavaOne 2009 slides are available here.  The videos are not yet available but should appear under this same link when they are if they are consistent with JavaOne 2008.  Definitely take a look at some of these if you are a Java developer or developer of any type even.

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

Return from JavaOne

It’s been a week since JavaOne and I finally have the time to at least talk about what I thought about it.  The core of JavaOne in my opinion is that it is an eye opening experience, there are people all over doing very cool things with Java.  What you get out of going is incredible if you can process a small fraction of it, what you learn does come in useful in your day to day work.  I know my coding practices will change as a result of going to JavaOne this year.

I thought it was very cool how all of the rockstar figures are just roaming about like regular people, you can essentially walk up to them and have a conversation as many did.  Some of the most notable technical talks for me came from Joshua Bloch, Bill Pugh, and William Ernst.

JavaOne was very interesting and helpful, it is a must if you are a Java developer.  I hope to be there again next year!

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

Immutability and Functional Languages

Introduction

Coming from an object oriented background, recently I was introduced to the functional paradigm.  Functional languages tend to lean towards building applications using functions which produce no side effects and have objects be immutable.  Producing no side effects means every function has an input, an output, and no state outside of the scope of the method is modified.  We are focusing on the second aspect of functional languages which is immutability.

#define Immutability

What does it mean exactly to have objects be immutable?  An immutable object is simply an object where after creation its state cannot be changed.

    Point p = new Point(2,5);  // Create a new Point object with coordinates (2,5).
    // If the Point object is immutable, there is nothing we can do to change the state of the object that p references now!

Why immutability?

The question now is, what does immutability buy us, isn’t it merely inconvenient if I can’t modify the state of an object?  First of all, something you should be asking yourself before you allow for modification of the state of an object is, do I really need to be able to change its state?  If the answer is a blatant no then you should do whatever is necessary in the language you are working in to make this object immutable, why even have mutability if it is not necessary?  As Josh Bloch would say, “When in doubt, leave it out”.

Aside from this practice that many developers follow there are actual benefits to immutability.  With immutability, concurrent access in these areas is thread safe because nothing will ever change which simplifies your code by removing any necessary locking mechanisms you would need to put in.  Also with immutability, shallow copies of an immutable object are just as good as a deep copy.  An object reference to an object which cannot change is just as good as an object reference to a new object which cannot change with the same values.  The amount of memory saved with using shallow copies per object with the same state is approximately the sum of the memory taken up by all member variables for the object subtracted by the memory used for an object reference.

Consequences of Immutable Objects

Now that we know what immutability is and what it buys us I can dive into some of the consequences of immutable objects.  Take the following code for example assuming that Point is immutable:

    Point p = new Point(3,5);  // Create a new Point object with coordinates (2,5).
    for(awhile) {
        sleep(100);
        p = new Point(p.getX()+1, p.getY());  // Move the point +1 on the x-axis.
    }

Something you might be thinking is, why on earth are we making an object every time we move the Point over by +1 on the x-axis?  Immutability is the reason!  We can’t change the x coordinate of the Point that p references so the only way we can move the Point that p references is by creating a new Point and referencing that Point.  This is unfortunate because everytime we do this we need to create a new Point object, the more we do this the more memory we will use.  Fortunately it is the case that most object oriented programmers would not take the route of immutability here and simply add a setter to allow modification of the coordinates of a Point.

Functional Languages demand Immutability

Functional languages are not as flexible as object oriented languages however, meaning that you cannot just go in and modify an object since immutability is baseline.  How do functional languages deal with the memory inefficiencies of creating so many objects?  Take for instance the following clojure(lisp) code:

    (def myList (list (range 1000000))) // Set myList to be a list of numbers from 0 to 999999.
    (print (rest myList)) // Print all but the first element in myList.

In the more interesting second line we are creating an anonymous list object by using the rest function and passing that returned value into the print function.  In order to do this the rest function would make a copy of all of the numbers from 1 to 999999, pack them into a list and return it.  This is exactly the type of inefficiencies we discussed above that using immutable objects brings about.

Functional language implementations have indeed thought this through though and to counteract it they use something called “Persistent Data Structures”.  Persistent data structures are data structures that keep track of modifications to itself, essentially a diffing mechanism for data structures.  Using the example above, the implementation of the language would essentially note that the argument passed into the print function is “myList without the first element”.  This save us from needing to copy the numbers from 1 to 999999 and passing that into print, instead we just remember that we are passing in “myList without the first element” which is much cheaper.  This type of behavior is implemented in functional languages such as Clojure, Ocaml, and Haskell.

Conclusion

Immutability is a good thing, use it when you can.  I have also shredded one of the fallacies I had about programming in a functional language which is that I would be creating so many objects everytime I make a function call that memory usage would be too high.  It is probably a good idea to do a bit of reading on some of the implementation details of various languages before making any such assumptions.

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

One-Time Program Servers

Created a video presentation for my graduate course at North Carolina State University, CSC574 “Introduction to Computer and Network Security”.  The paper of choice was “One-Time Programs” by Goldwasser, Kalai, and Rothblum.  This video describes at a high level what one-time programs are, the concept of their creation, applications, and insight to the benefits and drawbacks of using them.

An idea I use the term “One-Time Program Servers” for is also presented at a high level describing a method for abstracting away the hardware component from developers and users of one-time programs.  The aim of one-time program servers is to make the transition for creating and using one-time programs seamless.

Download the video presentation

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

Enter the MacBook

I bought the top end MacBook today, I’m going to continue exploring on it now.

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

QuickMark 2 Released

If you are a World of Warcraft player, QuickMark allows you to set the raid target icon of units quickly rather than having to go through the right-click menu or create keybindings.  I have released version 2 of QuickMark which complies with the World of Warcraft 3.0.2 API.  This addon was submitted to curse-gaming only to find out that it needs approval now, it appears their policy of just letting people submit has changed.  Pretty disappointing after working on it until 7 in the morning.  I hope it gets approved but if not I won’t fret, the original reason for this addon was for my personal use, I just thought I would share.

Changes made in this version are using the new 3.0.2 API and also rewriting the user interface to be human readable and slimmer to give more screen real estate to the players.  I have provided a link for anyone who would like to download this addon but does not want to wait for it to get approved(or not) at curse-gaming.

QuickMark 2 for World of Warcraft 3.0.2

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

BlizzCon Day 1 + 2

Day 1 of BlizzCon was pretty exciting. First we went to the opening ceremony where Mike Morhaime mentioned the new playable class for Diablo III, the Wizard. I was genuinely expecting a big announcement of some type as per usual at all Blizzard events but none was given, somewhat of a disappointment.

Throughout the day we attended most of the main panels such as World of Warcraft Class Discussion, Starcraft II Gameplay, Diablo III Gameplay, and the BlizzCon contests. StarCraft II was announced to be released as a trilogy with the Terran campaign being released first, the crowd went wild.

Notable were the BlizzCon contests, Jay Mohr was very entertaining as the host of the events. I feel that given the superior number of people this year compared to the year before at BlizzCon 2007, the contest submissions as a whole were not as well done. Another thing that irks me is the fact that they did not at all show any of the content for the original song, machinima, and motivational poster contests. This was also unusual since we were not at all running short on time. I suppose that they had probably come up with a plan that expected us to take more time than we did and were not prepared to show any of the submissions for the other contests.

During Day 2 of BlizzCon we went to the World of Warcraft PvP and World of Warcraft Dungeons and Raids panels. After these panels we gave up our front row seats and went to the store to pick up our BlizzCon swag and then headed over to watch the Starcraft finals. Following the Starcraft finals was a Starcraft II exhibition match between Yellow(a Starcraft player) and a Warcraft III player. Yellow really showed his micro-management skills during this match up and needless to say, he won against the Warcraft III player.

We then went to attempt to get seats for the closing ceremony about half an hour before it was starting and we ended up sitting on the floor. There was a stand-up comedy session by Kyle and Patton which was sub-par compared to Jay Mohr’s hosting entertainment. After that was a concert by Level 80 Elite Tauren Chieftain which was quite loud but entertaining. Then came the Video Games Live session where an orchestra played various pieces of music from the Blizzard games. There was a special appearance by the Blind Pianist who played Mario Brothers blind which was quite exciting, they had him play a Warcraft II piece.

Overall I felt this year’s BlizzCon was not as exciting as last year’s but that I suspect is due to BlizzCon 2007 being my first. The content of this year’s BlizzCon was excellent, a lot of new content was shown to the attendees from Starcraft II, Diablo III, and Wrath of the Lich King. Aside from having no big announcement this year, BlizzCon rocked.

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

BlizzCon Day 0

Just went to pick up the BlizzCon swag for the guys and myself where they ended up giving me a box to walk out with. Got some dirty looks from some people thinking I was one of the evil ebay profiteers, not a good feeling. Looking at the program it appears that they will indeed have Diablo III playable at BlizzCon. Some of the notable items in the “goodie bag” are Starcraft wrist guards, Diablo III mints, World of Warcraft TCG Starter Deck, Blizzard Authenticator, and a packet of tissues with “QQ n00b” printed on the back(got a real kick out of that one).

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

Death and the Future

Have you ever wondered about how you feel living through what seems like a television screen? Think about it, day to day you are living through the eyes of the person which is you and some day you will die. Does the T.V. stop it’s broadcast and you no longer see through your eyes but instead live in eternal darkness? More importantly do you or have you live/d in some other life form after you die? And if that is so, what or who do you live as and would you remember that you once lived as the person you are today? Pondering over that last question I might question that I have lived before and if I admit that I believe people have souls then I would say that I would remember that I have lived as who I am today if I were to live in someone or something else. But seeing that I might live as something else would I have the capacity to remember or even think about what I am thinking about today? That then leads me to ask myself, is this my first “life” or have I lived before and souls simply don’t exist and when death comes your soul is vanquished?

Death is a very interesting topic to dicuss I feel and more particularly about the universe and it’s unavoidable end as scientists claim. Today as I write this I continually question myself if my life is for anything because I am going to die eventually, is my benefit to society anything if they are going to die eventually because of the universe and it’s ending? When the universe ends it won’t leave any trace of the fact that humans and the earth once existed and all will come to an end. All the discoveries and inventions we have made; Columbus and the discovery of America, Newton’s laws of gravity, Knowledge of genetics, Ability to transfer human organs, Computer technology, Automobiles, and many others. We also must not forget all the struggles we have had with establishing human rights, from slavery to establishing a sense of freedom where people don’t have to worry about being whipped or continuously owing their slaver owner money. All the progress that we have made as human beings from the beginning with the first cavemen and to the future advanced human that many of us reading this will never live to see will be wiped out and all of our history will be no more. The thought of this makes me question myself of what reason I have for living. What I have concluded is that we as humans live for the current day and time and do all we can, we don’t live for what is going to be in the distant future. In the future many generations later there will be one which has to come to endure the terminal condition of the end of the universe, science will be far more advanced and be able to predict to the day or even more precisely when the universe will end. But after you think about the issue of science, that is the key to which we will prevent the end of the universe, that is the reason why we as a society live, to continue. In the future, we will have advanced so much from previous generations of which as I talk today are still the future generations that our knowledge of science may allow us to prevent the universe from ending! That is an exciting thought, but is it possible? Only time will tell, cavemen in the past would have never imagined what we could achieve by the year 2004, are we as humans that live in the time of today anyone to say that we won’t advance our knowledge of science far enough to prevent the end of the universe by the year 21004? Assumptions we have today about the future are not very evident of what the future will actually hold as the past has shown.

The belief in God also would allow for us a reason to live because even though the universe would end, God would provide for us an eternal heaven of which humans would still exist and flourish in. This is at least what believers think, but with their belief is what keeps them going from day to day. Believers in comparison with non-believers of God still live day to day because they live day to day believing that they will go to heaven when they die and that is their reason to live, they don’t actually know until they die if God exists which brings up another issue. I have always wondered about if people go to heaven when they die, I have thought of asking someone this question when I was young and naive but realized, they’re dead and I can’t ask. I certainly believe in a greater being, God, but I question myself about what he can do or will do. For all I know the world may come to an end due to a nuclear war. My best hopes however lie in the hands of the future generations to come, they determine the future we dream of.

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments

Sun’s Java Technology Products Archive

I happened to be looking for an older JDK today and stumbled upon http://java.sun.com/products/archive/ which is Sun’s product archive for Java related technologies.  This is probably one of the most convenient ways of allowing your users to download legacy builds of products that I have ever seen.  Everything nice and neat all in one page, awesome.

Share this post:
  • RSS
  • Digg
  • Reddit
  • Twitter

No Comments