Agile FAQs
  About   Slides   Home  

 
Managed Chaos
Naresh Jain's Random Thoughts on Software Development and Adventure Sports
     
`
 
RSS Feed
Recent Thoughts
Tags
Recent Comments

Archive for the ‘Programming Languages’ Category

Eclipse Summit India 2016 – by the community for the community!

Friday, August 5th, 2016

Year 2016 is special for Eclipse users and community in India – we have the first ever conference focused on Eclipse Technologies, Eclipse Summit India, scheduled for Aug 25th to 27th in Bangalore at the Hotel Chancery Pavilion. Eclipse Summit India is being organized in collaboration with the Eclipse Foundation and will feature some of the best speakers from the past EclipseCon conferences around the world.

In 2010, we organized the first “Eclipse Day” – a day for the Eclipse community in Bangalore to get together and share expertise. We still remember that day at a small but cozy hotel on Infantry Road in Bangalore, when we kicked off the very first “Eclipse Day” in India. We followed the tradition in 2011, when SAP came forward to organize it in their campus. There were two more Eclipse Day editions in Bangalore in subsequent years – one organized at IBM and the other one at BOSCH. Each year we raised the bar in terms of content as well as participation. Thus the idea of Eclipse Summit was born!

Eclipse Summit India 2016

The conference is spread across 3 days – Thursday, Friday and Saturday. Day-1, Thursday, is dedicated for pre-conference paid workshops. We have lined up 4 workshops by technical leaders in Eclipse space in some of the key Eclipse technologies – Eclipse IoT, Eclipse e4 Platform, Eclipse JDT and Eclipse Modeling Framework. The next two days are dedicated for conference tracks – we have two tracks each on Friday and Saturday. On each of the days, we kick off the proceedings with keynotes by thought leaders in the Industry.

On Friday, we are privileged to have Mike Milinkovich, Executive Director of Eclipse Foundation deliver the Keynote. On Saturday, we have two keynotes – Sumit Rao, VP of Engineering at Cerner Corporation, as the first keynote speaker and Viral Shah, co-creator of the Julia Language as the second keynote speaker. You can find the complete program here: https://confengine.com/eclipse-summit-2016/schedule/rich

Friday Aug 26th, we have two tracks – one focusing on Language Runtime (Java, Node.js, Mobile) and the other on Eclipse IoT Technology. We are fortunate to have leaders from each of these areas – Srikanth Sankaran, whose talks at past EclipseCon were rated amongst the best, will take us through the evolution of Java beyond Java-9, while Benjamin Cabé, Eclipse IoT expert at Eclipse Foundation will unveil the power of Eclipse IoT technologies. These talks are followed by a variety of talks and demonstrations that will expose you to the latest developments and trends in these areas.

On Saturday, the event continues with the focus on language technologies in one of the tracks, while Eclipse Platform focus on the other track. In the language track, Stephan Hermann, Java language guru, will take you through the dynamism in Java language while in the platform track, we have Prouvost, an expert on Eclipse e4 Platform unraveling the mystery of e4. Don’t know what e4 is? Well, now you have a reason to not miss this!

Eclipse Summit India is a conference organized by the Eclipse community for the community. Organizers have done their bit in lining up some of the eminent speakers, who are experts in their own domains. Now it is your, Eclipse community’s – turn, to contribute to it by actively participating to make it a success. Eagerly looking forward to meet you all at the conference!

We’ve last few seats left, register here: https://confengine.com/eclipse-summit-2016/register

Duplicate Code and Ceremony in Java

Thursday, July 21st, 2011

How would you kill this duplication in a strongly typed, static language like Java?

private int calculateAveragePreviousPercentageComplete() {
    int result = 0;
    for (StudentActivityByAlbum activity : activities)
        result += activity.getPreviousPercentageCompleted();
    return result / activities.size();
}
 
private int calculateAverageCurrentPercentageComplete() {
    int result = 0;
    for (StudentActivityByAlbum activity : activities)
        result += activity.getPercentageCompleted();
    return result / activities.size();
}
 
private int calculateAverageProgressPercentage() {
    int result = 0;
    for (StudentActivityByAlbum activity : activities)
        result += activity.getProgressPercentage();
    return result / activities.size();
}

Here is my horrible solution:

private int calculateAveragePreviousPercentageComplete() {
    return new Average(activities) {
        public int value(StudentActivityByAlbum activity) {
            return activity.getPreviousPercentageCompleted();
        }
    }.result;
}
 
private int calculateAverageCurrentPercentageComplete() {
    return new Average(activities) {
        public int value(StudentActivityByAlbum activity) {
            return activity.getPercentageCompleted();
        }
    }.result;
}
 
private int calculateAverageProgressPercentage() {
    return new Average(activities) {
        public int value(StudentActivityByAlbum activity) {
            return activity.getProgressPercentage();
        }
    }.result;
}
 
private static abstract class Average {
    public int result;
 
    public Average(List<StudentActivityByAlbum> activities) {
        int total = 0;
        for (StudentActivityByAlbum activity : activities)
            total += value(activity);
        result = total / activities.size();
    }
 
    protected abstract int value(StudentActivityByAlbum activity);
}

if this were Ruby

@activities.inject(0.0){ |total, activity| total + activity.previous_percentage_completed? } / @activities.size
@activities.inject(0.0){ |total, activity| total + activity.percentage_completed? } / @activities.size
@activities.inject(0.0){ |total, activity| total + activity.progress_percentage? } / @activities.size

or even something more kewler

average_of :previous_percentage_completed?
average_of :percentage_completed?
average_of :progress_percentage?
 
def average_of(message)
	@activities.inject(0.0){ |total, activity| total + activity.send message } / @activities.size
end

Dynamic Typing is NOT Weak Typing

Monday, July 11th, 2011

Till very recently I did not know the clear distinguish between Static/Dynamic and Strong/Weak typing. Thanks to Venkat for enlightening me.

Dynamic typing: Variables’ type declarations are not mandatory and they will be generated/inferred on the fly, by their first use.

Static typing: Variable declarations are mandatory before usage, else results in a compile-time error.

Strong typing: Once a variable is declared as a specific data type, it will be bound to that particular data type. You can explicitly cast the data type though.

Weak typing: Variables are not of a specific data type. However it doesn’t mean that variables are not “bound” to a specific data type. In weakly typed languages, once a block of memory is associated with an object it can be reinterpreted as a different type of object.

One thing I’ve realized, Strong vs. Weak and Dynamic vs. Static is a continuum rather than an absolute measure. For instance, SmallTalk is more strongly typed compared to Python which is more strongly typed than JavaScript.

There seem to be two major lines along which strong/weak typing is defined:

  • The more type coercions (implicit conversions) for built-in operators the language offers, the weaker the typing. (This could also be viewed as more built-in overloading of built-in operators.)
  • The easier it is in a language, or the more ways a language offers, to reinterpret a memory block (associated with a data value) as a different type, the weaker the typing.

In strongly typed languages if you cast to the wrong type, you get a runtime cast exception. While in weakly typed languages, your program might crash if you are lucky. Usually it leads to wrong behavior.

In most static languages you need to specify the data type at declaration. However in languages like Scala, you don’t need to specify the data types, the compiler is smart enough to infer the data types based in the context in which its used.

Also if you don’t have a compiler, then the language is surely dynamic language. However the inverse is not true. For example, Groovy is compiled, yet its a dynamic language.

In Strongly typed Dynamic languages, the type inference is postponed till runtime. This has many advantages:

  • One can achieve greater degree of polymorphism
  • One does not need to keep fighting the compiler by doing trivial type casting
  • One gets greater flexibility by deferring the implementation to a later point. i.e. the actual type verification is postponed to runtime; allowing us to modify the structure of the program between compile time and runtime.

I always thought weakly typed, dynamic language would be a disaster. However both VB and PHP (amongst most popular languages in the last 2 decades) fall into this category.

Having said that, these days I see more and more languages are strongly typed. Also the ability to infer types is gaining a lot of traction.

What do you prefer in your programming language and why?

    Licensed under
Creative Commons License