Friday, November 21, 2014

Custom Java Metrics in Eclipse

Recently, a relative inquired if I could provide a tool to calculate custom metrics for java code, so I began search and found an old, but open source plugin for eclipse that does just exactly that- calculate metrics without doing any fluffy stuff.
I took its source code and provided it on github.

I had to do minor changes to make it working quickly, which was to use only the metrics table prospective and hide the views not in use.

Here, the metrics need to be provided with 2 essential things:
  1. The name of metric in the plugin.xml file (which is read by the plugin in the list of metrics to calculate)
  2. Name of the calculator file, which contains the logic used in calculating a specific metric value

The required custom metrics were outlined in a paper that discussed about quality of object oriented design and was academic in nature, so the nature of metrics created is quite simple.

For instance, the metric 'Inheritance Ratio' took the form of following tag in plugin.xml

    name="Inheritance Ratio"

and also mapped its logic via the calculator tag:
    name="Inheritance Ratio"

Next, there is need of simply creating this calculator file and overriding the calculate method. Another thing is to create constants like INHR (in this example) by which the metric and its calculator may communicate during runtime.

So, by piggybacking on this application, I was easily able to provide the metrics tool without worrying anything about the UI and source code management. I plan to finish this quickly and then improve it as per suggestions, which are always welcome!

Tuesday, November 11, 2014

Book Review: High Performance Python

High Performance Python by Micha Gorelick and Ian Ozsvald

To a causal user of python, this book might not seem interesting or handful, but if one is working on an application that desires the maximum effeciency out of computer, no matter how the code is structured, there is a need to go deeper and find out how the code actually works and this starts from knowing how to best write the code that ensures minimum of cpu cycles and ram.
The book starts with an overview of the various data structures and libraries that python offers as well as detailing the internal structure of various computer architecture. It then moves on to profiling and detecting bottlenecks both via memory and cpu cycles. In sucessive chapters, this is further explained as different forms of data structures are discussed. Similarly the performance gains provided by third party libraries like NumPy are discussed in detail, which is a learning experience. The chapter on compilers is also informative - the benefits of compilation depending upon which compiler is chosen. Important concepts like concurrency and multiprocessing are discussed in detail for the I/O and CPU bound problems.
Overall this is a book that you would like to keep in handy as a reference while designing a performant architecture or improving a python based application's response time. For me, this was an eye opener and a reckoner for improving the designg and effeciency of a python application and many concepts were beyond me at times, but I hope to learn more about python internals and this is a book that I will visit in future - to confirm my findings and keep on learning deeper concepts.
Disclaimer: I have been provided a free copy of this book by OReilly under their Blogger review program.

Wednesday, October 29, 2014

Using Hybris for e-commerce

Recently, I had a chance to work on Hybris, which is a private company (now acquired by SAP) offering an application framework with the same name, which is a customizable platform for handling e-commerce B2B and B2C needs. While I was initially skeptical of the framework in the sense that it is not apparently clear how to create an online store like Magento or Spree, but is much more than a CMS that creates a shopping front-end for the user.
Technically, hybris is a framework built on top of spring that runs on a customized tomcat or SpringSource DM Server and uses maven for build automation. While this architecture is carefully thought out, the problem lies with its openness- the community is quite limited and as learners, we are restricted to the hybris wiki and forums. Given the evolving nature of the application (different versions come frequent and fast), opening it up would make a lot of sense. As SAP recently acquired Hybris, it may provide integration with its tools and databases in future as well as provide forums and community support like other mainstream software.

Coming back to uniqueness in this framework, here are a few notable observations:
Open-Close model: While the software is not open source, the way of creating application on top of framework comes with least surprises and there is a lot of flexibility.
User oriented: Cockpits are specialized interfaces that power users/admins of the software can use to quickly access the information present in their application.
Thought out: Like a matured product, entire gamut of e-commerce application is present and one can not only provide the http based web solution but also plugin with an existing application.
Scalable: As jvm based approach is followed, it is quite scalable - though it requires an upfront resource allocation during development, it sure pays back to ensure the scalability of the website.
Performance: The customization comes at a cost of computing resources, as well as slow/complex process workflows. The overall performance of the application if compared against other ecommerce solutions is worse.
XML based: The configuration is mainly in xml and parts like the UI is built on custom framework, which is pretty restrictive. While these might not be the issues, but they stuck out like a sore thumb to me, which brings us to another conclusion discussed in the next point.
Old standard Architecture: Application development seems archaic on this framework as the choice of the technologies used as well as provided seems to be a decade old - and regardless of the things mentioned on the website, integration with popular technologies is quite hard.

As I continue my exploration into this framework while working on real world projects, the things gained so far would help me to compare this against both open-source and corporate alternatives and enable me to contrast the differences more accurately against each of them.

Thursday, September 4, 2014

Is it really 'Team Agility' ?

Today, as enterprises continue to face increasing competition from freelancers and startups as increased cloud adoption is causing disruptive business opportunities and challenges for everyone. It is not surprising to see the enterprises going for more agile processes.
However, there is a world of difference between large enterprises and small units of tightly cohesive teams that are set out to achieve software agility. In a recent conference that I went to, this was echoed as 'culture' that no tool or technology could change - as it came from within. A lot of agile projects have not reached their promised outcome as the culture got in the way of their implementations. My personal observation is that apart from team culture, individual behavior and understanding has also got in no small way to do its part in making changes into the outcome. The culture is merely the result or the sum of individual behavior and as micro ecosystem influences the macro one, the individual behavior plays a compounding role in the business of being agile and at the end of the day delivering quality software.
I have worked across different teams during my experience as a software craftsman and the major part that facilitated output was not only the tools and automation in place, but also how the team got on together as a unit, without having egos and finger pointing out at one another. In a larger enterprise, that is rarely the case and my main point here is to reflect upon the team composition as in most projects, there is a management team that handles teams working across different timezones and also managing the bench strength. Unfortunately, this leaves a large room behind for miscommunication which is resolved through process aka documentation that kind of defeats the purpose of being agile in the first place.
What is needed is to have small teams that are oriented towards individual results rather than team efforts(this might be contradictory to the management version of a team but will lead to transparency) instead of large monolithic units ('Lines of Businesses' as they are called) and have cross-functional lines of management between them (to facilitate agility in different sprints) instead of being top-heavy. It is easy by major software tool providers to sell tools to add in agile processes, DevOps, automation, etc. but at the end of the day these are just some buzzwords that probably make your client satisfied about the agility and the appearance of a leaner process when apparently there isn't any.
So instead of merely claiming to have a startup culture, both the software providers as well as clients need to own up to the fact that to have a faster and a cheaper software delivery model, the team size and work needs to be more transparent rather than process heavy which allows for both incidental and malicious efforts to cause inefficiency.

Thursday, July 17, 2014

Book Review: 'Real Time Communication with WebRTC'

I am presenting the review of the book, 'Real Time Communication with WebRTC' by Salvatore Loreto and Simon Pietro Romano.
This book is an interesting mix of both Theory and Practical components of WebRTC, better explained to a layman as Voip or skype within a browser.
One of the things that could really affect you as a reader is the way this book is written - the theoritical fundamentals are interspread with code and practical advices. At times this makes a seemingly straightforward topic like painful to understand, but this is quite handy if you are stuck at a specific problem and need to go deeper into it.
As I am already having experience in developing applications that utilize WebRTC, it was a refreshing read that also explained a lot of theory details associated with this technology and the various possible ways in which peer-to-peer audio and video can be shared on a real time basis.
To give you an overview of this book, it gives a long introduction to the users and handling of user media(mic and webcam) from a HTML5 browser, before starting the discussion of the different design strategies used in a peer-to-peer connections. It then runs the user through an application from scratch to increase his confidence over the topics discussed and finishes with a discussion of advanced features of WebRTC API.
My greatest peeve in using this book was the lack of authority in the examples - some examples failed to execute with the firefox browser. Also, some of the routinely occuring errors could have been added as this technology is constantly evolving and it is not unexpected to find some code that might not be supported by future versions of browsers.
However, the browser based peer-to-peer communication is completely discussed and this book is one of the most comprehensive text on it at the moment.
Disclaimer: I have been provided a free copy of this book by OReilly under their Blogger review program.