Monday, July 16, 2012

StringBuilder or not StringBuilder that is the question...

Ten years ago, I achieved competence in my first programming language, Java. Now, a decade later, I found myself back in Java-land programming apps on Android. Even though Java is verbose like a bad russian novel, I found myself enjoying it in a homecoming sort of way. I've decided to periodically share some nitty gritty of Java with the world with the hope that folks will find it useful. Today I want to talk about string concatenations.

String concatenations happens all the time in our code. Most of the time, we need to generate a short message to display to the user or send some snippet of text to the log.

The problem with strings in Java is that they're immutable. Every time we concat two strings we are creating a third string. So the above code has the same effect as:

The intermediate strings from the concat operations become garbage immediately. And since strings are objects, all the overhead of object allocation and instantiation applies, as well as garbage collection at some time in the future.

To solve this problem Java designers came up with StringBuffer, and much later, StringBuilder. These classes are supposed to give programmers a more efficient way to concat strings. The biggest difference between StringBuffer and StringBuilder is that StringBuffer is thread-safe. It turns out 99.9% of the string concatenations are not done across multiple threads so synchronization is an overkill. Since synchronization is not free, it is expected that StringBuilder will outperform StringBuffer.

The previous example, using StringBuilder, becomes:

But the $100 question is: does it actually perform better?

I created a micro benchmark (code here) using caliper to compare the three different ways of concatenating strings. The first using the + operator, another using StringBuilder, and the last using StringBuffer. Since phones have limited memory, I ran the benchmark using 3 VM configurations: 16 MB, 32 MB and 512 MB. The results are surprising:

memoryMax      benchmark  ns linear runtime

  -Xmx16M StringAddition 226 =========================

  -Xmx16M  StringBuilder 246 ===========================

  -Xmx16M   StringBuffer 269 ==============================

  -Xmx32M StringAddition 143 ===============

  -Xmx32M  StringBuilder 155 =================

  -Xmx32M   StringBuffer 166 ==================

 -Xmx512M StringAddition 135 ===============

 -Xmx512M  StringBuilder 152 ================

 -Xmx512M   StringBuffer 166 ==================

As expected StringBuilder outperforms StringBuffer, but StringBuilder is about 10% worse than the + operator.


It turns out StringBuilder (and StringBuffer) uses an intermediate structure to store the result (most likely an array of some sort). And the underlying array have to expand if more strings are appended to it than its capacity. The default constructor creates an array of size 16. It would appear that expanding the underlying array is more expensive than creating and throwing away a few strings.


To prove this, I created a second benchmark (code here) that instead of using the default constructor, gave it the initial capacity of 100 (which is more than enough to fit the test result). And voila!

memoryMax      benchmark  ns linear runtime

  -Xmx16M StringAddition 217 =============================

  -Xmx16M  StringBuilder 202 ===========================

  -Xmx16M   StringBuffer 221 ==============================

  -Xmx32M StringAddition 143 ===================

  -Xmx32M  StringBuilder 126 =================

  -Xmx32M   StringBuffer 138 ==================

 -Xmx512M StringAddition 143 ===================

 -Xmx512M  StringBuilder 125 ================

 -Xmx512M   StringBuffer 137 ==================

Without array expansion, it appears that StringBuilder is around 10% better than the + operator. 
With the evidence in hand, I come to 3 conclusions.
  1. You almost never want to use StringBuffer
  2. StringBuilder may be more efficient, but it's tricky to use properly. If you initialize it with too small a capacity, it will be slower (due to array expansion costs) and if you give it too big a capacity, you're wasting memory.
  3. I'm going to stick to using + to concat my strings. For small number of concatenations the performance boost with StringBuilder is not worth the extra typing and I don't have to think as hard.

Wednesday, June 27, 2012

Reliving the childhood game

I only played one computer game when I was a kid. It was an old DOS flight simulator called F-19 Stealth Fighter with 16-bit graphics and horrendous sound. But I remember it fondly. Firing maverick missiles and getting Distinguished Flying Crosses consumed quite a few hours of my childhood.

This past weekend I decided to relive the nostalgia and play it again. I installed a DOS emulator for my macbook pro caller Boxer and it wasn't too hard to find a copy of F-19 floating around in the abaondonware universe.

The game is still fun. Even more than before.

For one thing, I'm a lot better. I decided to glance at the manual this time around and figured out how to play the most difficult levels. When I was a kid I could never advance far enough, because to play this game properly required a lot of patience. Flying a stealth fighter, after all, is not about blowing everything up. This time around, it was quite easy to win the Congressional Medal of Honor (the highest achievement in the game), where as before it seemed impossible.

Screen Shot 2012 06 26 at 11 37 19 PM

Another added fun factor is that I've actually visited some of the places in the maps. This game was made during the end of the Cold War. So one of the maps was Eastern Europe and I had to fly missions into Czechoslovakia and Poland. It was quite amusing to fly across cities like Prague, Brno, and Krakow and see the low res renderings of them that looks nothing like the real thing. Even more fun to attack targets in those cities and imaging what those parts of the world was like frozen in time.

In the end, this was just a well made game. No wonder, because Sid Meier made this before he became famous for making strategy games. It is amazing after more than 20 years, this game is not only still playable, but still amazingly fun. Sid said of F-19:
Everything I thought was cool about a flight simulator had gone into that game.
So there you have it… a bit of my childhood that is still accessible. No matter how much two decades have changed me and the world, some things remain preserved forever.

Thursday, May 24, 2012

How to Bet Your Life

I'm standing on an abandoned bridge one hundred feet above a stream in the lush rainforest of Costa Rica. Suddenly, I had doubts. It was a great idea when we plan it in the serenity of the hostel. But up there, with the bungee cord tied up around my ankles, the view is a bit wobbly. The theoretical has just become the very real.

That exact feeling is what most people encounter when they're contemplating quitting their corporate job to join an early stage startup.

Startups are hot and everyone wants a piece. A 13-person startup can be sold for a billion dollars. Even hollywood is getting in on the action. Bono is a VC and Ashton is an angel. That's enough to make dreamers out of everyone. But what if suddenly you're offered a chance to join an early stage startup? Are you willing to give up your position in a nice, stable, established corporation for one in a hectic, never-enough-sleep, constantly-dying startup? 

Corporate jobs, especially in high-tech, is nice and cushy. If you're good, you're likely making six-figures in your mid-20s. Not a lot of responsibilities as long as you get your shit done. There will be a smattering of trips, lots of weekend parties, and plenty of time to socialize, get a hobby, or start a family. Now imagine throwing away (or I call it, de-prioritizing) all that for least for a few years. Work-life balance is a nice concept and I try to achieve it when I can, but often reality gets in the way. If you think that sounds bad, then you're not ready.

You're not ready because you're not ready to bet your life. That's what it's like living inside a startup. That's right. You don't work at a startup. You live in it. In poker, you won't double up unless you go all-in; bet all your chips on one hand. This is same in a startup. You go all-in, but you bet with your life. Everything else in your life will take second priority. And just like poker, you shouldn't go all-in unless you're sure that you have the best cards. You should only join a startup if you truly believe in its potential. And as in poker, even with pocket aces, you can still lose. That's why it's called a bet.

A line from the hip-hop preacher that I love:

To achieve success, you have to be ready, at any time, to sacrifice who you are for who you want to be.

There are only two ways to make this kind of bet. The ballsy way and the poor way.

Jeff Bezos did it the ballsy way. He asked himself what he would regret more, doing it or not doing it. And it helps that he's a crazy bastard, intensely driven and cooly logical. I did it the poor way. I bet everything when I had very little to bet with (I was poor). I had no lifestyle to lose, no debt to pay back and no savings to miss. With nothing to lose, I had everything to gain.

I jumped from that bridge in Costa Rica. That was months after I had already gone all-in with my life and sold my first company. After that, bungee jumping seemed too trivial for any second thoughts.

Sunday, April 8, 2012

The way we do product development

Our app, Skyvi, released a few months ago, has over 1.5 million downloads and our user base is growing strongly with every update. Skyvi is far from the first product we built. In fact, in the past 4+ years, my partner and I built over 20 products, and most were flops and some are too embarrassing to even list by name. But through those experiences, we developed a methodology to do product development that we believe is correct. And today, I'm sharing it.

The first step, also the hardest to get right, is knowing what to build. This one took us forever to learn because we are engineers. In the beginning, we just built stuff, all kinds of stuff, and it was easy for us. We didn't know if it was going to work, but since it only takes a week for us to build it, it didn't seem like it was going to hurt to try. But it does hurt. Experimentation is sometimes necessary, but it's never an excuse for not thinking. In the beginning we were building very simple products and it can take a week or so. But as things got more complicated, it started to take longer. Our last flop, cost us almost six months! Six months! How many six months do you have in your life? Tell me that's not expensive! So, everything we build now, we think hard about what we're going to build first. An engineer's habit of just going out and build things is very difficult to break. But I believe breaking that habit is absolutely necessary.

The next step we do is to try and estimate feature effectiveness. I think this is quite unique to the way we do things. Suppose a feature is going to say, increase revenues, we explicitly state the amount that the revenue is going to increase by this feature. This may sound impossible to anyone who hasn't tried it, but I assure you, it's very possible. This step forces us to break down the feature from the user's perspective. If we don't know something, we reduce it to something we do know. For example, if we have no idea how many people are going to pay to remove ads, we can break it down into steps based on the feature. How many people are going to see the "remove ads" button? How many are going to click on it? How many are going to click through to the in-app purchase link? How many are going to have a google checkout account? How many are going to finish purchase? We try to find comparable data from our current product, other similar products, and our best guesses at each of these questions. Plug it all in and multiply, out comes your estimate. The more we do this, the better we are at answering these types of questions.

Building the product is what we do best, but it is still not easy. Sometimes a feature is actually several smaller features. They need to be thought through, individually and in aggregate. In a team environment we have used scrum to manage the actual development, but when it's just my partner and I on the project, we use a much lighter weight solution. We cut aggressively. If there's a feature that we think only marginally help with our business objective, and it takes disproportionate time, it won't make it. Proper prioritization is key and everyone agrees on and sticks to the prioritized list. Hitting deadline is absolutely essential, and we don't miss. There's nothing worse than having a great idea, and get usurped in the market because you blew your dev schedule. This is also the step that is the most parallelizable with a team.

After the product or feature is built, it's not quite ready to go out yet. It needs to be tweaked. Product tweaking is a black art and is a specialty of my partner's. He has a very keen nose to sniff out which part of the product needs minor touch ups. Maybe the error messages should to be re-worded, or the activated version of the mic button needs a textured background. I hate this step, because I have no patience for it and the engineering is neither interesting nor particularly challenging. But it's absolutely necessary to take the product from good to great. It's awesome if there's someone on the product team that's especially good at this. All you have to do is give them a few days to do it and don't get in their way. But if you don't have a tweaker on board, time box this step and do as much tweaking as you can.

Lastly, after the product launches, we must measure feature effectiveness. You are collecting data, aren't you? If you don't know if your bullet struck the target, why the hell do you even bother to aim? So, in step two we made estimates, and now we check how close reality is to our estimates. From this, we can see either the feature did exactly what we set it out to do, or a faulty assumption exists somewhere in the chain. And we would know exactly which link of the chain to blame and do better next time. For the last few months, we've found ourselves being able to confirm our prior estimates. To us, it implies that we're getting better.

Not every product you build is going to work in reality. The challenge in product development is to make sure that when a product doesn't work, the fault should be in an assumption that lead up to the product, and not in the product itself. In other words, the product does exactly what it is supposed to do, well made, minimally viable, and released on time. The product failed because people just didn't care for the problem it solved for them. That my friends, is a separate problem all to itself...

Sunday, February 12, 2012

What Jeremy Lin should teach Asian-Americans

We can safely assume the feel-good story of the year is the meteoric rise of Jeremy Lin from bench warming D-leaguer to the NBA record books in the span of a week. His story is indeed inspirational. A talent that is so long ignored, suddenly blossoms in the prototypical american dream fashion, and captivates a nation and the world in the process. What's there not to love?

But deeper down there's a much more interesting issue, one that is not so comfortably talked about in a sports bar. Jeremy's rise is all the more surprising because he is Asian. He had to deal with stereotypes and discriminations both overt and otherwise during his entire career. It probably contributed a large part to him being ignored for so long.

Today, I read an article about how Asian-Americans are all cheering for him because they finally found a star that they could relate. The final sentence struck me as profoundly telling:

There was a pause in the conversation. Daniel Chao spoke up. "I mean," he said, in a slightly stunned voice, "an Asian-American dunked."

Why is Daniel Chao surprised? Of course, I don't mean to single out Mr. Chao, but the question remains. In other words, why are Asian-Americans surprised that one of us can dunk?

Stereotypes such as Asian-Americans are bad at sports, or that we are all nerdy or that we can't sing are already fait accompli. We cannot do anything about the fact that stereotypes exist. What we can do is choose to break these stereotypes. It always takes a few pioneers to show us the way. Jeremy Lin certainly never doubted that he could dunk, otherwise he couldn't have gotten so good at basketball. Sure there's natural talent in him, but talent is nothing if not molded by endless hours of practice.

Stereotypes are dangerous, but doubly more so when we, the people stereotyped, start to believe in it ourselves. Should we be surprised if tomorrow a Korean-American R&B songtress wins a grammy, or a Japanese-American quarterback leads his team to the NCAA championships? They would be the firsts, the pioneers, the change makers, just like Jeremy Lin became this week. But whatever we do, we should not believe it is not possible just because it has not happened yet.

It is only a matter of time before Asian-Americans break out in sports, music, movies and business. Let's not be surprised anymore. We are individuals with individual talents. We just need to believe in ourselves more and pursue our dreams with guts and heart. The operating mentality should be: if it hasn't been done before, then I'll be the first. It's working out pretty well for Jeremy.

Wednesday, November 9, 2011

Voting for the very first time

Two nights ago, I voted for the first time in my life.

I left Canada when I was 17, before I could legally vote. For the next eleven years, I could not vote in American elections, so I watched helplessly as George W. won against Al, then hopefully as Barack cruised to the Oval Office. I became an American citizen almost 18 months ago, and missed last year's elections because I was traveling in Southeast Asia.

This year, I have no more excuses. As elections go, the San Francisco mayoral election is rather small and insignificant. The mayor can't do much to fix the economy, can't order men to bomb foreign lands, and only tangentially affect the lives of half a million or so people. I don't know much about the candidates, and have even less knowledge about the ballot measures. So I wondered, how much is my vote really going to matter? And if I vote without knowing about what I'm voting for, is it better than not voting at all?

So the night before election day, I sat in front of my computer with my mail-in ballot and downloaded the voters pamphlet from the city's election website. Pamphlet is a misnomer, since it is 187 pages long, but I gave myself an hour to figure out the personalities and issues.

I was pleasantly surprised at the quality of the voters pamphlet. The first section outlined the format of the elections and how to fill out the multiple choice ballot. The second section introduced the candidates for the three posts up for election (Mayor, District Attorney and Sheriff). There were many candidates for mayor, some with more experience than others, a few are just plain crazy (it is San Francisco after all). The next part, also the most helpful section, detailed the ballot measures. For each measure, the election committee gave a non-opinionated background on what the issue is about, then the controller gave a statement on how much the measure would impact city finances and taxation. Then the proponents and opponents gave written arguments and rebuttals, followed by paid endorsements either for or against the measure by various groups ranging from concerned citizens to the Sierra club and Republican party. Reading through these arguments actually gave me much clarity on the issues and allowed me to form my own opinions. The last section of the pamphlet consisted of actual legal wording of the ballot measures, which I didn't bother reading.

I was done within an hour. I believe I had at least 80% understanding of the issues and problems. Sometimes it was difficult to decide, and I wish I had more time to research the issue. For example, I had to weigh the ballot measure on increasing sales tax 0.5% to pay for some city services against a bond measure to do maintenance on our streets. I ended up voting for one and not the other, but it wasn't an easy decision.

And this was the interesting part. Because I took time to read through the pamphlet, I actually cared. This is why the decisions weren't easy. I felt responsible. My vote may not have mattered much among the hundreds of thousands of votes casted, and I may not have made the best decision possible, but through the act of voting, I better understood the complexities of the issues facing my city today. Thus, participation is the most important part of democracy.

I'm a believer now. It only take an hour to be informed enough to vote. The difference is between ignorance and responsibility. The trade-off is well worth it.

Monday, October 24, 2011

I am the egg

Today, flying across my Facebook feed, someone I barely knew, that I met ever briefly, so long ago, posted a link. And it spoke to me in a very meaningful way.

The post was Haruki Murakami's acceptance speech when he won the Jerusalem Prize back in 2009. He delivered a simple personal message, the one thing that he keeps in his mind when he writes fiction. He said,

Between a high, solid wall and an egg that breaks against it, I will always stand on the side of the egg.

In the metaphor, the "high, solid wall" is the System, and the "egg that breaks against it" is the individual. There are many ways the System manifest itself. This takes on meaning both on the greater world stage and in my own humble existence.

In Libya, the system was an authoritarian dictator who for 42 years ruled by violence, persecution and fear. The eggs are the thousands of people, students, farmers and tradesmen that rose against it.

In Zuccotti Park, the system is the impersonal financial and political hegemony maintained by the rich and powerful. The eggs are the laid off workers who have no more to lose, the middle class that watched their dreams squashed, and the retirees whose pension is worth less by the day.

And in my life, as an entrepreneur, the system represents big corporations, other startups with a lot more funding and clout, and users with their established habits and resistance. Up against all that, is me. I am the egg.

I've been smashed against this wall before. But there is hope, there's always hope. If the events in Libya is any indication, sometimes the egg can be stronger than the wall.

Tuesday, September 13, 2011

Reflections on Humbert Humbert

Recently, I finished Lolita, Nabokov's masterpiece, his quiet yet disturbing demonstration to the world of his power as a prose writer and mastery as a story teller. Had I read it just a few years earlier, the full force and majesty of the novel would have totally escaped me. Not to say that I am either, but I believe the enjoyment of Lolita increases exponentially with the reader's emotional and philosophical maturity.

Most people are familiar with the subject matter of this novel. A 40-something hebephile Humbert Humbert has a carnal relationship with a 12 year-old Dolores Haze, his Lolita, Lola, Lo. In sexually conservative America, this book stabs through the fabric of societal mores and became famous and infamous because of it. But there's something more to this novel than just the shocking, lewd, and obscene subject matter. It is an illuminating examination of a shadowy recess of the human condition.

The story told in the first person does not make Humbert a sympathetic antihero, rather it makes him understandable. We understand why he does what he does, but there is nothing to mask his ugliness as a human being. He is contemptuous of everyone except himself and Lo. This contempt is spread all around to his ex-wife Valeria ("brainless baba"), to his landlady Charlotte ("big Haze"), and even to his friend and chess buddy Gaston ("glum repulsive fat old invert"). No one is spared his venom, yet no one knows its sting, because what he thinks he does not say. Humbert is a coward who fancies himself otherwise. When his ex-wife left him, he thought of "hurting her very horribly", but found that "impossible to put into execution with the cursed colonel hovering around all the time". In short, Humbert will strike a woman, but will not risk a confrontation with another man.

The most revealing aspect of Humbert is, without a doubt, his dysfunctional relationship with Lolita. It cannot be accurately described as a love. Humbert paints to great length of how he ached for her, longed for her, and desired to possess her. What troubled me was that his love was all physical.

There my beauty lay down on her stomach, showing me, showing the thousand eyes wide open in my eyed blood, her slightly raised shoulder blades, and the bloom along the incurvation of her spine, and the swelling of her tense narrow nates clothed in black, and the seaside of her schoolgirl thighs.

Humbert loves Lo not as a man loves a woman, but as a man who loves his own lust. His love is the pinnacle of selfishness. He tries to fill two roles for Lo, that of the guardian (Lo calls him "dad") and that of the lover. He utterly fails at both. When he tries to be a good step father, he invariably becomes consumed and succumbs to his desires. His inability to make Lolita fall in love with him also makes him a failed lover. He admits that Lo has never "convulsed" during their intercourse and yet he has had "two years of monstrous indulgence". It took a long time, years after his relationship with Lo had ended, before Humbert found clarity in the most beautifully written (and longest) sentence of the entire novel.

... I simply did not know a thing about my darling's mind and that quite possibly, behind the awful juvenile cliches, there was a garden and a twilight, and a palace gate -- dim and adorable regions which happened to be lucidly and absolutely forbidden to me, in my polluted rags and miserable convulsions; for I often noticed that living as we did, she and I, in a world of total evil, we would become strangely embarrassed whenever I tried to discuss something she and an older friend, she and a parent, she and a real healthy sweetheart... might have discussed -- an abstract idea, a painting, stippled Hopkins or shorn Baudelaire, God or Shakespeare, anything of a genuine kind.

That was the only redeeming quality of Humbert: the flashes of honesty he often writes of himself. It is only through these tiny viewports that we shine the light on his and Lola's inner condition.

I don't blame Humbert for his predilection towards his nymphets, because it is a preference. Just as some are attracted to buxom blondes and others to skinny red-heads, Humbert has his peculiar preference. This brings me to an interesting philosophical thought experiment. If my preferences were a little different, would I become a hebephile too? Is the difference between me and Humbert merely a difference of taste? I admit, this question bothered me as I read the novel, but at the end I reached my conclusion. The key difference of Humbert and the rest of us is not a matter of preference, but a matter of control. Humbert is a slave to his desire, to his lust. The rest of us, too, full of desire and lust, are, for the most part, able to control them and harness them towards love and self-improvement instead of having them control us and destroy us and all those around us in the process.

Monday, August 22, 2011

Second Thoughts about Obama

I, like many people of my age, was caught up by Obamania three years ago. But lately, I have seen enough. My opinion has turned decidedly negative, and I know I'm not the only one.

As a progressive, I have read Obama's books and listened to his speeches, and know that deep down, he is intelligent and true to his beliefs. But if only that were enough to be an effective leader! Now it seems to me that he's better suited to be a college professor, inspiring young men and women to change the world, than to be the leader of the most powerful country on earth and lead the change himself.

We have made enough excuses on his behalf already. Yes, he inherited the worst economic recession in two generations and two unpopular wars on the far side of the world. Yes, the republicans hate him, for his ideas, for his care, for his name, and for his birth certificate. Yes, there are disasters economic, natural, and man-made around every corner. I don't blame him for the things he can't control, but he must take responsibility for the things that he can control and failed to do so.

Obama's high minded ideals are no match for the mud wrestling nature of realpolitik. I while applaud his initial efforts at bipartisanship, it is obviously not going to fly. The Republicans has not, is not, and will never, play ball with him. But Obama's refusal to swing the shovel is damaging not only the standing of the administration, but also the entire progressive agenda. I don't blame the Republicans for acting like IQ-challenged douche bags; they have been consistently that way for years. They spew the same vitriol and espouse the same inane policies as they always have. But instead of forcing the Republicans into a corner and effectively ending them as a viable political force, Obama's conciliatory approach has only lengthened the pain period for everyone.

I do believe that the Republican's shelf life is limited. Lincoln (ironically, a Republican) famously said that "you can fool some of the people all the time, all the people some of the time, but never all the people all the time." Eventually America will realize that living standards have not increased in more than a decade, unemployment will never fall below 7% again, and science doesn't care if you believe in it or not. A party that is against change is against the universe. A party for the top 5% will be surrounded by 95% enemies. The demise of the Republican party will not mean the demise of dissent and differing opinions. It just means the demise of stupid opinions.

If Clausewitz is to be believed, that "war is an extension of politics", then we must also conclude that politics is a lot like war. And this war is best fought if the enemy is defeated quickly. This way, we can stop slugging at each other and contemplating hari-kiri with our debt ceiling, and get back to solving problems that matter. Unfortunately, Obama has shown time and again that he is unwilling or unable to do the dirty deeds. In war, this means killing. In politics, it means using leverage until it hurts. Yes, he may gain a few more enemies by doing that, but considering he has plenty already, it shouldn't matter at all. On the other hand, he will inspire and motivate millions to fight on his side.

Unfortunately, I don't believe Obama is the man for the job. If Hilary had won the primary instead, we may have a chance. She seems to have the political experience and the balls for this kind of task.

Come election day, unless Huntsman gets nominated via Devine intervention, I think I'm just going to sit this one out.

Monday, August 1, 2011

Smart woman and wise words from 320 years ago

In 1691, a nun living in Mexico City (then under the Spanish Crown), wrote a long letter. Her words echoed for 320 years, and finally found their way to me this weekend, proving once again that S/he who writes well, lives forever.

Sister Juana Ines de la Cruz was a prodigy, but born of the wrong sex (or the right one from my perspective). At a time where educated women were practically nonexistant, a woman with curiosity and intellect is frowned upon, discouraged, and ridiculed. Sister Juana is one of the first feminist, a feminist by example. Although three centuries later, women's rights have advanced light years since her time, we still find that men feel more threatened by a smart woman than by a pretty one.

The letter Reply to Sister Filotea, is one part apology, one part autobiography, and one part argument against the status quo. Her writing rivals and even surpasses the best writers of her day. Her shewed arguments quoting everything from the Bible to classical texts from Greek and Latin, demonstrates the depth of her learning while her use of both logical arguments and rhetoric skills demonstrates the quickness of her wit.

In the letter she detailed how in her childhood she secretly learned to read at the age of 3, and her insatiable appetite for knowledge drives her inexorably towards learning. Apart from the woman who taught her how to read and write, she had no formal schooling since her parents rejected her idea of dressing up as a boy to attend school. Instead, she learned by herself, from books.

But what may be offered as an exoneration is that I undertook this great task without benefit of teacher, or fellow students with whom to confer and discuss, having for a master no other than a mute book, and for a colleague, an insentient inkwell...

The desire to learn is so strong within her, she thought of nothing else. At her time, the only path available to her is to become a nun, so that she can devote the most amount of time to learning and reading.

Her intelligence is such that she did achieve quite a bit of fame in her time. However it was not, in her words, [sailing] before the wind across calm seas for her as there were a number of aroused vipers, hissing their emulations and their persecutions. Of these persecutions she writes:

Whatever eminence, whether that of dignity, nobility, riches, beauty, or science, must suffer this burden; but the eminence that undergoes the most severe attack is that of reason... because it is the most defenseless, for riches and power strikes out against those who dare attack them; but not so reason, for while it is the greater it is more modest and long-suffering, and defends itself less...

And of those who attacks her, she writes:

One will abide, and will confess that another is nobler than he, that another is richer, more handsome, and even that he is more learned, but that another is richer in reason scarecely any will confess: Rare is he who will concede genius. That is why the assault against this virtue works to such profit.

A large part of the letter was devoted to arguing for the education of women. She argues that to properly understand the Bible, women will have to be taught languages, music, geometry, history, architecture, etc. And retorts, from a theological point of view, the words of the Apostle: Let women keep silence in the churches, does not prohibit women from learning and being taught in private. Furthermore, she shrewedly expounds:

... not only women, who are held to be so inept, but also men, who merely for being men believe they are wise, should be prohibited from interpreting the Sacred Word if they are not learned and virtuous and of gentle and well-inclined natures... For there are many who study but are ignorant, especially those who are in spirit arrogant, troubled and proud...

She also cites numerous examples of learned women in bibliocal, mythological, and historical examples, and these women of intelligence are both revered and respected. Afterwards she presents a very logical argument (given her time and values), for the education of women:

... because of the considerable idleness to which our poor women have been relegated, if a father desires to provide his daughters with more than ordinary learning, he is forced by necessity, and by the absence of wise elder women, to bring men to teach the skills... from which no little harm results, as is experienced every day in doleful example of perilous association... as that of familiarity with men, which quandary could be prevented if there were learned elder women...

Finally Sister Juana concludes that in the end, all her struggles have made her better instead of worse. She writes:

... I fear applause more than calumny, because the latter, with but the simple act of patience becomes gain, while the former requires many acts of reflection and humility and proper recognition so that it not become harm.

It never ceases to amaze me that her wisdom is as valid today as the day it was written. And her style of writing, is as fluid and graceful now as it was 320 years ago. In a single letter three centuries past Sister Juana proved that progress of humanity starts with the equality of the sexes.