Archive
What Certificates Do You Have?
Just like many of us do, I sometimes clean up my email inbox. I usually open my spam folder to see which email got designated as spam, and to check whether it is truly a spam or not. This week when I open my spam folder, I got an interesting email: an offer for scrum certification. What got me interested is that they properly use my name in the salutation, and so I open up the email.
For the uninitiated, scrum is one of the methodology framework used in software development. In a simpler terms, it’s the process (workflow, if you will) being followed to be able to develop a software (or an app). It is also categorised as one of the agile methods for developing a software. Bear in mind the term agile does not necessarily mean your project will finish faster than you would have planned.
The email that I got was for a workshop that allows me to learn about scrum and become a Certified Scrum Master. Of course it goes without saying it also listed all of the benefits of using scrum during the development, as well as giving me 14 PDUs (apparently it stands for Professional Development Unit, whatever that means), and finally the pricing (which they obviously put in the last two paragraphs) with early bird offer.
Now personally, I’m not a big fan of certifications, and surely, not a big fan to include titles after my name. Even when I was about to get married, I had an argument with my parents due to them wanting to use my academic degree on my wedding invitation. In my opinion, putting titles and certifications in your name makes you look like you’re desperate for being recognised.
Don’t get me wrong, though, certifications have their own benefits. It proves that you are capable of doing what you claim to be in your respective fields (and apparently have the money to pay for the course and exams). What it doesn’t prove, is whether you have the aptitude to actually finish it or not. I have met one of these so-called “certified” person who didn’t even know what an array is and is actually struggling when I tried to explain to him. Again, for the uninitiated, the concept of array is a very, very basic one in software development.
Now granted, that person might just had the wrong certification in place, but it proves one thing: certification doesn’t tell you will be able to finish the job, it only tells you that you are capable of doing the job. Let me put it in another way (as has been suggested by one of my friends): the capable one won’t necessarily finish the job, it’s the one who finishes the job that is capable.
Certification also doesn’t prove you have the years of experience of actually doing it. There are some certifications that require you to have years of experience in your belt before being allowed to take it, but the others are simply: pay the course fee, study the materials, attend the workshop, pass the examination, and finally get your certification. Rinse and repeat. In fact, the scrum master certification, although recognised by the Scrum Alliance (I didn’t even know there is one, or that we need one), takes roughly 2 – 3 days. That’s all the time you need to become a scrum “master”. Yeah, right.
I myself have a Cisco CCNA 1 certification from a few years ago. Obviously the knowledge I’ve gained during the course (which was incorporated to my college studies) is far more important than the certification itself. But if I had to do a complicated network setup, I would be asking help from one of my friends who is actually good at networking stuffs.
Certifications are good in the sense that the knowledge that you gained will be helpful for you in the long run, and it is true. But the reality is, most people want the certificate and the ability to put the title in their name, not the knowledge gained through it. That’s the bitter, sad truth.
jovee~
EF 4.1 Code-first: Executing Stored Procedure
Since I worked in my company, I was required to learn a lot of stuffs. One of the basic things to learn was to adapt from my mostly used Java programming language to C#, along with the proper MVC platform.
Of course, .NET MVC, being a platform (for vocabulary nazis, I use the term architecture and platform interchangeably), it is obviously tightly integrated. This was the thing that I dislike the most with the .NET framework, you can’t have full control (to some extent) as to what you do. And then my opinion suddenly changed when I was introduced to entity framework, namely, their code-first approach. Code-first approach gives you that flexibility to meld the code behind as you like, it gives you full control (again, to some extent) of what you can do.
My post today will show you how to simply execute a stored procedure and retrieve the results back. This is supposed to be simple if you were using database-first or model-first approach. Otherwise, Entity Framework 4.1 does not support a complex type mapping for stored procedure in code-first approach (at least for now). See this post for more information on that fact.
/// <summary>
/// Function to call the stored procedure in the database.
/// </summary>
/// <param name="param1">A string containing the username.</param>
/// <param name="param2">A string containing the password.</param>
public Guid CallProc(string param1, string param2)
{
// Creating SqlParameters
// Note that although SqlParameterCollection class exists,
// it cannot be instantiated since it is an abstract class
var userName = new SqlParameter
{
DbType = DbType.String,
ParameterName = "UserName",
Value = param1
};
var password = new SqlParameter
{
DbType = DbType.String,
ParameterName = "Password",
Value = param2
};
// This is the "correct" query that will return an entity object.
// However since EF4.1 does not support a complex type mapping FOR
// stored procedures, this is rendered unusable (for now).
// return DbContext.Database.SqlQuery("FindUser @UserName, @Password",
// parameters).ToList();
// Returning the user ID (as Guid)
Guid userId = DbContext.Database.SqlQuery("EXEC FindUser @UserName, @Password",
param1, param2).SingleOrDefault();
return userId;
}
I have highlighted some of the important points in the code. Now, let’s start dissecting the code.
On line 6, this is your usual standard function in C#. Nothing special here, just a function taking two parameters and returning a Guid result. Please note that the function name does not have to be the same as the stored procedure name.
On line 13-15, we need to create SqlParameter, in order for the framework to translate the call to the correct data types. This also prevents SQL injection, and is actually a good practice. Like I have stated in the code, we can actually create SqlParameterCollection if we want to. For simplicity sake (and greater flexibility), we’ll just use the SqlParameter class.
The SqlParameter can take any supported data type. In the example, we used string, but we can also use Guid and other primitive data types. I have yet to use objects, however, I would have to assume that it is not supported.
On line 28-29, I have put the proper way to call and execute the stored procedure from within Entity Framework. However, it is not yet supported. In this commented code, I actually used SqlParameterCollection variable, parameters.
On line 32-33, is the actual call made by the framework to the database. This will call a stored procedure called FindUser, passes on two parameters (UserName and Password, respectively), and will return a Guid as the ID of the user.
Of course, it goes without saying that the database must have a stored procedure called FindUser which accepts two parameters, UserName, and Password as string or varchar. The stored procedure must also return Guid as a result. I have yet to use another data type, but in this case (using Guid as a return type) works.
So there you go. I admit this solution might not be the best solution, however it works for now. At least it solves the limitation of the EF 4.1 using the code-first approach. See you next post!
Impressions