|
|
Subscribe / Log in / New account

Unladen Swallow 2009Q2 released

Unladen Swallow 2009Q2 released

Posted Jul 15, 2009 20:47 UTC (Wed) by drag (guest, #31333)
In reply to: Unladen Swallow 2009Q2 released by qg6te2
Parent article: Unladen Swallow 2009Q2 released

> Come on drag. A little while ago you were exalting the C language.

Well thanks for remembering. :) Ya sure. You can do anything you want in C, but because you can doesn't mean you should. :)

Like I said before the real advantage of not using C is the amount of time you save designing, writing, and debugging the code. In terms of programming time python is _FAST_. Very fast.

For example I wrote a program in python that processes a dump from a NAND flash on embedded Xscale system obtained from jtag. A portion of the flash uses a combination custom hardware driver combined with MSFLASH driver. There is no hardware balancing and the OS writes directly to the flash with fat file system.. so your dealing with combination of a custom load-balancing and block-to-mtd translation layer.

So the python program I wrote disassembled the entire sectioned dump into individual logical blocks in a array... then reassembled it in order, while filling in the blanks, to produce a drive image that was then mountable in Linux via loopback file system and the fat16 driver. From that then I could obtain the contents of the file system. I was happy it worked. I was able to write the program in one (long) evening and the total execution time of the script is less then 10-15 seconds to process a ~24MB file system.

The entire thing, after validating it on a few different drive images, was production-ready in a couple days after that. I even went through code review with a experienced programmer (which I am not) that never programmed in python before... but he was still able to follow the logic and understand the program.

---------------------------------------

The ability to quickly right, debug, and then have readable code, is a very valuable thing in a language.

It's beyond just trying to 'make programming easy' or 'approachable'. I am convinced that as the lines of code go up a program.. the utility of having the source code goes down. High LOC is a barrier to entry for people and defeats much of the purpose of having the project open source.

--------------------------------------

C is a very important thing and I don't hate it. It's just that it's very slow to program in.

So instead of using a shotgun approach with C and simply programming _everything_ in C you need to pick your battles. This means that you spend programmer time on C were it counts. You want C in areas of your programs and areas of your system that are very performance sensitive.

Having OpenGL libraries in C is a good thing. Having Widgets and application libraries in C are good things. This is because the time spent by programmers on producing optimized and debugged C code can be applied to the widest benefit to the system at large.

One of the very nice thing with Python vs something like Java is that it plays very well with others.

Like Java wants everything to be 'java'. Java-this, Java-that. Java-everything. So what ends up happening is that stuff gets slow.

However with Python you to your initial application in pure-python, but as the application matures and you identify areas were performance is poor, then you rewrite that using optimized C and import the code back in as modules.

Or like if I wanted to write a python-based web browser. I am not going to write the HTML renderer or the Javascript interpreter in Python.. that would be insane. Instead I am going to use webkit or gecko rendering engine and just make the UI in Python. When you click a button on a program it is not going to matter if it's C or if it's python or whatever... the button press will happen and the code backing it will happen faster then the next screen refresh so it's irrelevant.

However with the UI in python then the program UI would be quick and easy to write and I can spend my time refining and improving the UI interface rather then writing code... and other people (if I do my job properly) should be able to more easily extend it and modify it.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds