Rapid Development Using Python
SkipWare is a series of extensions to standard Internet transport protocols that, when installed on a network device, maximizes link utilization and reliability in a stressed transmission environment. It has been developed collaboratively between GST and Comtech; GST provides the software and Comtech provides the hardware. Although SkipWare is an implementation of SCPS (space communication protocol standards), a graphical user interface is required to specify configuration settings that impact overall system performance. Given that the product forwards IP (Internet) traffic, a Web-based client was the most feasible interface for our customers.
Because the interface requirements were soft and time was short, we approached the interface with a rapid development mentality focused on constant customer feedback. A language decision had to be made, and we had the following choices (primarily due to our experience): C, PHP, Perl, Java and Python. Our selection was based upon the following criteria:
We planned to prototype on a remote device and anticipated numerous changes. We needed a language that was designed with change in mind.
We wanted to avoid the added step of code compilation in order to minimize the overhead associated with a change. An interpreted language seemed pragmatic.
We wanted a language with good introspection capability.
We needed to do a lot of string manipulation and file I/O. Whatever language we chose had to excel in both of these areas.
Disk space was a concern in our decision but not a driving force. The hardware provided to us was an 800MHz processor with 64MB of RAM and a 32MB root filesystem. Of those characteristics, the disk space was clearly the most precious. Because of the high clock speed and availability of RAM, interface performance was not a driving force.
Our development environment focused on customer interaction. Because time was short, the traditional approach—formal requirements gathering followed by independent development and testing—was not practical. We anticipated making changes frequently on a remote device, with a customer representative viewing the interface and providing instant feedback.
Python allowed us to achieve this environment primarily because it is easy to use interactively. Prototyping through an interactive interpreter is an effective mechanism for exploring different approaches to solving a problem. With a customer representative providing real-time feedback, we needed a language with which we could prototype a function instantly through an interactive interpreter and then copy the working function to the remote device for approval. Perl did not provide an interactive interpreter that enabled this behavior.
Our rapid development environment meant that changes had to be visible immediately to both the developer and the customer representative. Coding sessions frequently would involve work on a remote device during which time changes would be made and feedback would be gathered. Use of a compiled language inhibited our ability to prototype on a remote device, because it required maintaining a build environment. In the scenario where we changed one or two lines of code on the remote device during an interactive feedback session, we did not want to have to wait for compilation before gathering the next round of feedback. IDEs were not feasible as a solution to our problem, because much of our development occurred on the remote device.
We wanted to dispatch Web requests to code in a very direct fashion. An architecture based on a central controller that used introspection to determine where to route requests seemed a clean and simple choice. Because our controller-based architecture was abstract and generic, we had concerns about safety. Python protects the programmer from buffer overflows and has excellent reflection capabilities that can be explored at run-time. Both characteristics satisfied our needs for introspection and safety. Moreover, an inspectable run-time is nearly equivalent to running an application under a debugger while making changes. This characteristic appealed to us.
All user input arrived in string format. All output was stored in files or returned to the user in HTML format. Both of these concepts are well supported in Python. Iterating over the content of a file takes two lines of Python. In comparison, Java requires five or five instantiations followed by two or three lines to read. Once read into memory, content must be tokenized before iteration. While iterating, casting is required. The Java approach exemplifies the importance of selecting the appropriate language for your development environment—it would not have been a good language choice for the tasks we were to perform, primarily string and file manipulation. With all of its built-in types and excellent string and file manipulation, Python provided us with the tools we needed to accomplish our tasks quickly and easily (more on this later).
Narrowing down the language choices was not particularly difficult. C requires compilation, is easy to exploit through buffer overflows (and thus poses a security risk) and does not handle strings and file I/O particularly well. PHP also was dismissed because we were not accessing a database, hence many of the features of the language would not be used. Java is too bloated, requires compilation and has horrible file I/O and string manipulation.
Python survived our language elimination process because it satisfied all of our requirements. In addition to satisfying our requirements, we gravitated towards Python because of its modularity and support for objects. This allows structured code growth and accommodates change over time. We also welcomed the safety (over C) that the interpreter provides. Above all else, we selected Python as our language because it supported rapid development and our specific requirements extremely well; no other language came close in comparison. Although other languages fulfilled a subset of our requirements, no language we considered fulfilled all of the requirements better than Python.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- RSS Feeds
- New Products
- Trying to Tame the Tablet
- What's the tweeting protocol?
- Dart: a New Web Programming Experience
- Hey God - You may not be
1 hour 9 min ago - Reply to comment | Linux Journal
3 hours 41 min ago - Drupal is an Awesome CMS and a Crappy development framework
8 hours 20 min ago - IT industry leaders
10 hours 43 min ago - Reply to comment | Linux Journal
1 day 3 hours ago - Reply to comment | Linux Journal
1 day 6 hours ago - Reply to comment | Linux Journal
1 day 7 hours ago - great post
1 day 7 hours ago - Google Docs
1 day 8 hours ago - Reply to comment | Linux Journal
1 day 13 hours ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.



Comments
Re: Rapid Development Using Python
what about Ruby as to your criteria?
Re: Rapid Development Using Python
ruby is crude
ruby is perlish
Re: Rapid Development Using Python
I agree. But Ruby is powerful and does support the other objectives.
Personally, I'd still take Python. Python is perfect.
Re: Rapid Development Using Python
I love python, and use it regularly, but this column inadvertantly showed a python gotcha. Since the syntax is dependent on indentation, you have to be very careful when cutting and pasting.
def equals(a, b):
'''returns true if a equals b, false otherwise'''
if type(a) == type(b):
...
The statements after the def should be indented. This wouldn't have mattered in another language that used braces to denote blocks.
Re: Rapid Development Using Python
You barely mention Perl. Was your decision not to use Perl based on a perceived lack of an interactive interpreter (note: an interactive interpreter called ptksh is part of the standard Perl/Tk installation)? If not I would like to know what caused you to select Python vs. Perl. We are in the process of making a similar decision.
Re: Rapid Development Using Python
If not I would like to know what caused you to select Python vs. Perl. We are in the process of making a similar decision.
Just choose Python. You will save the trouble of porting your Perl program to Python afterwards, when you learn that Perl just doesn't scale anymore.
Most choices of Perl for a solution to a particular problem can be attributed to historical burden or ignorance. If you have no historical burden of huge perl codebase, do the right thing.
Re: Rapid Development Using Python
The quick and simple answer is that Perl is a little more of a kitchen sink language having a number of possible ways to do the same thing. While this can be really great for the skilled Perl Wizard it does make larger team projects difficult as each coder may have favorite constructs that some other team members have never used.
Python is more of a carefully constucted language with (mostly) one approach for a given piece of code.
Some examples of Perl I have seen are more terse then the equivelent Python code. But to me the Python also looked like it was easier to maintain. Perl is great for small hacks and has been used successfully on large projects as has Python. I have chosen to use Python for both cases because I seem to be able to maintain the code I write more easily.
Re: Rapid Development Using Python
It's simple - python code is maintainable and can be object
oriented, perl code is not maintainable and cannot (within
the realm of reasonable people) be made object oriented.
Re: Rapid Development Using Python
That is simply a lie.
Re: Rapid Development Using Python
Opposing to popular opinion, I'm not thinking that object-orientation has something to do with emulating a fraction of key-concepts inherent to object-orientation with obscure language features. No, I think it's something a language supports, and if it does it, it better damn well does it good and consistently. In the face of this, Perl has no object-orientation ( and neither has C++ )
Re: Rapid Development Using Python
Perl code can be made perfectly readable. Granted, it may be easier to be made unreadable, but that is largely the programmer's fault. I'm sure one could write unreable python code too.
As for no object oriented perl, this is simply untrue. There are many books published about the subject, and I will not go on defending against such a ridiculous accusation.
Re: Rapid Development Using Python
It's very difficult to write unreadable Python code. You really have to put a lot of effort to do it.
OTOH, I used to be a Perl coder. Perl makes it real easy to write code with is difficult to read. You have to put a lot of effort into reading someone else's Perl code.
Re: Rapid Development Using Python
This is undeniable. After all, one of Perl's mottos is "Perl makes easy things easy, and hard things possible." This does not automatically make all Perl code unreadable, however. I will not defend every piece of code ever written, because I'm sure there is a substantial portion of horrible, unreadable Perl code in the world. I just can't stand the common conception that Perl is inherently unreable. It is simply not true. All it takes is one cleanly written Perl program to prove the case, and there are plenty of those. Check out some good CPAN modules sometime, if you don't believe me.
I fear we're getting into muddy waters, though. The flames of war are a-brewin' and this post probably doesn't help. With that, I bid you adieu, and will post no further.
Re: Rapid Development Using Python
It's actualy easy to proove that perl is inherently ugly and unmaintainable.
There's surely nice perl code as there is nice python code.
-Write some 50 lines perl code, out of your head, do not comment or refactor it. Do the same in python ( you may use a few more lines ). Let it rest for a week. Look at your code afterwards, which one is the one you can still read?
-There's ugly python and ugly perl. Only a python author has to go to extreme lengths in order to make it impossible to read his code like an open book. Perl is somewhat the anathema to this.
Re: Rapid Development Using Python
In the article you use this:
for line in open('file.txt').read().split('
'):
Why not this:
for line in open('file.txt').readlines():
Or using the iterator:
for line in open('file.txt'):
Re: Rapid Development Using Python
for line in open('file.txt').read().split('
'):
strips the line endings, readlines() doesn't.
for line in open('file.txt').
for line in open('file.txt').read().splitlines():
will get of the newlines
Re: Rapid Development Using Python
To be fair, it is not that C is easy to exploit, but bad C code. One could argue that the C library itself is bad code, because the exploitable problems are due to coding errors using the library that are relatively easy to make. These problems could be avoided with new libraries; Dan Bernstein wrote his own string-handling libraries that are immune from buffer overflows when writing qmail. Additionally, Python itself is written in C, and it appears to be safe from buffer overflows, because it uses the C library correctly.
The C library API is also about 30 years old now. There are a lot of things that could be done better, but there is also a lot of inertia that's not likely to be overcome.
Oh, and Python rocks.