Muli Ben-Yehuda's journal

July 15, 2003

Code that Sucks #3 – variables? we don’t need no stinking variables!

Filed under: Uncategorized — Muli Ben-Yehuda @ 6:32 AM

Compare, contrast, weep:

 
((bar*)foo->bar)->gar->member = ((adapter*)(ptr + 4))->sequence_number++; 

(Real code, struct and member names changed to protect the guilty)

With:

 
struct bar* bar = foo->bar; 
struct gar* gar = bar->gar;

struct adapter* adapter = (ptr + 4);

gar->member = adapter->sequence_number++; 

I just spent a couple of minutes making sure that the second version is functionally equivalent to the first, and I’m still not sure. Think about it – a couple of minutes for ONE line of code. Code should be written for people first, compilers second. Say no to gratuitous obfuscation, say yes to intermediate variables!

Code that Sucks #2: PRINTF() does not a portable program make!

Filed under: Uncategorized — Muli Ben-Yehuda @ 6:22 AM

There’s a line of thought amongst programmers who do not understand what portability means that simply wrapping up any system service in a MACRO is enough. printf() becomes PRINTF(), sleep() becomes SLEEP(), etc, etc, ad nauseam. The fallacy here, of course, is that they assume that the name might change, but the interface won’t, which is dead wrong. Name changes are the least of your worries. It’s interface changes that you should be concerned about, and your “portability layer” must present a common, unified interface, not just “the interface of whichever platform this code ran on first”. Furrfu!

TAU Linux Workshop kernel development talk summary and updated slides

Filed under: Uncategorized — Muli Ben-Yehuda @ 6:13 AM

I’m too lazy to write the same thing twice, so I’ll just paraphrase from an email I sent after the event:

“The Kernel Hacking talk today at TAU went pretty well. There were 25-30 students, 5 or so were “free listeners”, and the rest students taking the workshop. No one fell asleep and almost everyone stayed through the entire three hours. I had a a pretty bad start due to not realizing the first two subjects (kernel introduction and source layout and kernel compilation) are pretty darn boring without any motivation, but once we hit the second hour with “writing kernel modules”, things definitely picked up. People were interested in all aspects of kernel development, both the technical (how to write the code) and the sociological (how to get it accepted). Also, several people took notes when I talked about syscalltrack and talked to me about it after the lecture. I guess now we need to wait and see if anything comes out of it :-)”

This morning I woke up at 04:30 AM after crashing last night at 09:00 PM, and finally added a bibliography slide to each of the subjects, with links to the prominent source of information on that subject. Also added a slide on mknod(1) to the kernel module talk. Updated slides available on mulix.org/lectures.html.

July 13, 2003

All Code Sucks – The Repository

Filed under: Uncategorized — Muli Ben-Yehuda @ 10:59 PM

My good friend Oleg Goldshmidt, has created a repository for for stupid software patterns, aptly named All Code Sucks. Read and be horrified by the stupidity of thy fellow programmers. Or be amused. Or just shoot them all.

slides for Kernel Development talk at TAU Linux Workshop

Filed under: Uncategorized — Muli Ben-Yehuda @ 3:46 AM

Slides for the aforementioned (see last entry) are now up at mulix.org/lectures.html. I’m pretty happy with the “writing kernel modules” one, but the UML one is pretty much a place-holder, but it’s 4 AM and I spent the entire saturday on it, except for a great lunch with Orna at the chinese place. Fuck it, I’m going to surf the web aimlessly now and wait for the morning 😉

July 12, 2003

TAU Linux Development workshop talk tomorrow

Filed under: Uncategorized — Muli Ben-Yehuda @ 11:37 AM

I’m writing the slides for my “invited talk” tomorrow at Eddie A.’s TAU Linux Development Workshop on kernel development. Here’s the outline of the talk:

o introduction to the linux kernel and source overview
o compiling the kernel

o writing a Linux kernel module

o user mode linux
o how to contribute to the linux kernel
o syscalltrack

Slides should show up on mulix.org/lectures.html when I finish writing them. If you’re in the area of Tel Aviv University tomorrow and you have a few hours to kill between 1PM and 4PM, consider dropping by! entrace is free to the public and I’d love to see you.

July 8, 2003

Gidi Aharonovich and Shoshannah Forbes talking about accessibility at IBM HRL

Filed under: Uncategorized — Muli Ben-Yehuda @ 1:15 PM

I’m writing this while sitting in a colloqium talk at the IBM Haifa Research Lab auditorium, where I work. Shoshannah Forbes, of linux-il fame, and Gidi Aharonivich, who’s blind from birth, are giving a talk on website and otherwise accessibility. As far as I’m personally concerned, they’re preaching to the converted. However, I never write websites and shy away from writing any sort of non textual user interface, so anything I write is (not?) accessible by definition.

Later today I have the second algorithmics class, which I’m looking forward to (see last week’s entry).

LOL, Gidi just mentioned that many sites that specifically cater to the blind are actualy not accessible to the blind!

Good talk, too bad my laptop’s battery died in the middle. *grumble*.

blogroll

Filed under: Uncategorized — Muli Ben-Yehuda @ 1:09 PM

Shachar Shemesh, Hamakor board member and all around good guy, has a new blog on pcplus. Sadly, it’s in Hebrew, but still, good stuff there.

Gilad Ben-Yossef, another Hamakor board member, used to have a very enjoyable blog, but no longer updates it. Shame.

Haifux python talk

Filed under: Uncategorized — Muli Ben-Yehuda @ 1:04 PM

On Monday afternoon, I gave the from python import lecture talk to Haifux. About 20 people showed up, which was considerably more than I expected, considering we’re in the middle of the Technion’s exam season. The talk went rather well, if I may say so myself. I made the usual mistakes of talking to the more knowledgable subset of the audience, but I also made sure to explain even things that seem obvious to me and that subset, because they weren’t necessarily obvious to the rest of the audience.

Giving this talk was harder than usual, because I’m no python expert. I gave it for the first time a year and a half ago, in order to have an excuse for learning python, and yesterday I gave it again in preperation for moshez‘s advanced python talk at the next club meeting, but I’m not a python guru for any stretch of the imagination. We have moshez for that. During the lecture there were several questions I had to answer with “I don’t know”, but all of them were answerable with 10 seconds in front of the python interpreter.

All in all, an enjoyable evening, even though I was very tired. Next semester I’ll be studying Algorithms on Monday evenings, so no Haifux meetings for me after September. I’ll miss the club, the clubbers, and the talks.

Registerd for my last class for the winter semester

Filed under: Uncategorized — Muli Ben-Yehuda @ 10:56 AM

On Sunday afternoon I registerd for my fourth class for the upcoming winter semester at the Open University. Previously I registered for Infi I, Compilation, Algorithms and on Sunday I registered for Mathematical Logic, an advanced math class. I studied logic in the Technion, but never quite got the hang of it. I have since learned many things and expanded my (mathematical) horizons, and I’m hoping this time to be rather more educational.

« Previous PageNext Page »

Blog at WordPress.com.