27 August 2013

Who is the bad guy?

Following started as a comment, but at some point I lost it, and it became as big as a blog post.
Inspired by Secretary of State John Kerry: Use of Chemical Weapons in Syria 'Undeniable'
Damn politics...

To me it looks screams like another revolution made by USA in order to change uncooperating government. They give rebels weapons and now they frame Assad and use their powerful media to present it in a fitting color.

We've already seen such thing in Georgian-Abkhazian conflict, where murderous georgians backed up by NATO weapons invaded Abhkazia. After Russia intervened to stop the agressor US propaganda showed it's true face, saying that Russians were killing Georgians.

I vividly remember video that a few years ago enraged me and my fellow countryman.
It was both sad and funny to look at a girl with her aunt, who were victims, invited for an interview to Fox News(*). All US media was saying that Russia attacked Georgia and was showing burned city, saying it was Georgian city bombed by Russians. When in fact it was Abhkazian city bombed by Georgians. Girl's aunt only agreed to this interview knowing it was live so it could not be censored. And when the time came she said thank you Russians who saved US, it was Georgian who were killing people - thing contradictory to what media was saying. And after this words unusualy long commercial break happened.

I know it's not all black and white, but more and more it looks like the bad guys are not the Muslims or whatever, but the evil plotting US government. They surely have a grasp on media, you can't deny that.

... and yeah, it's a frickin Russian flag on my avatar... So it's biased. But in no way do I support my own government, simply proud of my history, and IMHO it's the lesser of two evils

(*) Interview
Aunt afterwards describing what US media was presenting (with ENG subtitles)

22 August 2013

Private testing

If you do testing, then, like me, at one time you probably came up with a question "How do I test private methods?". The tricky part about private testing in static languages like java, is that you can't access private methods from outside.

There are couple of ways to test private methods. You can do it through reflection, you can easily find libraries which ease the syntactic pain. Or you can make it package-private, this way you can use them in your tests, but users of your library still can't see it (though it can turn your own package into a tangled mess).

And both things are WRONG! And many people know it. Go to stack overflow and you will see lot of upvoted results, how it is "implementation detail, don't test it".

In my opinion, you should test this kind of methods. If you closed your IDE/Editor of choice and opened Google, then chances are it's important enough to have a unit test. Do you smell it? I certainly do... And it's coming from your code!

If you want to test it - then it's important, if it's important, than why isn't it in your public API? Because class users don't care about, it's not class's responsibility. If it's not your class responsibility then go create a new one. Now you can test it all you want and then refer to it from the original class. Noisy teenager moved out from parents and has a separate life, the end.

At first glance people who use Ruby, Python and other dynamic languages without a strong notion of privacy are happily neglected to this problem. You can use private methods as easy as the ones that intended to be public. That's actually very scary. In Java on every method creation you have to decide whether it's private or public. If you don't have to do this you might end up with a bunch of monster classes (been there, done that, not proud of it).

21 August 2013

Technology whirlwind

Ok, I've had this on my mind and up my ass for some time.

Today around you there's too many technologies, programming languages and frameworks! I remember my school days and passion about Pascal and Delphi, all the assignments in information technology class, the way I would optimize these little quizzes... A lot of great memories.

But then I went to university, got familiar with C#, and things started boggling me. Is it used in real life apps? What's beyond C#? Where can I find work and what skills do I need? And really at that time for there was no answer to the question "What do I do next?".

And so my mind kind of stranded off programming. University classes were useless and had not a single hint of real life applicability. So there's was no use in studying hard. All I did is studied just enough pass next exam and then play computer games and football.

However, as I got lazy and dispassionate, another thing really have blossomed - The Internet! After serious football injury there was a lot of time to contemplate and what I've stumbled upon really changed the flow of my life. Suddenly, I was in a land of opportunity!

At first I got familiar with Java and it looked like every company wanted a Java developer: Netcracker, Haulmont, EPAM, Magento. Another ones offered mobile iOS and PHP jobs (never was into that kind of stuff). About half a year later I familiarized myself with Ruby and RoR by completing 2 online MOOC courses from EDX, and oh... my... God... it blew my head right off! Than I started practicing TDD and a little bit of Python. Than I got passionate about Scala. Got a better at HTML, CSS and JS... and...

There's so... many... freakin'... technologies! With the availability that Internet provides you can learn any of them. Every technology comes with a different style, different community and a viable awesome career path.

And it gets better worse every year. Right now I work as a Java dev, but after graduation I will want that to change.

We are in technology Whirlwind, so dizzy and captivating it is.

Hello Blog

Greetings, guys and gals(who am I kidding?), guess what, now I have a blog!

As of now now it looks kind of ugly and... empty. But it seems you can fully customize it (even javascript).
On the other hand I'm too lazy and empty is good. There's Russian saying:

"Conciseness is a sister of talent"
...on this note this post shall end.