Entries Tagged as 'Programming'
During the last few month I’ve been explaining software engineering to management types quite a bit. Most of the “bosses” that I talked to weren’t technical at all, so I was trying to stay away from famous concepts, examples, and terminology as much as I could. Of course, that required some sort of substitute for concepts, examples, and terminology. I’ve tried analogies from different unrelated areas, and was surprised as how good cooking was fitting the purpose.
Before I go any further, I have to say that I am not a cook and that I don’t know much about cooking. But. I know just about the same as any other average human being. Which, sort of, moves me into the same category with my targets, or “bosses”, as I called them before.
Here are a few examples that worked well.
[Read more →]
Tags: analogies, Business, communications, cooking, food, Programming, software engineering
Posted in All, Programming on
January 4th, 2009
·
Comments Off
I’m slowly catching up with the news stream and all the jokes of the last few weeks. “If programming languages were religions” is a nice one. Here is PHP, which I spent the most time with now:
PHP would be Cafeteria Christianity - Fights with Java for the web market. It draws a few concepts from C and Java, but only those that it really likes. Maybe it’s not as coherent as other languages, but at least it leaves you with much more freedom and ostensibly keeps the core idea of the whole thing. Also, the whole concept of “goto hell” was abandoned.
And here is Perl, which is my favourite programming language so far:
Perl would be Voodoo - An incomprehensible series of arcane incantations that involve the blood of goats and permanently corrupt your soul. Often used when your boss requires you to do an urgent task at 21:00 on friday night.
Check the rest of them for fun and profit.
Tags: fun, Humor, languages, Perl, PHP, Programming, religion
I’ve mentioned quite a few times that I am a big fan of Perl programming languge. However, most of my programming time these days is spent in PHP. The languages are often similar, with PHP having its roots in Perl, and Perl being such a influence in the world of programming languages. This similarity is often very helpful. However there are a few difference, some of which are obvious and others are not.
One such difference that I came up recently (in someone else’s code though), was about variable scoping. Consider an example in Perl:
#!/usr/bin/perl -w
use strict;
my @values = qw(foo bar hello world);
foreach my $value (@values) {
print "Inside loop value = $value\n";
}
print "Outside loop value = $value\n";
The above script will generate a compilation error due to undefined variable $value. The one outside the loop.
A very similar code in PHP though:
#!/usr/bin/php
<?php
$values = array('foo','bar','hello','world');
foreach ($values as $value) {
print "Inside loop value = $value\n";
}
print "Outside loop value = $value\n";
?>
Will output the following:
Inside loop value = foo
Inside loop value = bar
Inside loop value = hello
Inside loop value = world
Outside loop value = world
In Perl, variable $value is scoped inside the loop. Once the execution is out of the loop, there is no such thing as $value anymore, hence the compilation error (due to the use of strict and warnings). In PHP, $value is in global scope, so the last value “world” is carried further down the road. In case you reuse variable names in different places of your program, counting on scope to be different, you might get some really interesting and totally unexpected results. And they won’t be too easy to track down too. Be warned.
Tags: experiences, Perl, PHP, Programming, software development
We’ve been doing some interesting things at work, as always, with yet more people and Linux boxes. And of the side effects of mixing people, Linux boxes, and several locations is this need for some sort of centralized logging. Luckily we have either syslog-ng or rsyslog daemons installed on each machine, so the only two issues seemed to be reconfiguration of syslog services for remote logging and setup of some log reading/searching tool for everyone to enjoy.
As for log reading and searching, there seems to be no end of tools. We picked php-syslog-ng, which has web interface, MySQL back-end, access control, and more. There were a few minor issues during setup and configuration, but overall it seemed to be OK. I also patched the source code a bit in a few places, just to make it work nicer with our setup and our needs (both numerical and symbolic priorities, preference for include masks over excludes, and full functionality with disabled caching). In case you are interested, here is a patch against php-syslog-ng 2.9.8f tarball.
Once everything was up and running and we started looking through logs from all our hosts in the same place, there was one thing that surprised me a lot. Either I don’t understand the syslog facilities and priorites fully (and I don’t claim that I do), or there is just too many software authors who don’t care much. Most of our logs are coming in at priority critical. Even if there isn’t much critical about them. Emergency is also used way too much. And there is hardly anything at debug or info or notice levels. (RT, SpamAssassin, and many other applications seem to be using critical as their default log level). Luckily, that almost always is trivial to fix using either the configuration files or applications’ source code directly.
Tags: logs, monitoring, Programming, Sysadmin, syslog, tools
Posted in All, Programming, Technology on
November 3rd, 2008
·
Comments Off
The software is checked very carefully in a bottom-up fashion. First, each new line of code is checked, then sections of code or modules with special functions are verified. The scope is increased step by step until the new changes are incorporated into a complete system and checked. This complete output is considered the final product, newly released. But completely independently there is an independent verification group, that takes an adversary attitude to the software development group, and tests and verifies the software as if it were a customer of the delivered product. There is additional verification in using the new programs in simulators, etc. A discovery of an error during verification testing is considered very serious, and its origin studied very carefully to avoid such mistakes in the future. Such unexpected errors have been found only about six times in all the programming and program changing (for new or altered payloads) that has been done. The principle that is followed is that all the verification is not an aspect of program safety, it is merely a test of that safety, in a non-catastrophic verification. Flight safety is to be judged solely on how well the programs do in the verification tests. A failure here generates considerable concern.
The above was written by R. P. Feynman, in Feynman’s Appendix to the Rogers Commission Report on the Space Shuttle Challenger Accident, 1986. More than 20 years ago. Much recommended reading.
Found via Richard Feynman, the Challenger Disaster, and Software Engineering.
Tags: history, Programming, shuttle, Software, space, testing