The Changes I Want

Monday, March 16, 2009

Why C/C++ still rule

Several languages have come up in the past decade, some have been updated with new libraries whilst many new features have been added. Yet, most applications are being built by using C/C++ language. Why is this so?

Firstly, C/C++ have large collection of library files. Debugging tools are superb and well integrated in to the environment and binaries are independent of runtimes. AS C/C++ are native languages they are very fast for compiling as well as running programs that require iterations. 

Further, C/C++ don't use much cycle power of the computer running it. You don't want to waste the memory of the user's computer and hog his CPU performance. Java is great but is not easy to use. There are several steps involved in running it like installing Java Virtual Machine to updating,etc. Running an interpreted language is slow.

Further, C/C++ is to programming what Windows is to Operating System. We learn to use it in our schools without being given any options of learning anything else. They have been fixed in our psych. 

C/C++ apps have faster start-up time than apps coded on other language.

The execution speed of C/C++ compilers are great. This is because they have been developed and updated for over a couple of decade. People like fast applications.

Further you can just click and run the program. No need to install or download runtime from Sun's or Microsoft's website.

However, you must remember that you must choose language that would suit your requirement. Here is the blogpost helping you decide what language to learn next.

Wednesday, February 11, 2009

What language should you learn next

Choice of programming language actually matters, and dismissing languages you haven't used much is foolhardy.

Now there are some languages that better suit individual people than other languages, due to the way they approach problems. Lisp is good for people who think very mathematically. C is good for those who think in a very step by step manner. OOP is good for people who think in terms of models and interactions. But you'll always be more efficient in a language you know well than one thats new to you.

The approach of using the language you know the best makes sense for small jobs and during shortage of time, but for projects that take more than two months, it makes more sense to choose a roughly suitable language, even if your proficiency is lower. This is because you have the luxury of time to refer books.

But remember that learning more languages doesn't necessarily make you a better programmer but it does help you like learning real-life languages do, but you really need to learn Object oriented Languages. Learn how and why to apply specific patterns to specific problems. If you learn these things you will be able to use the right programming language to solve a particular problem. Learning to program and becoming a good programmer has to be a passion not a job.

Sunday, January 25, 2009

Why people use pirated softwares even though they can afford them

I would feel foolish if I spent money to buy a software whose creators insist on treating me with the utmost suspicion with DRM and other such nonsense.

We have grown up with a mindset that the software is expensive and comes with all sorts of stupid restrictions that makes it harder to use, thus for a lot of people it has become quite a routine to use key generators or install pirated versions.

It strongly reminds me of the music industry about which people say that you are hurting the artist who wants to feed his children, and it seems naive to me that any one would expect that people who have never met them will care about them. In this age, people always try to save money, whenever and wherever they can even though they might blow it on something worthless, later.

The software companies must give the legitimate buyers an advantage over the pirates. Consider the apparels industry, you can buy a fake Nike t-shirt but there is marked difference between the fake and the original in terms of quality. In software you cannot do much in this regard but you certainly can give better service to the buyers.

Sample this, I own a license to Adobe Photoshop. If you have more than two computers that you switch between, it is painful to de-authorize and re-authorize computers all the time. If I were using a pirated version of Photoshop, I wouldn't have to endure this. I also wouldn't have to put up with Adobe's incredibly stupid online services to purchase an upgrade when the new version is comes out.

As long as legitimately licensed product offers an inferior user experience users (even if they can afford it) will have an incentive to go for pirated software.

Monday, January 12, 2009

Can Linux gaming grow ?

All three consoles (Playstation,Wii,X-Box) verify digital signatures to reject software developed by parties without an existing business relationship with the console maker, which is incompatible with free software licenses. The console makers also have some fairly strict standards for who is allowed to develop on the console. In fact, Nintendo states that all authorized developers must be established businesses, preferably with a previous commercial title on another platform, with office space separate from any residence.

And will any company other than gaming company, try investing in this field? I don't think so. Not in this uncertain economic conditions. t's possible but unlikely you'll be getting any help from many major game companies.

The major corporations that support linux do so because selling software is not their core business.Google, Red Hat, Intel, IBM, Sun, AMD, HP, Dell, Apple all of these companies main income are derived not from selling software hence they don't have any problems with open source as it doesn't compete with them.

In the linux space you tend to see a lot more "enterprise" type software and less consumer software. Game companies typically don't sell support licenses, hardware or word search and thus have less interest in supporting open source. The companies that support it do so knowing it doesn't compete with their core business model and they benefit from it.

On PC gaming front, the gamers are extremely adventurous. They want the latest games with the latest technology. Only the Gaming companies who spend millions a year can do this. The open source developers cannot compete with them. If Linux need to get popular as fast as possible, perfect Wine a lot. Have it run Direct X out of the box as well as the top games and top windows apps. Just imagine the day when the game cover requirements will start listing Windows Vista or Mac OS or Wine 1.x.

Till then we will have to be satisfied with flash games.

Sunday, January 11, 2009

The rise of R

Though the syntax of R is terribly outdated and the main problem I have with R is the performance. A lot of functions and packages are dead slow or takes up lot of memory.

R excels in three respects:

(a) it allows for easy access of Fortran and C library routines

(b) it allows you to pass large blobs of data by name

(c) it makes it easy to pass data to and from your own compiled C and Fortran routines

The first reason is any algorithm needed in statistics that's available as C or Fortran code can be linked in and called without too much effort. It allows one to use e.g. pre-compiled linear algebra package like LAPACK, or Fourier Transforms, or special function evaluations and thereby gain execution speeds comparable to C despite being an interpreted language ; the hard work is carried out by a compiled library routine which is made easily accessible through the interpreted language.

The second reason is important because it slows down execution much less than any pass-by-value interpreted language would, and it allows you to change data that is passed into a function.

The third reason is particularly important because it helps researchers be more productive. Vector and matrix primitives are far more powerful, and usually preferable unless they are so inefficient that you have to wait for the result. Reading in your data, examining it, graphing it, tracing outliers and cleaning them up is best done in an interactive environment in an interpreted language. However, there are times when you just need to carry out standard algorithms (linear algebra, calculation of mathematical or statistical functions) that run so much faster in a genuine compiled language. 

But you would never want to write a long/complex program in R.

The Times describes it as: 'a popular programming language used by a growing number of data analysts inside corporations and academia. It is becoming their lingua franca partly because data mining has entered a golden age, whether being used to set ad prices, find new drugs more quickly or fine-tune financial models. Companies as diverse as Google, Pfizer, Merck, Bank of America, the InterContinental Hotels Group and Shell use it.'"

Saturday, January 3, 2009

C++ vs C#

The C++ performance was about 10% faster than his C# variant. However, while the numbers were fairly similar, the C# application took a lot longer to run than the C++ variant, so I took a look at the code.
The performance difference appears to be caused by the fact that object creation / deletion is slower when using C# compared to C++.The C++ version is probably faster because it only calls new() once, while the C# code calls new a lot of times. If C++ had called new as many times as the C# code, the C++ code would probably have been slower.
C++ char 8 bits in size, whilst a C# char is 16 bits in size. The C# variant is capable of holding unicode strings while the C++-variant is more limited.

C++ heaps have to allocate memory by walking the heap and finding a large enough spot. If one is not found, empty blocks are split, and the pointers within the object are modified. This leads to heap fragmentation and memory waste.

C# is probably about as good as C++ at sorting arrays, provided you use the language the way it's supposed to be used. On the other hand, it seems C# is worse at "moving stuff around in memory," which tells me that when you do choose to use C#, you should generally be more careful about slinging a lot of data around memory than in C++.

Why do we need to register to download experimental extension?

The need for registration had pissed me off several times. I love firefox and most of the extensions (add-ons) that are useful for me are available directly for download without registration. But there are several good extension which requires us to register to download it to Firefox. I am not alone. I saw a discussion on Reddit where many voiced similar complaints.
Just pop up a goddamn dialog: "This extension is experimental, use at your own risk, Yes/Cancel".

I have to supply an email and confirm to download an extension? and by default you make that email publicly available? Great, Firefox has "protected" me from an extension, and made me vulnerable to spam! Smart thinking??? 

But I do agree with Mozilla on this one. While the dialog box solution would be perfectly suitable for advanced users, a large proportion of normal users wouldn't even bother to read the dialog, and just click Yes. If their firefox then stops working (due to a buggy experimental plugin), they would probably have no idea how to fix it.

Having to register to use an experimental plugin is a much bigger roadblock, stopping unskilled users from accidentally shooting themselves in the foot. I think this is worth the inconvenience it causes to advanced users.

But they could have hidden something in about:config that advanced user could have enabled to download these extension without registration.