Archive for the ‘Just Thoughts’ Category

Google is making us stupid

More often than not, when confronted with a problem, software developers rush to www.google.com, and start searching for samples and ready-to-use pieces of code.  The actual documentation of the language / framework / tool / whatever is often left untouched.  Google’s highly efficient search engine is really good in finding the best answer, much more relevant than the results of the built-in searching facilities of the documentation in question.  Plus, it reveals others’ experience.

As good as it gets, using Google too much has a dark side.  Developers often come to the point when they implement solutions with technologies they do not understand.  They are not troubled by the fact that they use code, written by someone else, and which they don’t understand.  If they run into a trouble with the sample solution they found, they will go to various forums to find a fix.  An old joke about how to write an algorithm to find a lion in the desert and lock it in a cage had it for Delphi that Delphi developers would go to all known forums and post “Does anyone have a component which finds a lion in the desert and locks it in a cage?”.  Well, I am sorry to inform you, smart Delph-haters out there, that is no longer a Delphi-thing only.  You all fell into the trap.

To be honest, that particular approach works quite often, and it works well.  Why am I making fuss about it, then?  Development goes with good speed, results are often nice.  Until the moment when Google doesn’t give an answer.  Or, to be presice, its answer is incomprehensible, because the developer has no understanding of the technologies involves whatsoever. 

The ease with which solutions are found in Google takes away the incentive to get into real understanding of how things actually work.  As a result, junior developers stay junior, and never learn basics which will take them to a higher level of skills.

That is the reason why I am no longer eager to give code samples.  People would never read them, just copy & paste it and even ask specific questions how to integrate them into their own code. I prefer explaining things, and give out only snippets of important code.  Who claims to be a developer should be capable of figuring the rest by oneself.

Posted by Nik on August 24th, 2009 No Comments

Coding Horrors: MySQL, Dates and Times

An excerpt from MySQL Reference Manual:

Illegal DATETIME, DATE, or TIMESTAMP values are converted to the “zero” value of the appropriate type (’0000-00-00 00:00:00′ or ‘0000-00-00′).

What the fuck.  Really, come on.  The purpose of a database is to store valid and integral data.  Again.  Valid.  And.  Integral.  Data.  It is valid, integral and meaningful that counts.  Not just any rubbish.  If I want rubbish, I can just read back random bytes from the harddisk.  If someone tries to write crap into a database, which the database cannot handle, the database must refuse the operation, and give error. 

Really, I wonder what the hell designers of MySQL were thinking when they implemented this specific feature.  Pardon me, the word “feature” is not appropriate.  The correct word would be “disaster”.  It is a disaster indeed, because it silently causes data loss.  One might argue that it is developers’ responsibility to validate their data, and make sure they provide the database with valid input.  While this is definitely true, it is no excuse for the database to accept graciously any garbage, and on top of that convert it to something which has nothing to do with what it is supposed to be.  That is a major fail in design, and major fail to achieve a primary goal.

The behavior above is true for MySQL versions from 4.1 to 6.0.

This little story only proves that MySQL is only good as a backend for small and simple websites.  If you mean serious business, please reconsider.  There are a bunch of free databases out there, all of them much, much better and more mature.  Some of them even open source.

And yes, I know there is a general setting in MySQL 5.02 and greater to make it give errors.  And yes, I don’t think it makes the fail lesser.

Posted by Nik on May 27th, 2009 2 Comments

Rant: Moving Targets

A trip back in time.  In 2000 we were starting a large project.  The architecture was pretty standard stuff – database server, application server with business objects, semi-thin desktop client, featuring bi-directional communication between the clients and the server.  All were Windows native applications.  During the design phase the question about the inter-tier communication technology came up.  Back then, Windows DNA1 was the super-dee-duper stuff out there, praised by Microsoft as the prime guide to making distributed applications.  We decided to follow its wisdom, and built the communication layer on top of Distributed COM and COM+.  Oh, why, why?

(more…)

Posted by Nik on May 25th, 2009 No Comments

Coding Horrors: C++ and Overloaded Methods

My tough feelings for C++ as a language are all but new.  Here is another example why this language is not suited for children, and young students should not take C++ as their first programming language, unless they are really smart and have solid common sense to protect them from the bad influence of this language.

Consider the following code:

Nothing special, right?  It looks absolutely logical that the call to myFunction in main() would invoke void myFunction(String, String, bool = false).  Well, it won’t.  The function that will get called is void myFunction(String, bool = false).

Well, I must admit that I myself would not figure out easily.  Further reading revealed the explanation - the compiler is using the more cost-efficient conversion of char * to bool, rather than creating a new instance of class String.  Further reading proved that the behaviour of the compiler is strictly according to the C++ Standards!

Feel free to call me any names you can think of, but for me the authors of C++ Standards live in a parallel, sick universe.  Guys, have you heard that code has to be readable, too?

P.S. Edit: fixing typos.

Posted by Nik on April 9th, 2009 No Comments

Coding Horrors: PHP’s strpos()

I decided to start a column where I will point my finger at repulsive coding and software engineering cases, which happened to be released to the unsuspecting public too hastily and / or without good thinking.  Someone will say it’s easy to criticize.  I don’t care.  Someone has to tell the plain facts and the sooner we raise our voices, and the louder, the better.  Demand for programmers has spawned numberless hordes of dim-witted script-scribblers, who claim themselves programmers, and who spill out hideous crap to the innocent audience out there.

The choice for my first rant is PHP’s function strpos().  Actually, PHP itself deserves a scorching rant, and maybe I will come to it eventually.  Right now, I will only focus on this specific function.

But what’s wrong with strpos()?  It is a simple routine, available in a basic library for virtually any language out there.  It merely checks the occurrence of a substring in a string.  And so it does.  Except for this very peculiar unique behavior, stated in the official documentation:

Returns the position as an integer. If needle is not found, strpos() will return boolean FALSE.

If you know that strings in PHP are zero-based and the frivolous nature of PHP when it comes to type-safety you will be already on your toes.  It is a realm for unspeakable bugs out there.  The warning in the official documentation, and the vast number of user comments in the official documentation page are a living proof of the disaster.  Please read these notes, really.  They would be hilarious, if the fact that something like this made it to the broad audience weren’t so sad.

I really wonder why the hell a simple function like this should possibly return values in more than one type, and for no apparent reason.  Just tell me the added value, please! 

Sadder, no one ever bothered to fix this ill behavior.  Yeah, I know compatibility will suffer.  And compatibility is important.  But when you have something that broken, hell, deprecate it!  State clearly that there is a replacement, and that this freak should no longer be used!  Instead, PHP guys got themselves busy with implementing half-assed OOP features in the language, and useless exception support.  Maybe I should just say “Go, Open Source!”.

Posted by Nik on December 23rd, 2008 2 Comments

Meeting of Plovdiv .NET UG Scheduled

The first self-organized meeting of the Plovdiv NET User Group will be held on Tuesday, 25th November 2008, starting at 18:30.  The meeting will take place at the Faculty of Mathematics and Informatics of the Plovdiv University.

If you have any questions, just contact me.

Looking forward to meet you there!

Posted by Nik on November 17th, 2008 2 Comments

Plovdiv .NET User Group

It’s been quiet for a while here.  Busy with lots of things both at the office and at home, I found no time to post something worthy.

The news is that I will become in charge for organizing the Plovdiv .NET User Group.  The first meeting is due in November, the date will be set in a week or so.  The first meeting with open with a lecture on C# 3.0 by Stilgar.

I will post the date and time of the meeting immediately when set in stone, so stay tuned!

Posted by Nik on October 27th, 2008 1 Comment

Delphi 2009 Tiburon - Why?

CodeGear published recently two video previews about the upcoming Delphi 2009, a.k.a. Tiburon:

http://video.codegear.com/Tiburon/WhatsNewInTheVCL_English/WhatsNewInTheVCL_English.html

http://video.codegear.com/Tiburon/WhatsNewInTheDelphiIDE_English/WhatsNewInTheDelphiIDE.htm

Both videos are hosted by David I.  He sounds really cheerful and enthusiastic about the value Tiburon is going to bring Win32 developers.  I already ranted about the unfortunate attempts of Delphi to emprace NET Framework, and now I was somewhat optimisic that Tiburon is focused on Win32.  First video is about the enhancements in VCL, and the other - about the IDE.

The two videos brought huge disappointment to me. 

(more…)

Posted by Nik on August 17th, 2008 No Comments

A New IDE for Delphi

I just came accross Visual Studio Shell.  This is a very interesting framework for creating development IDEs.

All versions of Borland Delphi starting with 2005, a.k.a 8, feature a really bad IDE.  Really bad.  Slow and buggy.  I already ranted about the fact that Borland decided to catch up with the interface and layout of Visual Studio, than simply evolve the features of their already good IDE.  Since Delphi 7 Borland gave us all a good proof that they cannot create a decent IDE anymore.  Both Visual Studio and Eclipse surpass it by miles.

Well, here is my idea.  Embarcadero, why don’t you just build up your IDE around Visual Studio Shell?

Posted by Nik on July 29th, 2008 1 Comment

“Sad But True”

“Hey I’m your life
I’m the one who takes you there
Hey I’m your life
I’m the one who cares
They, They betray
I’m your only true friend now
They, They’ll betray
I’m forever there”

Metallica’s gig in Sofia, 25th August 2008.  Nine years later, Metallica did a great show again.  This time, the stage was a bit better, with more lights and effects.  The sound was very well done again.  These guys are getting older, but they still have it.  They played old-school stuff to the great joy of about 50,000 fans of all ages.

In constract to the concert in Plovdiv back in 1998, this time the band was well prepared.  “Its great to see you again” this time was well in place, and James Hetfield knew well that was their second visit after nine years.

The show was great. Thank you.

Posted by Nik on July 28th, 2008 No Comments