Saturday, 11 February 2012

As a developer

I'm going to keep this post short, but I'd like to describe something I've noticed, about myself.

Every time I go to work, I feel good. I don't feel exactly motivated, but I feel like I can deal with whatever that comes my way. After about 4 or 5 non-consecutive hours of programming, my brain just isn't that good anymore. My coding standard degrades, and I take longer to understand things that would've been simpler earlier in the morning.

No doubt, I continue to work, as slow as my progress becomes. And then, at the end of the day, my brain feels white. In Mandarin I would say 一片空白. I'm not sure why this happens, but I think it's quite cool :) and at that point of time in the evening, I perfectly hate coding. 那时我就对coding反感.

Saturday, 4 February 2012

Entity Framework

With the beta version of Entity Framework 4.3 already in play, we can expect more fabulous things from Microsoft. If you haven't heard about Microsoft's Entity Framework, then it's probably alright. I sincerely mean it, even if you are a C# developer who manipulates objects controlled by the database.

The Entity Framework comes in three awesome flavours, namely Database-First, Model-First, and Code-First. I've never experimented with Model-First, but I've dabbled with the Database-First and Code-First types. Having said that, I wouldn't say I'm a pro at Entity Framework, because there are just so many things to consider when using the Entity Framework. A few of them would be...

  • Concurrency. There's just this evil exception known as the OptimisticConcurrencyException. Eat that, optimists.
  • Performance. Believe it or not, I've read that Entity Framework performance is far worse than running basic SQL queries. One can precompile his queries, and cache his results, but I'm nowhere near that level as of yet.
  • Flattening. This has less to do with EF, and more to do do with LINQ. Because we usually manipulate the results of Entity Framework using LINQ queries, problems can crop up when you're using Anonymous Types... Believe me, I've been there, and done that.

These are probably obstacles that a pro would never face. Having said that, let's have a quick run-through of the three awesome flavours of EF that Microsoft has to offer:

  • Database-First. As the name implies, you start off by defining your database schema and creating your respective tables using SQL Server. After that, you generate a .edmx file automatically using Visual Studio's Entity Data Model wizard.
  • Model-First. No database, no code (no guarantee either, because I have not tried this). You use the visual designer to define your models, with their respective properties, and the Framework helps you by generating the code and database.
  • Code-First. Write your own classes, create a DbContext class, and dump all your classes into it in the form of DbSets. When you first use your DbContext, EF automatically generates the database for you.

I must admit that the names can be a little confusing at first glance. Looking at it from another perspective, the equivalent of entity would probably be object. The three flavours only differ in the way you define these entities: whether you create them as database tables, draw them out using a given tool, or approach the code straight on. They all work, just that you will have more control on the approach in which you take.

Let's then approach LINQ. Take for example, you have a list of entities (equivalent of a table in a database) known as Employees. In code, you would probably approach it this way when you wish to retrieve a certain portion of them:
var selectedEmployees = from e in db.Employees

where e.Selected == true

select e;
The three most important keywords in a LINQ query would probably be from, where and select. Probably a little different from the usual SQL syntax, but that's how LINQ works (I think it was formatted this way because of how IntelliSense functions). There is another way to write LINQ queries though, and I find this way classier.
var selectedEmployees = db.Employees

.Select(e => e.Selected == true);
You would concur that it's classier, wouldn't you? ;) These expressions also allow you to access a wide variety of methods (e.g. .Where(), .SingleOrDefault(), etc.), and personally I think it looks neater!

Having said all that, I wouldn't say that EF is a fabulously beautiful concept. Old school SQL queries are, in my opinion, still good to use. There are some things that I dislike, though—one of which would be WCF Data Services being more accessible to EF. I mean, WCF is good and all, but why limit its functionality? I might not be right, but I have a hunch that this is Microsoft's way of pushing Entity Framework, to see that they achieve a remarkable ROI from the hard work they've put in for EF.

Anyway, good night to you. We are all human in the eyes of God (if there is a God), all entities from the perspective of a database, and all gold mines to Micro$oft.

Wednesday, 28 December 2011

Just rantin'

It is very sad that I do not get the French-speaking French, Canadians...

Of the very limited audience of my blog, majority are Singaporeans.
This is followed by a not-too-small proportion of Russians.

French-speaking people, Y U NO COME?!
On another note, 140% ...

Saturday, 24 December 2011


C'est l'ocassion pour le fete! Pardonnez-moi pour le francais mal. Je suis bete, je sais, si je veux les gens qui parlons francais a me comprendre. Mais, je vais essayer! Un publicite en francais, depuis un singapourien qui connais anglais et chinois tout la vie seulement.

Noel est presque, qu'est que vous fairez pour l'evenement? Moi, je ne sais pas. Meme si je suis catholique, je ne vraiment crois pas que le Dieu existe. A bien de moments, j'ai les pensees... pourquoi beaucoup de gens croyons dans lui? Personne ne le voit! Serieusement, je ne sais pas...

Peut-etre, apres beaucoup de annees, je vais comprendre. Que pensez-vous? Je vais comprendre dans l'avenir? Ou je toujours ne comprends pas? Ah... tout n'est pas importante. Le plus importante en courant, est pour moi a reussir. J'ai 19 ans seulement. Il y a un longue route avant moi.

Dire-moi "meilleurs voeux". Je dois vous remercie pour lire mon francais mal. Et, peut-etre, vous pouvez correcter-moi dans le grammaire (je suis tres faible dans ca!). En tard, humain.

Sunday, 11 December 2011

Giving everything you've got

Running a marathon is no simple task. I remember running my first marathon a year ago, with a close friend of mine. It was hard, daunting, strenuous. If you're a fit guy, you'd think that running a marathon is simply maintaining a steady pace across 42km. It is quite true, but then again it's not all.

The both of us went into the marathon hardly prepared. The furthest distance I'd run to prepare for the race was probably about 5km or so, not even an eighth of the entire race. Then, the first few kilometres breezed by. It felt so good running past people, just letting our legs fly in the cool morning wind. I felt great.

As time passed by, however, aches started kicking in. Practically every part of my body ached at least once—my thighs, my calves, my abs, my shoulders... not my neck muscles though. At some point of time it felt like I couldn't go on. I'm sure I couldn't have went on if I didn't have company. You know, I was relying on this... spirit bond (no reference to DotA's Syllabear) with my friend—if he could make it, I could; if he couldn't, I couldn't.

To me, a marathon is a test of both a person's physical and mental endurance. One year down the road, I'm pretty sure that I can't run a marathon. First of all, my stamina took a dip for the worse (and is still dipping, I guess). And then, I'm also not motivated to run a marathon.

I wouldn't advise anyone to run a marathon if he just wants to do it for the accomplishment—the pride, the sense of achievement, the medal, and the finisher tee. It's because, at the end of the marathon, you actually start questioning yourself: who, really, is impressed by your run? What's changed after fighting so hard? I don't know. For me, it leaves me all dull and gloomy... I'd advise you to run a marathon only if you want to run it, if you have a desire for it, be it for friends, or... yourself.

Friday, 9 December 2011

Thoughts on IT

I went for my first interview yesterday. It was with Microsoft.

OK, I wouldn't say it's really my first, because I've had interviews before this. None of them, however, was about a complete evaluation of me—in other words, those interviews were nothing more than formalities. In this case, however, I had my qualifications looked at, I was observed, interrogated, and came out thoroughly disheartened.

It was an interview for an internship position, anyway. A position that went along the lines of developing proof-of-concepts for both aZaaS and Microsoft (in other words, whatever that I was going to work on was a shared project between aZaaS and Microsoft).

My main flaw of the entire interview, was, perhaps, being a little too humble (on hindsight), and also not being able to show my drive and willingness to go the extra mile. To be honest, I'm not exactly the very self-motivated, passionate-about-IT kind of student. I'm more of the, "I know you know I'm good", "We'll see with time" kind of person. I don't know. It's probably got to do with my personality rather than anything else.

Knowledge-wise, I believe I portrayed myself as a person who has a sound knowledge of whatever I've studied before. On the other hand, one of the interviewers' (there were two: a male and a female) questions stumped me. "What do you look forward to when you wake up every morning?" God, hath you forsaken me? I know not the answer to this question!

The male interviewer was the one who spoke the most, and he mentioned that he was working as a janitor. Someone who cleans stuff, stacks up chair... yeah, a janitor being an interviewer?! My frigging ass! I could only look at him in disbelief, thinking about what he could really mean. I think I must have looked really dumb there... So the interview gradually developed into a casual conversation that went along the lines of this... I can't remember the interview word for word, but, here goes:

He: So what do you look forward to when you wake up every morning?
Me: *speechless for awhile* Um, I think I'll need some time to think about it.
He: *smiles* By some time do you mean a few minutes, or a few years?
(I never came up with the answer in the end. Later...)
He: What do you know about ASP.NET?
Me: *ramble about GET, POST, Toolbox stuff, and Entity Framework* I used the database-first approach (referring to Entity Framework).
He: So what's the advantage of using the database-first approach?Me: Erm, I wouldn't say that there's really an advantage of a database-first approach, it's just the one I used when I developed it for the assignment. In the code-first approach, you write the classes first, but in the database-first approach you make the tables first. I guess the only difference is that you have control of the one you start doing first.
He: You know, during the first 5 minutes of the interview, you came across as a bo-chap person. But right now you show that you actually have knowledge of what you're doing.
Me: *feel proud inside*
He: What's stopping you from just going out there and making it big?
Me: Well, I don't really feel like I can make anything tangible. You know, when I was in secondary school, I picked up this book on C++; I'm not too sure whether C# was around at that time.
He: Yes, it was. I'm 10 years older than you.
Me: Oh, OK. Erm... yeah, and anyway, I learnt how to like assign an integer and stuff, but I never saw how I could make something tangible. I mean, even in school, we do assignments and make something out of it, but I never see any of them go into the market.
He: *something alone the lines of But you've never really tried, have you? How would you know?*

So yeah, it went something along the lines of that. I don't think I impressed either of them at the very least, but at the end of the day I hope I get the job! It might really be the "play hard-to-get" kind of thing that people in relationships do, just to tease us internship interviewees, but... I don't know! To cut it short, it was a very unnerving experience. At the same time, it was eye-opening; I learnt a lot from it.

On the other hand, my friend (who went in before me) portrayed himself as a true blue leader, a person who is very motivated and driven, willing to learn... But the questions the male interviewer posed (once again) shook him. Questions such as "what is the difference between mutable and transmutable?""what is an interface?", and "what is the fundamental difference between C# and Java?" I could probably talk some crap about the first two questions, but maybe not so for the third. I guess, I'm not really experienced at Java.

Overall, I'm glad that I came across naturally, and I tried my first real interview with who I really am; I did not, in any way, try to portray a false persona! this is one thing I'm really happy about. On the other hand, I have no idea if I'd get the job... oh well! Good luck to me.

Monday, 14 November 2011

Sonic Generations

I know it's been about two weeks or so already since Sonic Generations got released on PS3, Xbox, NDS, and PC... but, hey! I haven't gotten my copy of Sonic Generations yet.

Now, with all the spiffy game releases at the moment, Sonic Generations is probably the last thing on the mind of most gamers. For me, however, I played Sonic platformers way back when I was a young little kid. And I really loved those times as a kid—the little hedgehog leaping around, landing on Badniks, and whizzing away in an a blue ball of awesomeness! That, was childhood.

I wouldn't call myself a die-hard Sonic fan, because honestly, after Sonic graduated from the 2D platform, it just didn't cut it anymore. I remember when I was playing Sonic 3D Blast—sure, the controls were hard, maneuvering was not simple task—at the end of the day, I made it though. Then came Sonic Adventure DX, which wasn't really all a bundle of fun, but seeing the cool hedgehog getting the better out of everyone else was quite satisfying anyway...

Then there was Sonic Riders, and honestly, I really don't like this game, as much of a Sonic fan I am. It doesn't give me the thrill of a racing game, and neither is it satisfying in any way. It just didn't appeal to me in any way.

But hey! I've never really given up on Sonic. I still remain a Sonic fanboy deep within me. If any one of you out there actually played Sonic the Hedgehog 3, you'd probably remember this...

Yeah... that's the Sonic fanboy I am, remembering the little funny things that I really enjoyed as a kid... ;) I'm so looking forward to giving Sonic Generations a go!

Oh, if you haven't checked out OCRemix, do give them a go. Click here to pay them a visit. Basically, they give game soundtracks their own remixed renditions... with all the funk and iffiness to go. It's pretty cool; I mean, just listen to the following track, and you'd understand what I mean.

I'm so looking forward to giving Sonic Generations a go!