Sunday, March 30, 2008

C++ or Python

After playing with python and implemented it in a commercial product lately, i am quite happy with familiarity i have with the language now.

So the question is, will Python replace C++ in my new work? Unfortunately, i must say as long as i am in Windows, C++ is still one of the best language to use for shipping solid, tight and resource friendly code. I can't hire a team of C++ as easily as i can hire and train programmers in python and C#, the latter being a preference in Windows also.

So whats all these fuss of Python rocks etc?
Python does rocks, however one has to taken into consideration at the base level its still pretty much a bytecode interpreted language. C++ however gives you total power and its limited only by programmer's skill and knowledge.

In today's programming, one needs to be practical. If i need to hire good C++ programmers, it would take much effort and its nearly impossible to keep them. If their skills are amaturish we end up with a ton of bugs which needs time to debug and fix and like habits , some programmers takes a long time to fix their coding practice. This is where languages like C# and Python comes in, it makes forming a team fast, it lowers the penalty and possibility of bugs in programming (Python even enforces tabs and code readability to some extent).

Although there are success stories in Pyton, eg the bittorrrent, one must not forget the current popular bittorrent client is utorrrent, which i believe given the size, is probably written in C++. So how does a C++ product replace a Python product given that the Python product was already in the market lead?

I leave that question to you.

Wednesday, March 19, 2008

Cheap hacks

Yup, i dont like cheap hacks. I dont like the idea of parroting what the internet community proclaimed hackers has done and presenting it as though as one discover it.

Various security seminars held here in Malaysia consists of more than 90% security exploits that are nothing more that copy-cat / parrotting.

Most real exploits are discovered by real programmers, not hackers. Programmers who understand how the system works and why it would fail resulting in an exploit discovery, sometimes its discovered accidently.

The way some folks use the work "hack" you probably think these folks are hackers, in actual truth however, these folks are just wanna-be. Ask them to show you one original exploit that they discover themselves and you get a blank stare.

Do i hack? No, maybe just some games vs the computer which today are no longer needed due to built in cheat codes. Hacking should be reserved for breaking into security systems.

Just the other day i saw on CNN how some chinese teens contacted CNN and promised to reveal hacking information . While i pity the reporter since he has not much idea whats going on and seeing a "ping x.x.x.x" running in a cmd console seems to impart the "hacking" feel, i doubt those teens have anything solid. Later when CNN interview a guy from Verisign defense , he gently says something along the line of "i dont think those guys are in the echelon to do what they claimed... ". In reality many don't, many just want to project the cool impression that they hack, but they are just running some tools that they cut + paste from somewhere.

On that note :
http://www.rtm.net.my/streaming/login.php

Type ' OR ' , as the name and password, including the ' , and congratulations you just hacked RTM streaming. "Oh wow! new site hack, lets spread the word!!" <- exactly the kind of stuffs cheap trills are made of. SQL injection has been around for ages, no big deal, it will take less than 2 minutes to fix the site up. But these are the kind of demos you get by self proclaimed Malaysian hackers.

Thursday, March 13, 2008

Python Take III

These are my first 3 book on Python. Having read them from cover to cover.
The philosophy of Python makes all the difference here. It summarizes most of the tenets of programming as far as coding is concerned that i believe and practiced although mostly on other languages that i worked on...

If you start the Python intepreter and type "import this" you will get the following beautiful summary of what programming should be :-

The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!