<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Neuroning</title>
    <link>http://neuroning.com/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>My mind workout on Software Development</description>
    <item>
      <title>Practical API Design</title>
      <description>&lt;p&gt;I wrote about &lt;a href="http://neuroning.com/articles/2006/11/19/on-api-design-guidelines"&gt;API design guidelines&lt;/a&gt; before, collecting links, resources, papers and hoping someone would write a book on the subject.&lt;/p&gt;

&lt;p&gt;The wait is over! Jaroslav Toulash published a book on &lt;a href="http://www.amazon.com/gp/product/1430209739?ie=UTF8&amp;amp;tag=neuroning-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1430209739"&gt;Practical API Design&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Take a look at the book&amp;#8217;s &lt;a href="http://apidesign.org"&gt;accompanying website&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m waiting for my copy.&lt;/p&gt;</description>
      <pubDate>Sun, 31 Aug 2008 18:14:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:108ac37b-dfe1-4ae2-b1e5-3d975f0e1c09</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2008/08/31/practical-api-design</link>
      <category>Java</category>
      <category>Books</category>
    </item>
    <item>
      <title>Oracle eats BEA</title>
      <description>&lt;p&gt;&lt;img src="http://www.nature.com/nrd/journal/v5/n12/images/nrd2206-i2.jpg" style="float: right; padding: 5px; width:20%"/&gt;&lt;/p&gt;

&lt;p&gt;To me, &lt;a href="http://neuroning.com/articles/2006/03/08/bea-systems-acquires-fuego"&gt;BEA was the big fish&lt;/a&gt;
 not long ago.&lt;/p&gt;

&lt;p&gt;Today, &lt;a href="http://www.oracle.com/corporate/press/2008_jan/bea.html"&gt;BEA is the small one in the mouth of Oracle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We are in a steep ride, jumping quickly from a start-up to becoming part of BEA and
now of Oracle. I hope we can keep the &amp;#8220;small-company&amp;#8221; atmosphere here in our division.&lt;/p&gt;</description>
      <pubDate>Wed, 16 Jan 2008 09:37:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d64e0a1e-e3fe-4604-b971-07bab030be63</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2008/01/16/oracle-eats-bea</link>
      <category>Personal</category>
      <enclosure type="image/jpeg" url="http://neuroning.com/files/fishes.jpg" length="10116"/>
    </item>
    <item>
      <title>Content-aware image resizing</title>
      <description>&lt;p&gt;Watch this video demonstrating some cool algorithms for resizing and cropping images. They analyse the content of the image and try to remove/add/stretch/shrink only those areas of the image that are less relevant.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.youtube.com/v/qadw0BRKeM"&gt;http://www.youtube.com/v/qadw0BRKeM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;object width="425" height="350"&gt;&lt;param name="movie" value="http://www.youtube.com/v/qadw0BRKeMk"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/qadw0BRKeMk" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 06 Sep 2007 10:16:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:79d122ee-9c44-4b6a-a586-98fc141a951f</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2007/09/06/content-aware-image-resizing</link>
    </item>
    <item>
      <title>Online Mind Mapping</title>
      <description>&lt;p&gt;A couple of smart friends of mine are strong advocates of &lt;a href="http://en.wikipedia.org/wiki/Mind_Map"&gt;mind maps&lt;/a&gt;, so much in fact that they had nothing better to do than develop &lt;a href="http://wisemapping.com"&gt;http://wisemapping.com&lt;/a&gt;. It&amp;#8217;s a pretty impressive online mind-mapping tool with everything you&amp;#8217;d expect these days from a &lt;em&gt;web two-oh&lt;/em&gt; application: rich UI, collaboration, tagging, sharing.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s my first try, presenting the basic ideas behind &lt;a href="http://en.wikipedia.org/wiki/DITA"&gt;DITA&lt;/a&gt;:&lt;/p&gt;

&lt;iframe
style="border:0;width:500px;height:300px;border: 1px solid black"
src="http://www.wisemapping.com/c/embeddedView.htm?mapId=31&amp;zoom=1.25"&gt;
&lt;/iframe&gt;

&lt;p&gt;It&amp;#8217;s still a private beta, with many more features coming. &lt;/p&gt;</description>
      <pubDate>Wed, 05 Sep 2007 22:06:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:aa920c22-df2d-478a-bce5-a718ad336148</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2007/09/05/online-mind-mapping</link>
      <category>Software Products</category>
    </item>
    <item>
      <title>Moving back to Argentina</title>
      <description>&lt;p&gt;In March, I accepted a new position within BEA, to work for BEA Argentina.&lt;/p&gt;

&lt;p&gt;After more than six years in the U.S., my wife and I were thinking about moving back to
Argentina. We were talking about doing so in 2008. Then, this opportunity
within BEA came across. It was sooner than what we planned, but it was interesting
for me professionally, and BEA was helping with all the relocation needs. So I accepted.&lt;/p&gt;

&lt;p&gt;It all happened (is happening I&amp;#8217;d say) pretty quickly. Me and my family arrived at
Argentina a couple of weeks ago, and I started on this new role immediately.&lt;/p&gt;

&lt;p&gt;April was a good exercise on getting things done, both in and out of work. Here&amp;#8217;s just
a summary:&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I played the negotiating game before signing the final offer to move to BEA Argentina.&lt;/li&gt;
&lt;li&gt;We did a &amp;#8220;virtual&amp;#8221; garage-sale on craiglist (sold a grill, furniture, garden tools and
more).&lt;/li&gt;
&lt;li&gt;A strong storm (Texas style) blew several shingles off our roof. We had to get it
fixed quickly before putting the house in the market!.
Some of those asphalt shingles landed on top of my car!, scratching it really bad.
I had to take it to the body shop ASAP before selling it.&lt;/li&gt;
&lt;li&gt;I flew to Boulder, Colorado to get a one day training for &amp;#8220;new managers&amp;#8221;&lt;/li&gt;
&lt;li&gt;The water heater went nuts. Long story short, I managed to replace the thermostat
and that fixed the problem.&lt;/li&gt;
&lt;li&gt;Worked a lot on reconditioning the house for selling (painting, cleaning, fixing&amp;#8230;).&lt;/li&gt;
&lt;li&gt;Had to get a &amp;#8220;certificate of residency&amp;#8221; from the Argentine consulate in the US (to
avoid paying fees when clearing customs). Sounds simple, but the Argentine consulate
in Houston is the worst and most inefficient public office I&amp;#8217;ve ever seen in the U.S.
or Argentina.&lt;/li&gt;
&lt;li&gt;Sold our house (in less than 2 days!, I cannot imagine how
we would have dealt with it otherwise). If you need a Realtor in Dallas/Plano, I
strongly recommend Alan Bertucci (an ex-Fuego guy who got tired of working with
computers).&lt;/li&gt;
&lt;li&gt;I worked at a customer site for two weeks, which is always more stressful than
working in your office, specially when you are dealing with so much stuff out of work.&lt;/li&gt;
&lt;li&gt;Packed and shipped all our goods. Big help from the relocation company, but 
we had to spent two days watching over them, labeling boxes, separating things
for air or sea shipment, writing a detailed inventory. Not to mention that they
made two big holes in a wall (1 day before we had to turn the house over to the new
owners!).&lt;/li&gt;
&lt;li&gt;Closed all accounts (phone, mobiles, electric, water, gas, toll tags, credit cards,
banks, directv, tivo, &amp;#8230; ). This included fighting a few battles, like the one to
prevent Cingular from charging us a hefty early-termination fee.&lt;/li&gt;
&lt;li&gt;Worked on finishing and handing over a couple of internal software projects I was
working on.&lt;/li&gt;
&lt;li&gt;I flew to California (for a day) to meet my new boss.&lt;/li&gt;
&lt;li&gt;I gave a full day training for customer and internal BEA employees.&lt;/li&gt;
&lt;li&gt;We went on a shopping spree:  books, electronics, apparel, and things we knew
was cheaper or easier to get in the U.S.&lt;/li&gt;
&lt;li&gt;Tried to meet and say &amp;#8220;bye&amp;#8221; to all the good friends I made in the U.S.&lt;/li&gt;
&lt;li&gt;Sold our cars (CarMax doesn&amp;#8217;t pay very well, but it was convenient).&lt;/li&gt;
&lt;li&gt;Rented a car and lived in a hotel for a few days.&lt;/li&gt;
&lt;li&gt;We picked up our daughter from school and drove straight to the airport. We took 
our final flight back to Argentina. A 10-hour trip is never easy with 2 kids;
Pilar (our 1-year-old) made it specially hard this time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That&amp;#8217;s just the first half. Now in Argentina, we are re-building our lives.&lt;/p&gt;

&lt;p&gt;We are looking for a home, mortgage, school for the kids, car, doctors, we are doing paperwork
to make our kids permanent residents in Argentina, I&amp;#8217;m adapting to my new job, and we are
living as guests until we find a home and the shipment with all our goods arrives.&lt;/p&gt;

&lt;p&gt;Luckily, here we get a lot of help from our bigger family. After all, they are pretty
much the only reason why we decided to come back to our home country!&lt;/p&gt;

&lt;p&gt;The dust should settle the next month or so, and we&amp;#8217;ll feel &amp;#8220;at home&amp;#8221; again.&lt;/p&gt;</description>
      <pubDate>Sun, 13 May 2007 23:13:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:114beb97-7792-437d-81b6-894169fb9e60</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2007/05/13/moving-back-to-argentina</link>
      <category>Personal</category>
      <category>Career</category>
      <trackback:ping>http://neuroning.com/articles/trackback/202</trackback:ping>
    </item>
    <item>
      <title>Violating Java's privacy</title>
      <description>&lt;p&gt;I  found myself in the need to invoke a private method of a Java
class that was out of my control. I really needed it.&lt;/p&gt;

&lt;p&gt;So, I went ahead and &lt;em&gt;violated&lt;/em&gt; the method&amp;#8217;s privacy declaration via
reflection. You can (under certain circumstances) invoke methods which
are declared as private using the Reflection APIs (&lt;code&gt;java.lang.reflect&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;But before using reflection, I created two classes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class A {
  public String method1() {
    return "Hello World!";
  }
}

class B {
  public static void main(String[] args) {
    A a = new A();
    System.out.println(a.method1());
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;They compiled, and &lt;code&gt;java B&lt;/code&gt; said &amp;#8220;Hello World!&amp;#8221; as expected.&lt;/p&gt;

&lt;p&gt;Then, I made A&amp;#8217;s method &lt;code&gt;private&lt;/code&gt; and recompiled A. And I run &lt;code&gt;java B&lt;/code&gt; again. Nothing changed. It just worked again.&lt;/p&gt;

&lt;p&gt;That cannot be right. This would mean you can handcraft a class with the
same name and methods as the original one but making everything
&lt;code&gt;public&lt;/code&gt;.  Then you could use this class only at compilation time,
allowing your code to call any method. (Or, one could modify
the Java compiler to ignore access declarations altogether).&lt;/p&gt;&lt;p&gt;Returning to the reflection APIs for a sec., here&amp;#8217;s how I called private method
&lt;code&gt;ProcessService.getSession(String)&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Class clazz = ProcessService.class;
Class[] params = new Class[] { String.class };
Method m = clazz.getDeclaredMethod("getSession", params);

m.setAccessible(true); // allow access, as if it were public

Object session = m.invoke(this, new Object[] {sessionId});
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Java compiler enforces access restrictions at compilation
time. But it&amp;#8217;s the Security Manager (an object of type
java.lang.SecurityManager) the man on duty at runtime. The above code
works because, by default, the JVM does not use a SecurityManager.&lt;/p&gt;

&lt;p&gt;For the curious, the implementation for method
&amp;#8220;setAccessible(boolean)&amp;#8221; (part of the JDK) looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public void setAccessible(boolean flag) throws SecurityException {
  SecurityManager sm = System.getSecurityManager();
  if (sm != null) sm.checkPermission(ACCESS_PERMISSION);
  setAccessible0(this, flag);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It simply asks the current SecurityManager for permission before
actually changing the &amp;#8220;accessible&amp;#8221; property. In general, before any
&amp;#8220;sensitive&amp;#8221; operation, the code in the JDK asks the SecurityManager
for permission.&lt;/p&gt;

&lt;p&gt;You enable the default SecurityManager passing
&lt;code&gt;-Djava.security.manager&lt;/code&gt; to the java command. This would make the
first code snipet above to throw an AccessControlException. Both
methods &lt;code&gt;Class.getDeclaredMethod()&lt;/code&gt; and &lt;code&gt;Method.setAccessible()&lt;/code&gt;
are guarded by the SecurityManager.&lt;/p&gt;

&lt;p&gt;To allow the above use of reflection with the SecurityManager enabled,
one must define a security
&lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/PolicyFiles.html"&gt;policy&lt;/a&gt;
for explicitly permitting those operations.&lt;/p&gt;

&lt;p&gt;Anyway, back to my original concern of class B being able to invoke class A&amp;#8217;s
private method directly. I could try to run it with the
SecurityManager enabled:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ java -Djava.security.manager B
Hello World!
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It still works. So, I run the same test but from an applet (a more
restricted container):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import java.awt.Label;
import java.applet.Applet;
public class BApplet extends Applet
{
  public void start() {
    A a = new A();
    add(new Label(a.method1()));
  }
}

&amp;lt;html&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;applet width="300" height="300" code="BApplet.class"&amp;gt;
    &amp;lt;/applet&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And now it &lt;em&gt;did&lt;/em&gt; fail, finally:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ appletviewer BApplet.html
java.lang.IllegalAccessError: tried to access method
                  A.method1()Ljava/lang/String; from class BApplet
  at BApplet.start(BApplet.java:7)
  at sun.applet.AppletPanel.run(AppletPanel.java:414)
  at java.lang.Thread.run(Thread.java:595)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For this particular type of runtime checks, the Security Manager is
clearly not involved. Nothing shows up in the StackTrace. It happens
at a lower level, in the JVM itself. Makes sense now: it would be
really inefficient to invoke the SecurityManager for every non-public
method call&amp;#8230; (and who&amp;#8217;d check the calls to the SecurityManager
itself!?).&lt;/p&gt;

&lt;p&gt;But still, Why does it work with the java command, but fails within an
applet?&lt;/p&gt;

&lt;p&gt;To help with performace, the JVM only enforces these checks on classes
loaded by custom classloaders. Classes loaded by the standard class
loaders (bootstrap, extensions and System) are considered
&lt;em&gt;trusted&lt;/em&gt;. There are &amp;#8220;levels&amp;#8221; of trust actually, (bootstrap being the
most trusted), but for this particular case, even the System
(classpath) class loader trusted my class.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.artima.com/insidejvm/ed2/"&gt;Inside the JVM&lt;/a&gt; covers the JVM
internals extensively, including &lt;a href="http://www.artima.com/insidejvm/ed2/security.html"&gt;security and class
loaders&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 19 Feb 2007 22:49:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:7be96d73-24b4-4f34-9d31-1ea2f89ce1a9</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2007/02/19/violating-javas-privacy</link>
      <category>Java</category>
      <category>Security</category>
      <trackback:ping>http://neuroning.com/articles/trackback/164</trackback:ping>
    </item>
    <item>
      <title>I'm sold to Beryl</title>
      <description>&lt;p&gt;I&amp;#8217;ve been trying &lt;a href="http://beryl-project.org"&gt;Beryl&lt;/a&gt; (a 3D Window Manager for X) and I&amp;#8217;m pretty impressed.&lt;/p&gt;

&lt;p&gt;True, it&amp;#8217;s full of useless graphical effects and pure eye-candy. But
it also provides practical features and is very configurable.&lt;/p&gt;

&lt;p&gt;Among the actually useful things: fast and practical ways to change
windows, desktops, to expose the desktop area, scale and pick a window
(ala Mac OS X&amp;#8217;s &amp;#8220;exposé&amp;#8221;), visual notifications, desktop zoom, screen
annotations.&lt;/p&gt;

&lt;p&gt;Unfortunately, most &lt;a href="http://video.google.com/videosearch?q=beryl"&gt;demo videos&lt;/a&gt; concentrate on
the graphical effects instead of the useful features, but they still
give you an idea of what it can do.&lt;/p&gt;

&lt;p&gt;I really like the idea of using a
&lt;a href="http://www.youtube.com/watch?v=IcOZMGuieDU"&gt;&amp;#8220;water-ripple&amp;#8221;&lt;/a&gt; effect as
an unobtrusive -but impossible to miss- way of receiving notifications.&lt;/p&gt;

&lt;p&gt;It integrates nicely with KDE, Gnome and pretty much any desktop
environment. And you can easily switch back to your previous window
manager at any time on-the-fly.&lt;/p&gt;

&lt;p&gt;I have it running on my work laptop, with Fedora 6, KDE and AIGLX.&lt;/p&gt;

&lt;p&gt;Very nice.&lt;/p&gt;</description>
      <pubDate>Wed, 31 Jan 2007 19:27:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:f08afcb8-4908-4d9d-b534-2047530ef0d2</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2007/01/31/im-sold-to-beryl</link>
      <category>Software Products</category>
      <trackback:ping>http://neuroning.com/articles/trackback/159</trackback:ping>
    </item>
    <item>
      <title>History and auto-completion with rlwrap</title>
      <description>&lt;p&gt;If you ever used Oracle&amp;#8217;s &lt;code&gt;sqlplus&lt;/code&gt; you&amp;#8217;d agree that it provides an
arcane command-line interface.&lt;/p&gt;

&lt;p&gt;Being a textmode command-line tool is &lt;em&gt;not&lt;/em&gt; what makes it arcane
though. It&amp;#8217;s that it doesn&amp;#8217;t offer auto-completion or a
command history. If you made a small mistake when typing a long
statement, you would have to re-enter it all over again.&lt;/p&gt;

&lt;p&gt;Most modern command-line tools (including MySQL and PostgreSQL&amp;#8217;s
equivalent to Oracle&amp;#8217;s sqlplus) provide much more powerful interfaces,
just like the bash shell does. They include auto-completion of the
text you are typing (by pressing TAB), access to a history of commands
(up/down arrows, or C-p/C-n), incremental search on the history (C-r),
they remember the history in between invocations and more.
Virtually all these tools use the GNU readline library to provide
these capabilities.&lt;/p&gt;

&lt;p&gt;Unfortunately, not all command-line tools use GNU readline (splplus
being one). Fortunately, there&amp;#8217;s
&lt;a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/"&gt;rlwrap&lt;/a&gt;. I just
came to know this nice little tool.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rlwrap&lt;/code&gt; &amp;#8220;wraps&amp;#8221; any other command-line tool and gives you a readline
interface to it. So, you can invoke &lt;code&gt;rlwrap sqlplus&lt;/code&gt; and you get
sqlplus with the history capabilities of the readline library.&lt;/p&gt;

&lt;p&gt;You may also pass to rlwrap a list of potential words to use for
completion. For example, I also use rlwrap with &lt;code&gt;groovysh&lt;/code&gt; (the Groovy
language shell), so I created a file &amp;#8220;~/.groovysh_completions&amp;#8221; containing the list of commands groovysh accepts. Now, when I launch groovysh I get command history and specialized auto-completion.&lt;/p&gt;

&lt;p&gt;Now, rlwrap cannot do magic. Being so generic, it cannot do
intelligent context-dependent auto-completion. For instance, PostgreSQL&amp;#8217;s command-line interface automatically pulls the list of
potential table names after doing &lt;code&gt;SELECT * FROM &amp;lt;TAB&amp;gt;&lt;/code&gt;. rlwrap cannot give this intelligence to sqlplus, but it&amp;#8217;s still much better than nothing.&lt;/p&gt;</description>
      <pubDate>Thu, 18 Jan 2007 23:06:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:27600a4e-bd9d-4ad5-a43d-9e958e63e594</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2007/01/18/history-and-auto-completion-with-rlwrap</link>
      <category>Databases</category>
      <category>Developer Toolbox</category>
      <trackback:ping>http://neuroning.com/articles/trackback/158</trackback:ping>
    </item>
    <item>
      <title>On API Design Guidelines</title>
      <description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/em&gt; Good news! Jaroslav Toulash emailed me that he published a book on &lt;a href="http://www.amazon.com/gp/product/1430209739?ie=UTF8&amp;amp;tag=neuroning-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1430209739"&gt;Practical API Design&lt;/a&gt; !!! &lt;/p&gt;

&lt;hr/&gt;

&lt;p&gt;Looks like Brian McAllister may be preparing a talk on &lt;a href="http://kasparov.skife.org/blog/src/talks-i-want-to-give.html"&gt;Designing Elegant APIs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've been very interested in good API design for a long time. But I could
never find a single book on the subject. Many design and programming books provide good advice and guidelines that are essential for designing good APIs, but none of them tackles the matter directly.&lt;/p&gt;

&lt;p&gt;I reviewed &lt;a href="http://www.pragmaticprogrammer.com/titles/kpiod/index.html"&gt;"Interface Oriented Programming"&lt;/a&gt;
a few months back with disappointment. It may not be a bad
book, but I felt it was quite basic and superficial. May be my
expectations were too high, and too focused on API design.&lt;/p&gt;

&lt;p&gt;Over time, I collected some links on the subject and
&lt;a href="http://kasparov.skife.org/blog/src/api-design-refs.html"&gt;shared some with Brian&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://video.google.com/videoplay?docid=-474821803269194441"&gt;Best Practices in Javascript Library Design&lt;/a&gt; (via &lt;a href="http://www.artima.com/forums/flat.jsp?forum=276&amp;amp;thread=214061"&gt;John Resig on JavaScript API Design&lt;/a&gt;) - A good presentation given by the author of &lt;a href="http://jquery.com/"&gt;JQuery&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.acmqueue.com/modules.php?name=Content&amp;amp;pa=showpage&amp;amp;pid=488&amp;amp;page=1"&gt;API: Design Matters&lt;/a&gt; - Article by Michi Henning, ZeroC, for ACM Queue magazine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://lcsd05.cs.tamu.edu/slides/keynote.pdf"&gt;How to Design a Good API and Why it Matters&lt;/a&gt; - Excellent deck from Joshua Bloch. There's also a &lt;a href="http://www.infoq.com/presentations/effective-api-design"&gt;video&lt;/a&gt; of his presentation at JavaPolis 2005.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.artima.com/interfacedesign/"&gt;Interface Design&lt;/a&gt;, Best
Practices in Object-Oriented API Design in Java, by Bill Venners -
This one is a Book in progress!. Unfortunately, the last updates
seem to be from 2002 or so. I'm not sure if the project is still
alive. Anyway, it contains many good articles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://openide.netbeans.org/tutorial/api-design.html"&gt;How To Design a (module) API&lt;/a&gt; -
A great page on good design practices for writing APIs.  It's tailored for
NetBeans module writers, but is still pretty general and gives very valuable guidelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-6218.pdf"&gt;How to Write APIs That Will Stand the Test of Time&lt;/a&gt; -
A session I attended at JavaOne 2006. Presented by Tim Boudreau and
Jaroslav Tulach, members of the NetBeans team. It focuses on API
evolution and compatibility, but also covers usability and other
guidelines. I guess they are the main guys behind NetBeans'
&lt;a href="http://openide.netbeans.org/tutorial/api-design.html"&gt;How To Design a (module) API&lt;/a&gt;
page linked above.&lt;/p&gt;

&lt;p&gt;I had the chance to speak with Jaroslav after his session and
suggested he should write a book on this topic. I emailed him the
references I had, and he said he would try to draft something by
the end of year.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.codeproject.com/gen/design/APIUsabilityArticle.asp"&gt;API Usability&lt;/a&gt; -
Focused on making APIs easy to use. The article applies general
usability principles (commonly used in GUI design) to the design of
APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.gotdotnet.com/team/brada/APIUsability.pdf"&gt;Measuring API Usability&lt;/a&gt; -
An interesting article by a usability engineer at Microsoft,
published on Dr. Dobb's. It favors the use of scenario-based design
to achieve usable APIs, and explains the use of their "cognitive
dimensions" framework for measuring API usability. He also &lt;a href="http://blogs.msdn.com/stevencl/"&gt;blogs&lt;/a&gt; about API usability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://blogs.msdn.com/kcwalina/archive/2005/12/20/APIDesignLaws.aspx"&gt;Krzysztof's Laws of API Design&lt;/a&gt; -
From another &lt;a href="http://blogs.msdn.com/kcwalina/default.aspx"&gt;Microsoft blogger&lt;/a&gt; on API design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.artima.com/forums/flat.jsp?forum=106&amp;amp;thread=142428"&gt;Java API Design Guidelines&lt;/a&gt; - A
good article from a developer who was also surprised by the lack of
a book about API design. He collected some advice and additional
links.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.cafeconleche.org/slides/javapolis/xom/index.html"&gt;XOM Design Principles&lt;/a&gt; - Some design "principles" followed by XOM (an XML parsing library).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.aristeia.com/Papers/IEEE_Software_JulAug_2004.pdf"&gt;The Most Important Design Guideline?&lt;/a&gt; -
A short article by C++ guru Scott Meyers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.martinfowler.com/bliki/HumaneInterface.html"&gt;Humane Interface&lt;/a&gt;,
&lt;a href="http://www.martinfowler.com/bliki/MinimalInterface.html"&gt;Minimal Interface&lt;/a&gt;,
&lt;a href="http://www.martinfowler.com/bliki/DesignedInheritance.html"&gt;Designed Inheritance&lt;/a&gt;,
&lt;a href="http://www.martinfowler.com/bliki/DslBoundary.html"&gt;DSL Boundary&lt;/a&gt;,
&lt;a href="http://www.martinfowler.com/bliki/DuckInterface.html"&gt;Duck Interface&lt;/a&gt;,
&lt;a href="http://www.martinfowler.com/bliki/FluentInterface.html"&gt;Fluent Interface&lt;/a&gt;,
&lt;a href="http://www.martinfowler.com/ieeeSoftware/published.pdf"&gt;Public vs. Published Interfaces&lt;/a&gt; -
Some of the many great writings from Martin Fowler. These selection is
on specific topics that are relevant to API design. Most of them
are quite recent.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.acmqueue.org/modules.php?name=Content&amp;amp;pa=showpage&amp;amp;pid=317"&gt;Programmers are People,  Too&lt;/a&gt; - An article by Ken Arnold for ACM Queue magazine: "Programming language and API designers can learn a lot from the field of human-factors design."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, let's hope Brian gives his talk at a big conference, signs a
contract with a big publisher and fills the void.&lt;/p&gt;</description>
      <pubDate>Sun, 19 Nov 2006 22:31:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:232f03ee-615e-411a-8597-d812da9283cc</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2006/11/19/on-api-design-guidelines</link>
      <category>Java</category>
      <category>Books</category>
      <trackback:ping>http://neuroning.com/articles/trackback/48</trackback:ping>
    </item>
    <item>
      <title>Variable Severity Logging</title>
      <description>&lt;p&gt;Most software products and logging frameworks produce entries in their
log files with different severity levels (say, from Debug to
Severe). Then, you can configure which level of messages you want the
application to log.&lt;/p&gt;

&lt;p&gt;At development time, you may want all messages to be logged. But once in
production, you normally configure things so that only Warning and
higher messages get logged (for performance, space and other
reasons).&lt;/p&gt;

&lt;p&gt;The problem is that when a Severe message arises you may need more
detailed (Debug level) information in order to understand the actual
cause of the problem. So, a common practice is to increase the logging
level at that point, and wait for the problem to happen again &amp;#8211;not very effective.&lt;/p&gt;

&lt;p&gt;This is one of the problems that motivated the guys behind
&lt;a href="http://logbag.com"&gt;LogBag&lt;/a&gt;. The idea they propose is nice and simple:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Make the system write only Warning (and higher) messages to the log, but when such a message is logged, it should also include some lower-severity messages that occurred right before and after this one.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s one of those good ideas that might seem obvious, but for some
reason nobody thought (or did anything) about before.&lt;/p&gt;

&lt;p&gt;To implement this, the logging system could keep a buffer of the
last N messages generated by the application, and when a Warning (or above)
message comes in, the whole buffer is flushed to disk.  This should
not be too hard to implement, since most logging frameworks already
use some kind of buffering, in a producer-consumer pattern, to improve
concurrency and performance.&lt;/p&gt;

&lt;p&gt;From the LogBag site:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;You keep on putting things in a Log bag. Then whether the entire
    log bag gets written or not depends on the highest severity level
    in the entire bag. So either you write everything or you write
    nothing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I think it&amp;#8217;s a nice idea. I bet the technical support guys would like
it too :-).&lt;/p&gt;</description>
      <pubDate>Sun, 24 Sep 2006 19:21:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:abd718aa-7c25-4fca-8062-0b78f48170e6</guid>
      <author>F</author>
      <link>http://neuroning.com/articles/2006/09/24/variable-severity-logging</link>
      <category>Debugging &amp; Optimizing</category>
      <category>Software Products</category>
      <trackback:ping>http://neuroning.com/articles/trackback/44</trackback:ping>
    </item>
  </channel>
</rss>
