Motivation

Motivation is the fuel for your creative engine, so that you can reach your goals. Intelligence and creativity matters little if you are not motivated enough to use these gifts. Actually, some people argue that motivation is the root of being smart or creative.

However, not all motivation are the same. Being a Computer Science or Information Technology student, the rewards matter a lot. In fact, as the video below demonstrates, carrots and sticks (the traditional “more work == more reward” paradigm) have the opposite effect on tasks that require the algorithmic approach.

According to studies performed by world-class economists from M.I.T. & Carnegie Mellon: For simple, straight-forward tasks, the traditional “do this == get this” paradigm offers enough motivation. But for more complicated tasks that requires conceptual or creative thinking (eg. programming or information analysis), the traditional motivators does NOT work.

If this is true, then what drives us? Autonomy & Mastery

Autonomy is the desire to be self-directed. This is why programmers tend to clash with the management the most- because we are innovators, risk-takers, explorers, and most importantly: Scientists. We boldly go where no man has gone before.

Mastery is the urge to get better at stuff. The best musicians in the world play music for fun. Not for cash, not for fame. Just because its fun. Programming is the same- we want to be better programmers because we enjoy programming, and being better at it is immensely satisfying.hubble10-hp[1]

Look at Google’s Innovation Time Off: Engineers are encouraged to spend one day of their week to work on projects that interest them. The engineers decide (autonomy) to work on interesting projects (mastery). And from this model, a lot world class services emerged: GMail, Google News, Orkut, even Google’s primary revenue source: AdSense. Now THAT is how you motivate programmers.

Teaching Starcraft 2

Sometimes, we need to take a break. Enough programming, enough study, and just relax. But that doesn’t mean we can’t learn anything while relaxing :D StarCraft II: Wings of Liberty is a military science fiction real-time strategy video game currently under development by Blizzard Entertainment as a sequel to the award-winning 1998 video game StarCraft.

I am, and always have been, a Zerg player (“sspawn more overlordss”), and today’s little video will teach you some of the basics on playing starcraft 2, specifically a tactical play known as “Seven Pool” as well as some of the terms used in-game.

Btw, turn on the annotations ^^ So, a bit of a primer about the terms used in SC2:

  1. X unit/building – This means that when you get to population X, build the unit or building eg. 7 Pool (build a spawning pool at 7 pop.) or 12 Rax (build a Barracks at 12 pop.)
  2. Micro – Shorthand for ‘Micromanagement’, or selecting unit(s) and giving individual commands on each. This ranges from normal (Stalker blink, Zergling surround, Reaper evasion) to extreme (getting 3 harvesters on each resource)
  3. Macro – Shorthand for “Macromanagement”. To most players, ‘macro-ing’ means getting the most resources out of multiple bases ex. Getting an early expansion is a Macro move, or ensuring that each of your bases are saturated with just-enough harvesters.
  4. Tech, or Teching – Means getting upgrades, normally to get a certain unit eg. Teching to Hydras means getting gas and lair.

Ok, to recap, Zerg 7 Pool goes like this:

  • Game starts with 6/10 Population
  • 6 Drone
  • 7 Pool
  • 6 Queen (I made Lord+Drone here instead.. my mistake)
  • 8 Gas (Didn’t have to do this since I have an extra Lord)
  • 7,8,9 Lings
  • Attack
  • Profit!

I didn’t really follow the optimal build for 7 pool, and my micro needs more work. But you get the general idea~! :P This works great vs Terran or Protoss, but not against zerg since there’s normally an early Queen (on most builds) which can delay your lings enough for them to recover.

So, I guess that’s it~ I’m planning to create a new blog where we’ll post our ramblings w/ Starcraft 2, and yes, I said we. Guess who’s with me on this one? ^^ Until then, sayonara~

A look inside Letran: Teaching Programming Part 3/3

I totally agree with Jeff Jarvis’ points in the above video. Education today is a 19th century system struggling to cope in a 21st century world- it’s like using a steam engine to commute to work today. It has become apparent to me, that in Letran’s walls, teachers “stamp out students all the same way with only one right answer each… And so, that assumes that all the knowledge flows from the [lecturer], if you don’t feed it back, you’re wrong- you fail.” Its a system that kills the students drive to explore, to argue.

Inside the classrooms, discussions are always one sided- why would Letranites ask questions? Why would they argue? Not only is there zero incentive to do so, but I think arguing with the professor has been indirectly forbidden. How? Peer pressure can be a problem, or a teacher might have embarrassed someone asking a stupid question. Maybe the curriculum does not stimulate a students brain enough for them to ask any questions. In my opinion, more interaction is needed- we are training computer scientists here, and like the scientists of other fields they need to discuss and argue and experiment in order to challenge the norms and discover new things, eg. non-routine problem solving.

If you can compare side by side the curriculum of Letran (or even the other Universities in the Philippines) and MIT’s OpenCourseWare, Academic Earth, or even Youtube EDU, you’ll begin to see another problem. On all of the courses offered, their online equivalents are almost always better. Its more interactive, up to date and free. You can learn more online in a weeks worth of videos, than spending four years in a Philippine university.

As Jeff above said, the good stuff are already out there. We have to stop this culture, of standardized testing and standardized teaching.

PS. More good points from the video: Quizzes and Exams @8:46, Google did not spring from the lectern @10:45, We have to stop this culture… @12:30

C#4.0 & The Decorator Pattern

The decorator pattern can be used to make it possible to extend (decorate) the functionality of a certain object at runtime, independently of other instances of the same class, provided some groundwork is done at design time. (http://en.wikipedia.org/wiki/decorator_pattern)

Design Pattern: Decorator Patten
Pattern Type: Structural
First Stated in: Code Complete, Steve McConnell (1st Edition)
Description: Attach additional responsibilities to an object dynamically keeping the same interface. Decorators provide a flexible alternative to subclassing for extending functionality.

One of the features of C# 4.0 is the dynamic keyword. Basically used like the var keyword, a dynamic object defers type-checking until runtime. A simple example:

static void Main(string[] args)
{
dynamic pet;

pet = new dog();
Console.WriteLine(pet.kick());

pet = new cat();
Console.WriteLine(pet.kick());

pet = new lion();
Console.WriteLine(pet.kick());

Console.ReadKey();
}

class dog { public string kick() { return "ROWRrr!"; } }
class cat { public string kick() { return "MEOWRrr!"; } }
class lion { public string kick() { return "OmNomNom-"; } }

Make no mistake, that is still fundamentally C#, with all the static type-checking done in the background (mostly in runtime). Anyway, we can also use the dynamic keyword to implement the decorator pattern- which extends a function of a class.

class Program
{
class Zergling { public float cost() { return 1; } }
class BanelingMorph
{
dynamic zergling { get; private set; }
BanelingMorph(dynamic z) { zergling = z; }
float cost() { return zergling.cost() + 0.5f; }
}
class AdrenalGlands
{
dynamic zergling { get; private set; }
AdrenalGlands(dynamic z) { zergling = z; }
float cost() { return zergling.cost() + 0.7f; }
}
class MetabolicBoost
{
dynamic zergling { get; private set; }
MetabolicBoost(dynamic z) { zergling = z; }
float cost() { return zergling.cost() + 0.2f; }
}

static void Main(string[] args)
{
dynamic DevoursChildren = new Zergling();
DevoursChildren = new BanelingMorph(DevoursChildren);
DevoursChildren = new AdrenalGlands(DevoursChildren);
DevoursChildren = new MetabolicBoost(DevoursChildren);

Console.WriteLine(DevoursChildren.cost());
Console.ReadKey();
}
}

I'm doing this while alt-tabbing between Starcraft2 Beta, so forgive the old zergling hero cameo ^^; Anyway, Decorators work a lot like Object "Upgrades", in a sense that they can change the resulting object by modifying functionality. I guess that's done~ Until the next design pattern, Sayonara XD

Need Net? IMMORTALSURF20

ImmortaSurf-Promo

For only 20Php: Internet on your phone?! No Expiry?! Too good to be true, or is this total BS? IMMORTALSURF20 service review below~

Last May 6, 2010 Globe Telecoms Philippines announced a new IMMORTAL service called Immortal Surf 20. For only 20Php, you’ll have 1 hour’s worth of “data calls” aka internet connection, and just like the other Immortal services (Immortal Text & Immortal Call), it will not expire and consecutive uses will stack.

A few drawbacks though: 1) Not fast. Not too slow either though, but don’t expect to break 100kbit/s [Note: standard desktop DSL is 500 to 1mbit/s] 2) A maintaining balance of 5Php, not a big deal and 3) Minimum use of 1min- which means your usage is always rounded up to the next minute eg. 1min and 2sec data call = 2 min. Understandable, given the price of 20php :D

Now before you try the service out, make sure that your phone is properly configured first:

  1. Check if your phone has a web browser. If it does, I highly recommend going to Opera and get their browser- it will compensate for the slow internet speed.
  2. Set up myGlobe GPRS. This may vary from phone to phone, but for the tech savvy:
    • APN: www.globe.com.ph
    • Internet Mode: HTTP
    • Use Proxy: Yes
    • Proxy Address: 203.177.042.214
    • Proxy Port: 8080
  3. You’re all set, so just text IMMORTALSURF20 and send to 8888 [note: All caps, one word]. After a while, it will reply and you’ll have internet access!
  4. If you want to check your remaining data allowance, just text IMMORTALSURF STATUS and send to 8888.

Aside from the hassle of setting up your phone to receive GPRS, I’m finding the speed acceptable and the data connection is stable (so far). I like the service, not to mention that IMMORTALSURF extends the Internet to more Filipinos. Enjoy the mobile Internet~! ^^

PS: The promo pic above is photoshopped (by yours truly)~ Globe wouldn’t use a Windows Phone 7 in their ads.

A look inside Letran: Teaching Programming Part 2/3

“Institutional Education needs to do more than just adopt a few new tools.“ ~ Dan Brown (http://twitter.com/DBUniverse)

A few meetings went by, and I was getting the hang of speaking in front of the class. It was terrifying at first, but my fear was soon replaced by the thrill that my students are actually learning something. It was an awesome experience to watch the freshmen’s eyes light up as they discover the concepts and algorithms to solve the problems. Granted, the language should have been easier so that more than just the logically-inclined students can pass the laboratory exams, but aside from that- all of us are learning.

The midterm period passes without a hitch, but soon I find myself questioning (again) the methods that I use to teach the concepts at lecture. I noticed that more than half of my students are very unmotivated to learn. They’d rather focus on some of their minor subjects- Art App, Communication, and later, Physical Ed. I wondered why..?

Interaction.

The students craved interaction. They needed to interact and experience the facts (in our case, concepts & algorithms) in order to learn them effectively. They want to understand the concepts, not memorize what they mean. Just telling them to memorize what iterations mean is plain stupid- because that information is free, online. This is what they liked about the minor subjects: you don’t have to memorize anything, you just have to do it.

The video above by Dan Brown (not the author, mind you) nailed it: Education is not about facts- Its about empowering students to change the world for the better.

Specs (Both kinds)

Specifications (noun, plural)

1. A set of requirements defining an exact description of an object or a process.
2. In computer programming, a Design Pattern where business logic can be recombined by chaining the business logic together using Boolean logic.

Part of almost every development life cycle is the design stage. This is where you determine the requirements of the application, if its feasible, and if so: a) how to implement it and b) how to test if the implementation works. An analogy: If an application is a house, one of the first things to determine is the number of rooms & floors, which materials to use, etc. Specifications are the documents that is produced after the design stage, which is basically the blueprint of the house.

Many programmers skip the design stage, opting to code directly. Big Mistake. That’s like building a house without any documents: no blueprint, no materials manifest, etc. Sure, it might work but only after a lot of trial and error (basically, the failed apps becomes your documents). And even if it does work, who in their right minds would live in that house? Without specs, its hard to test if works or not.

The specifications design patter, on the other hand, is quite different. Sometimes, business logic objects can be “chained” together like so:

ISpecification CardsToPrint = Red.And(Even.Not()).And(Facecard); 
ISpecification CardsToPrint = Even.And(Red.Not()).Or(Facecard); 
ISpecification CardsToPrint = Facecard.Or(Even.Not());
Design Pattern: Specification Patten
Pattern Type: Behavioral
First Stated in: http://www.martinfowler.com/apsupp/spec.pdf
Description: Recombinable business logic in a boolean fashion

My sample app uses a standard deck cards, then uses the Specification pattern to specify which cards to print. Of course, one can easily substitute “Employees” or “Places” with the collection of cards. Feel free to experiment with the CardsToPrint variable: to check the results quicker, comment out the shuffle method.

Source Files (in C# 4.0): SpecificationsPatternExample_Source.zip

Specifications: A couple of important computer science topics that has the same name but different meanings~

The name's Zetta, and I'm gonna Overlord your faces off!

Try Twitter’s Embeddable Tweets~ Instead of posting a screenshot of your status update, go to http://media.twitter.com/blackbird-pie/ and paste the url of your tweet there then click ‘bake it’ to create a huge chunk of embed code. Result:


Pros:
• The Links are LIVE~!
• Twitter’s background is retained (which IS a part of your twitter identity, believe it or not. People recognize these~)

Cons:
• BIG Chunk of embed code.
• Timestamp not live :(

Anyway, love it or hate it- It nice to know that the twitter service is moving along and not stagnating (google buzz) or killing itself (facebook)

A look inside Letran: Teaching Programming Part 1/3

“Do what you do best and link to the rest” ~ Jeff Jarvis (http://www.buzzmachine.com/)

I am an educator. Once, I lived a life of teaching and evaluating, and it was a journey I would never forget. I still am.. but my year on Letran was very fun & very informative- and I’d like to share with you a summarized version of my short roller-coaster ride there. With videos =D

When it was confirmed that I’m going to teach Introduction to Programming (Fundamentals of Programming, for the non-Letranites out there) to the first year students, the first thing I did was to look for other lectures. I knew that someone, somewhere, there is a great professor teaching the same subject, and I was hoping he recorded it.

Watch it on Academic Earth

Prof. David J. Malan from Harvard University, is the star I decided to shoot for (The entire series can be watched on Academic Earth). At least if I failed, I’d land on the moon. But as I was teaching, I realized that Letran’s methods and Harvard’s are not the same. I asked myself, should I teach Python to this kids, considering that their next subject is C++? My co-teachers told me that the disconnect might hurt the students- and relying on their better judgment, I revised my plan and taught C instead.

In hindsight, I think I should have stood my ground. I should have pushed against teaching C, because the language is, fundamentally, a low-level language (just a step above assembly). It is primarily used for close-to-the-metal applications where performance is a priority. A 1st year professor shouldn’t care if the program takes 1 minute slower, coz as long as it runs, then the student understood the concept/algorithm. Teaching an easier language, something more like natural language (english-like) would make the freshmen understand stuff better. Python is perfectly good example of this, but there are languages actually designed for this, such as SmallBasic.

Another thing: If the students know C, then you start teaching them C++, then they might mix them up. They might accidentally use C-only syntax or a C library instead of the C++ counterpart. Would it help if they know some of syntax beforehand? Maybe. Would it hinder them? Maybe. In my opinion, it’s a 50-50 deal, gambling that C would help the students learn C++.

Why not just teach them something easier but still introduces the same concepts & algorithms?

App Idea: The Interface

I was reading Scott Westerfeld’s Bogus to Bubbly, a companion to his Uglies Series, yesterday, and I loved the reputation system he used in the fourth book, Extras. I wondered… what would happen if everyone who’s publishing in the internet had a face rank? If the awesome “layer” system is implemented over these feeds, and every individual has one.

The more I think about it, the more everything clicked into place. Everyone (almost) does have a feed in the web, but the problem is there’s no central repository of feeds. Facebook, Twitter, Blogs, Flickr, Picasa… all of these are feeds- and I think the solution is Google Buzz. You can connect everything to buzz and it will aggregate all your data into a single, personal feed.

Optionally, you can kick a feed item (yours or not) by adding some text (not less than 50 words, or else it will just become a comment) or some media (pics or video)  into it. This will become a Foreground layer (mentioned by Ren Machino in Extras) and if other people has also kicked the same feed item (determined by URL), then those will become the background layer (sorted by facerank, of course).

But how would you compute the Faceranks? Every time someone clicks anything from your feed (a link, a story, a comment, whatever), it counts towards your face rank. The feed clicks expire and after 3 days though, because news gets old (kicked story clicks expire after 7 days). Also, only the clicks from your first 50 feed items count, plus your first 50 kicked stories- this means you can’t just go crazy with your feed because it will push down the news with clicks, but you can’t stop posting when you’re at the top, because your famous stories will start expiring clicks.

And what better platform to deploy the app than on a mobile phone? (Until eyescreen technology becomes viable, at least)

10503-~-The-Interface

Internet + FaceRanks = The Interface. I wish I had the time to code this up :(

Windows Phone 7 (w/ Video)

I just received an email about the Windows Phone 7 Developer tools being available ‘immediately’ this morning, so I went through their site to find it. The email didn't contain the link to the download page, and I can’t find any direct downloads, so I was forced to get the web installer version here.

*after a few hours*

Here are my thoughts:

+ Teh Interwebz is enabled by default :D Woot~!
+ XNA/Silverlight views & C# models means that code can be easily reused/ported to Windows Phone 7
+ The default resources are included in the app.xaml including the textblock, font, button and slider styles.

• The Emulator was fast and snappy (after a long startup load) but will the apps run this fast on real hardware?

- NOT Silverlight 4, which means that there’s no ICommand interface. You can see the commonly used workaround on the video above.
- I forgot to show this on the vid, but I can’t multitask. When I click the back button (black arrow near the windows ‘start’ button) the current application exits.. maybe I’m doing something wrong?

All in all, I love it when a new platform comes out and I can use my existing knowledge to code apps there immediately~ :D