Title: Postmortem: LAME MP3 Encoder GUI
Slug: postmortem-lame-mp3-encoder-gui
Date: 2007-03-13 15:41:00
Author: Kartones
Lang: en
Tags: Development, Visual Basic, Tools
Description: A postmortem analysis of the development process of the LAME MP3 Encoder GUI tool I built in the past.

 <p>Today a colleage asked me for a tool to convert from WAV to MP3 (and also MP3 to WAV) and I remembered that some years ago I made with my friend Lobo666 a small app with VB6, and I wanted to look at it now and see how I made it.</p>
<p>My friend did the research of <a href="http://lame.sourceforge.net/">LAME</a> command line options, and suggested me the layout of the GUI, and we decided to make it multi-language (english and spanish).</p>
<p>This is how it looks:</p>
<p><img src="https://images.kartones.net/posts/screenshots/lamegui001.jpg" title="LameGUI" style="width: 500px; height: 358px;" alt="LameGUI" border="0" height="358" width="500"> <br><font size="1">The main window, spanish language</font></p>
<p><img src="https://images.kartones.net/posts/screenshots/lamegui002.jpg" title="LameGUI" style="width: 500px; height: 358px;" alt="LameGUI" border="0" height="358" width="500"><br><font size="1">The main window, english language</font></p>
<p><img src="https://images.kartones.net/posts/screenshots/lamegui003.jpg" title="LameGUI" style="width: 462px; height: 219px;" alt="LameGUI" border="0" height="219" width="462"> <br><font size="1">The about window, english language</font></p>
<p>So, let's get into what I did back at 2001? 2002? (I can't remember exactly, last executable is dated 2002)</p>
<p><b><u>What went right</u></b></p>
<p>Instant language switching is cool. We planned it from the start and went smoothly and  without problems.</p>
<p>We provided all the useful basic and intermediate LAME encoding options in an easy, visual way. It was quite fast configuring the options and encoding an MP3. The presets were also a good add-on.</p>
<p>Part of the code was separated from the forms, in a module. Is well documented, perfectly readable, no bad coding style mistakes (no "i" variables and  similar), and I used hungarian notation (which I don't like too much now but it's better than nothing).</p>
<p>Building the command-line text was centralized in a single function, that avoided complex string manipulation issues as it rebuilded the query from scratch every time an option changed.</p>
<p>It worked! Seems funny, but some of my experiments back then ended being either non-functional or non-optimal (for example, being quite slow because of complex calcs made badly and with VB). The application can still be used as of today with VB runtimes.</p>
<p>Intensive testing. Although I didn't know about unit testing at that time, we did a lot of manual testing (we tried <b>every </b>combination of options).</p>
<p>ID3 Tag support was not initially planned, but we thought it would be useful to avoid having to open Winamp and setting the text after encoding. It proved really useful and every MP3 use/uses ID3 tag info now.</p>
<p>My friend learned a bit of programming in the process. And the scrolling text in the about window looked cool back then :)</p>
<p><b><u>What went wrong</u></b></p>
<p>I didn't used resource files! While having 4-5 graphics/icons was easy, all the "multi-language" is hardcoded as two functions (which fill the labels, combos and message strings) called when you select a language.</p>
<p>Not all code was detached from the presentation layer (damm VB6 style of coding logic in the .frm). At least I got a job and learned to work with 3-tier layered applications afterwards :)</p>
<p>Code comments were in english, but variable names were in spanish. Strange mixture :P</p>
<p>No error checking on choosing source/destination files. Also just basic error-checking on the Shell interaction (when launching LAME).</p>
<p>The command-line string building function was called dozens of times... Instead of a having a multiple event handler, I had all <font face="courier new,courier">optionxxx_Click()</font> repeated all over the code. </p>
<p><b><u>Conclusion</u></b> </p>
<p>It proved easy to develop the tool, and while I might not be very proud of the coding, it wasn't bad either. I just didn't had the same knowledge as I have now. Also, I worked with a "final customer" and experienced what was building a GUI being "directed", playing with the Shell and actually using the tool we were going to "improve".<br></p>
<p mce_keep="true"> </p>
<p>Maybe another day I'll take older source codes, like my (terrible now) C mini-games and make more postmortems of them... but I don't know if I want to look at them :)</p>
