Opinion

Why do I use twitter

August 1, 2010 Opinion, Personal No comments

Follow me on Twitter!

I saw guys, who bought T-shirts with inscription like “Follow me on twitter @andriybuday”. These weekend I’ve been on Rock Fest in Slavske and I did something more original. Take a look:

Not so long ago I created my twitter account. Indeed it brings me some value and I get fun with it. But many people get interested how that rubbish could bring any value for me or either someone else. Couple of my friends are really concerned about it and even laugh.

Which kind of value does it bring?

I decide whom to follow, this way I consequently decide which kind of information I will get. So if I’m following some programming guys, I obviously get bombarded with information on programming. The more information I get – the more information I process – the more value it brings. The only one important restriction is that information have to be useful.

So whom do I follow?

I follow lot of MVPs on .NET(C#) and other geeks, this way I get information about new technologies and opinion on them provided directly from best professionals around the world.

Also I follow twitter accounts of different interesting sites/organizations on programming. This way I instantly get information when new podcast is ready and I can immediately start downloading it for my listening. Also I’m informed if some new versions of some products are available. For example I get information that NHibernate 3.0 Preview is available. Please notice that since I’m following those, whom I chose, I do not get information about new version of Photoshop or something like that.

I follow friends and local programmers. Actually most of my friends are developers, but anyway following them keeps me informed about their interests and allows me know what do they do.

Also I follow just few News accounts to be informed about events from real non-virtual world.

Whom do I not follow?

Different bullshit first of all, then accounts that post advertisements, those who posts on not interested for me themes. I do not follow or start unfollowing accounts, from which I get twits too often or who mix good stuff and advertisements.

How do I decide whom to follow?

Decision if I should follow someone I make taking into consideration his/her/its top 10-20 posts, if there is no more than 50-60% information on tech or something I’m interested to get from that account I do not follow that account.

What do I tweet?

Of course information that is similar to information that I would like to hear from others. It is different links on programming, my opinions on some technologies or my thoughts on stuff I use right in the moment of tweeting. I also share my personal success notes like passing some MS exam or like fixing ugly bug related to some technology.

Reasons why I do use twitter

  1. I get valuable information from known professional around the world
  2. I get technology news and instantly can respond to them
  3. I share my opinions, thoughts and could get response
  4. I get introduced to famous developers
  5. I make my blog known using twitter
  6. My tweets are across other social networking (like LinkedIn), so people who do not have twitter also know what do I do
  7. Simply getting more closer to my goal of being known community developer

Concern about the time it takes

Yes, indeed twitter takes some time on responses and tweeting and it could even take away your concentration on work. So where from do I take this time? I would say: I do not IM others uselessly and I do not spent my time on youtube or other entertainments during the work, so I think that having few tweets per day is ok, taking into account the value it brings to me.

You decide your own if twitter is something for you or not.


No comments


Moving C# code to Java

May 9, 2010 C#, Java, MasterDiploma, Opinion 4 comments

Is CLR worse than JVM or it is just because my code is bad?

Today I had conversation with one man, who is great defender and evangelist of Java related technologies.

We talked about some algorithm implemented by me with C#. That is implementation of SOM algorithm and Concurrency stuff for it. My concurrency implementation doesn’t show time improvements unless grid size is big. He was able to achive better result with small grid sizes.

There could mean two reasons:

  • CLR concurrency model gives up in front of JVM concurrency
  • My implementation has gaps… which is more likely :)

Taking into consideration that I’m getting better results when grid is of bigger sizes I could suppose that in my algorithm there is code which takes constant (or near that) time and is not paralleled.

When I look at picture of Task Manager when my programm is executing I see that second processor has  gaps when it does nothing:

This could mean only one: I need to take better look what else is executed in one thread in my application and could be paralleled.

Converting C# code to Java

But back to that man and Java. I said to myself that it is possible to move my code to Java if something.

C# to Java Converter

Download C# to Java Converter demo version from here. Since it is demo you could not convert more than 1000 lines of your code. Order costs 119$.
Because of that I was forced to remove all not necessary code. I removed all concrete classes that I’m not using and GUI, but that did not help. I did not know how much should I delete more.

Number of lines in my project/solution

I googled for line numbers in C# and found this nice tool:

Now I know that my program has about 4000 lines of code. I left about 980 lines of code in two projects that I needed and was porting them to Java separately.

Converter GUI

And converted them to Java:

Is conversion an easy task?

Conversion could be painful if you have a lot of code that interacts with system, like threads, reading and writing to files, reading configuration file, etc.

Also it was not able to recognize ‘var’ keyword. It shows me this:

//C#
TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing
in Java:

var neuronsCount =
getNetwork().getNeurons().size();

I moved back to my C# code and changed all var to the explicit types. And regenerated Java code.

There were some troubles when I’m delivering from List<T> and doing some stuff around that.
This code:

                int a =
this[next];
                this[next] = this[i];
                this[i] = a;

I rewrote manually to:

                int a =
super.get(next);
                super.set(next, super.get(i));
                super.set(i, a);

Also Converter was not able to convert this:

Console.ReadKey();

The biggest challenge is ThreadPool and synchronizing threads tech-nicks. This requires lot of google search that shows me that instead of ManualResetEvent I could use CyclicBarrier and how to utilize thread queuing in Java.

P/S I need to find gaps in my code to show that at least CLR and myself are not so much bad things in this world :)


4 comments


My presentation on the Service Oriented Architecture

April 23, 2010 Opinion, SOA, Success 4 comments

Yesterday I executed my presentation on the Service Oriented Architecture. It was awesome. I got good portion of emotions.

People

I was really surprised how many people have come to listen to me. As per me it was supposed that this local Architecture Group (AG) is for couple of people, who have desire to spend their free time on talking about SOA, but for my great surprise almost all team came, I mean developers from whole enterprise project where I work. Guys, there should be something that I don’t know about intent of this group?

Rehearsal

Before presentation I as usual did my rehearsal. First it was presenting to my friend, who is also developer. We call this ‘Turbulent Developers Community‘ where we sit in the evening with beer and talk about different interesting IT things. So he brought few interesting questions for which I was now ready to respond. Also, I had my *.ppt at my phone, so when getting to my work I was trying to replay presentation in my mind. І на останок, вже безпосередньо перед презентацією я розказав її своїй дівчині в скороченому режимі – це зайняло близько 20 хвилин. Дуже тобі дякую за це!

Presentation

So, I started with plan which I have in this blog post. People were listening with attention and that is very appreciating. Also, what was enjoyable is that they had a lot of different comments on what about I was talking. They even spoke to 3 of my slides instead of my… OMG.

How was it?

… asked I, and got an answer: “It’s a great success! … can we now get money out of that?.. :)”. Those are words of my colleague with whom I work on the same piece of software. I really hope that other also enjoyed what I did.

Conclusion

For myself I have discovered that I learnt more about how to provide a good presentation. I do not say that this is my best presentation. I this the best I had is presentation on DDD, but anyway… having more experience in that area is very good achievement.

Keep in mind – you will die someday

What is the intent of my life? I spend my life at work, so that is a very big part of it. If above said it truth, why don’t then do the best at work and in your growth? For me it is mandatory. If you don’t like you work – just change it. Just do it!

Everyone have to die some day. Think about what you do and what you want to achieve. Have super large dreams. Often why I’m getting to the work at town vehicle many people talks and as I understand the intent of their life it to find a good job, to have a car, home and family. I don’t say that family is bad, BUT why to put such trivial task in front of you? You have one life and then death!


4 comments


Code Complete – Classes, Methods, Defence Programming

March 21, 2010 Book Reviews, Clean Code, Opinion No comments

Yesterday I’ve read 3 chapters of the “Code Complete“. First one of them was a “Classes” and second was “Methods”. I would say that I took almost nothing for myself from those pages, but the third one was “Defense Programming” and it was quite enjoyable to read.

Classes

Class should stand for one logical unit of understanding from real world or from your system. In other worlds it should be noun, that could do some appropriate operations. It is not just a set of data. Also class should have Single Responsibility – not doing things it should not do and not be cohesive to other classes. Class should not contain too much data and too many methods.
After that McConnel talks about the Composition and Inheritance.
Use inheritance when behavior contract is the same and data is the same to some extend, but only concrete behavior differs, but not expectations of it.
Use composition when behavior is 100% the same, but you still could distinguish what you have before and what you would like to have further.
This means that no need to have AccountLessPerson if the person does not have bank account, it definitely better to have Person with field BankAccount.
Liskov Substitution Principle says that once you have class B derived from class A, other classes should work with B by the contract which is the same as A declares, only enhancements to the behavior is allowed, no real change in it.

Methods

It was boring to read this chapter. i.e. methods should have appropriate names, they should not be longer than N lines of code and be readable, they should not take more than 7 parameters, they should not change params, they should not change global fields etc….
It had to be much better to read there more about how methods should interact with other system.

Defence Programming

This was the most interesting part for me. This all is about building the wall of protection to your system. And this is needed to serve two main purposes: first is stability of the system and the second is for insuring correct behavior.
Assert
Assertion is the way to defense your code from wrong input data, and even defensing yourself from giving wrong result. For example in the beginning of method GetOrdersForAccountNumber(int accountNumber) you could have Assert.That(accountNumber > 0, “since you will not be able to make order with wrong number”) and after you finished with all calculations you could have Assert.That(orders != null, “because don’t think that that is good idea to pass out null object…”).
Exception handling
Exceptions is the tool for working with unusual situations that occur in your application. Some languages still don’t have build-in exception handling, and I’m so lucky that I work with such language like C#. McConner says “Develop with language, not on language”, but the C# just leads to writing a good code. Exception handling is quite big theme to discuss so I hope to have separate post on it.


No comments


I Increased posting frequency

January 26, 2010 Opinion, RandomThoughts, Success No comments

I have 18th post this month that is more than in past three months. This means that I increased frequency of posting and I think that did not lost quality of its content. What do you think?

I think I’m good on this. I also increased amount of blogs I read (near 30).

Why do I think that blogging helps me?

  • I’m learning how to express my thoughts.
  • I grab only consistent knowledge on themas of my posts. This means that I do good research over internet before posting something.
  • After I posted something I leave a good knowledge portion left in my mind.
  • My blog will grow and I will get more readers so will be more famous. People needs this sometimes.
  • This blog also could be a good visiting card for my further career.

To get more readers I need to have some certification that my blog is good to read and this could be reached only if I will continue learn something.

I also found one interested post where guy explains why Why Blog Post Frequency Does Not Matter Anymore. Yes, but my blog has defined content boundary and my posts are not something like posts on twitter, so I believe that it will lead me to Success.

BTW: If you are one of the guys who think that I’m too small fish to read my blog I would say: “Follow me and see if you will be so fast all the distance as I will be.”

Honestly I think we should see people in light of theirs attitude to something, but not in light of theirs knowledge of something.

Leave your comment with link to your blog. I will follow you immediately. ;)


No comments


Generics performance vs. non-generics performance

January 22, 2010 .NET, Opinion 7 comments

Today I was reading some book on the .net development and found there interesting thing.

Guy explains “Why to use Generics?
He wrote that Frameworks 1.0 and 1.1 did not support Generics, so developers were using Object.
He says, that generics offers two significant advantages over using the Object class:
1) Reduced run-time errors
That is because type-safety.
2) Improved perfomance
Casting requires boxing and unboxing, which slows performance. Using of Generics doesn’t require casting or boxing, which improves run-time performance.

And then funny thing…
He put a box which looks like:

Real Word
(his name)
I haven’t been able to reproduce the performance benefits of generics;
however, according to Microsoft, generics are faster than using
casting. In practice, casting proved to be several times faster than
using a generic. However, you probably won’t notice performance
differences in your applications. (My tests over 100,000 iterations took only a few seconds.) So you should still use generics because they are type-safe.

OMG! I could not believe in his words. As per me this should be BULLSHIT, unless I 100% missed something there.

Test

I wrote a really quick verification like:

namespace TestGenericsPerfomance
{
    class Program
    {
        internal static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();
            //Working with value objects
            //Generic wins 100%
            stopWatch.Start();
            ArrayList nonGenericArrayList = new ArrayList();
            for (int i = 0; i < 10000000; i++)
            {
                nonGenericArrayList.Add(i);//takes Object so boxing is performed here…
            }
            stopWatch.Stop();
            Console.WriteLine(string.Format(“Int32: ArrayList (boxing): {0:0}”, stopWatch.Elapsed.TotalMilliseconds));
            stopWatch.Restart();
            List<Int32> someCustomersIds = new List<Int32>();
            for (int i = 0; i < 10000000; i++)
            {
                someCustomersIds.Add(i);
            }
            stopWatch.Stop();
            Console.WriteLine(string.Format(“Int32: List<Int32> (generic): {0:0}”, stopWatch.Elapsed.TotalMilliseconds));
 
            //Working with reference objects
            //Generic still wins, but not so sure..
            Customer sharedCustomer = new Customer();
            stopWatch.Restart();
            ArrayList nonGenericArrayListCustomers = new ArrayList();
            for (int i = 0; i < 10000000; i++)
            {
                nonGenericArrayListCustomers.Add(sharedCustomer);//no boxing.. jut putting the same reference
            }
            stopWatch.Stop();
            Console.WriteLine(string.Format(“Customer: ArrayList (no boxing): {0:0}”, stopWatch.Elapsed.TotalMilliseconds));
            stopWatch.Restart();
            List<Customer> genericBasedOnInterface = new List<Customer>();
            for (int i = 0; i < 10000000; i++)
            {
                genericBasedOnInterface.Add(sharedCustomer);//just put the same reference in generic list
            }
            stopWatch.Stop();
            Console.WriteLine(string.Format(“Customer: List<Customer> (no boxing): {0:0}”, stopWatch.Elapsed.TotalMilliseconds));
        }
        private class Customer
        {
            public string Name = “Andriy Buday”;
            public string Buy(string what)
            {
                return “I’m glad I bought that.”;
            }
        }
    }
}

And the result is:

Int32: ArrayList (boxing): 2443
Int32: List<Int32> (generic): 294
Customer: ArrayList (no boxing): 586
Customer: List<Customer> (no boxing): 315
Press any key to continue . . .

As you see generics are much faster. Also I searched over internet and found a lot of different stuff that says that generics provide better performance.

My Opinion

You would said what kind of book do I read. Is it “C# for Complete Dummy“?
No, that is Microsoft’s training Kit for exam 70-536.
Even if this was a book “C# for Dummy” it should not contain mistakes. And even if this is a book for kids it should not contain wrong thing. Yea.. it could be very simple, but not wrong!

I thought to write e-mail to that guy, but then decided that there is no need in this.

Just be careful when you read books and others thoughts, even mine :)


7 comments