Archive for category IT

Software Development In This Day and Age

My first foray into learning Java is still on my mind and some of that effort have appeared here. However over the span of almost a decade a number of developments have happened in the Java eco-system and I thought I revisit that effort with more focus on the tool chain.

Java has been an interest platform since it’s inception and much of the interest is not necessary driven by the current owners of the core patents, but innovations spring forth from a wide community. However, the renewed interest in how I used to learn is not limited to IDEs because increasingly being cross platform requires a certain degree of savviness with command prompts.

A Little Context

  • Java is at Java 8, with the imminent release of Java 9: these feature fundamental changes to how the platform works and runs.
  • Cloud computing has becoming central to how platforms and architectures work;
  • Open source Java eco-systems have had interesting contribution to how the official Java releases evolve over the years. A specific example would be the implementation of java.time.*
  • Java EE is coming along nicely most of the time and the aforementioned open source community have some interesting innovations on top;
  • When I was trying to understand JPA, xml configuration was all over the place and yes, tools like Netbeans seems to look more like evolving into VB 6 like IDEs
  • With the popularity of Git and the supporting services, code sharing can be used as a teaching and/or learning tool; gradually and incrementally.

The new Technologies I am thinking of gradually building into this new take would be:

Within the context of the previous tutorials

  • Built management tools like Gradle/Maven
  • Version code control systems (mainly Git)
  • Collaborative online efforts that uses multiple branches (when and if possible connecting to similar issue tracking systems), with Git at it’s heart.

As a summary, much of this can be described in a readme.md file of Git repository! How search engines discover interesting subjects for beginnings to fix a single line of code makes me wonder.

Advertisements

Leave a comment

ICT In Post-Conflict Reconstruction

Information and communication technologies are increasingly seen as an integral component to development and global organizations like the world bank are doing more to support and seed the development of technologies that will empower the marginalized. However, post-conflict reconstruction remains a particularly challenging aspect of any community, society and country coming out of a war – more so when the way has persisted for decades.

In most of the cases, the main use of ICT would be in humanitarian assistance first of all as tends to happen at the end of a conflict however ICT in that sense is more likely to be used by international players in the humanitarian assistance field. However as time passes then the emphasis shifts from humanitarian assistance to providing more long term development support which often means that the government in question is increasingly become more capable in delivery services to its people.

Countries that have emerged from conflict provide unique challenges that are staggering in both their scale and immediacy. While it is often easy to see the need for services delivery, it is often harder to figure out the necessary support structures and mechanisms that need to enable a more transparent and accountable execution of service provision. ICT, like anything else requires an agreeable support system in place that can provide continued support and further development of the foundational pieces that have been put in place. Give someone a computer and sooner or later they are going to need someone who knows how to fix that computer – preferably without incurring the costs of a consultant.

Questions of reliable power supply become imperative in post-conflict areas and as such more often than not ICT can’t be implemented at scale and sophistication that would be possible in a conflict-free scenario.

From a systems design and implementation perspective, the challenge of ICT in a post-conflict situation becomes slightly different from the challenges faced by ICT in development; while overtime, infrastructural challenges are largely overcome questions policy, human resources and the development of the two will still affect the smooth functioning of ICT. The design of systems to cope with post-conflict reconstruction and eventual development need to take into account the unique challenges brought about by the end of war.

,

1 Comment

Apps Market/Store/Place Bug

If you are a keen consumer of tech news and rumours then you are well into feeling buzz-word fatigue with regard to applications markets or stores or places for that matter. Every other day, it seems everyone is announcing a way for their end users to access applications from a centralized location, while also acting as transaction broker for developers who want to sell their applications. This is a model that has been popularized and successfully leveraged into the sale of millions of iPhones and iPod units by Apple. Now, every big player in the industry wants to create some kind of an App Store or some variant of the same model.

Interestingly, this is not a new thing at all – at least on the personal computer front, Linux and its many distribution have always come with a package manager that pulls down, as it were, whatever you want from a central repository; you even have the customization options to add additional repositories as your needs may require. Open source being what it is, didn’t push for the payment option of it which alas was perhaps one of those things that could have pushed the development model faster and farther. However, open source has a number of backers who may well benefit from this apps store craze. Having operated such a model since their inception, it is conceivable to think that Linux distributions like Ubuntu would have the requisite experience and expertise in managing an app store model as a way to earn revenue. More recent versions of Ubuntu have interestingly focused on making this particular variant of Linux more cloud friendly which would fit in the app store model since the cloud would form the foundational infrastructure to add more developer and consumer facing capabilities into the mix.

Within the last 24 hours, rumours of Windows 8 surfaced and one of the features rumoured to be in the works is a Windows App store. Motivations aside, but the more interesting question to ponder with regard to that rumour (if it ever comes to see the light of day) is: how would such a thing work in the Windows ecosystem? Windows is a versatile platform but one of the things that people have been used to doing is to hunt down software binaries to install on Windows. You either download them or buy them on a CD and then do the needful installation and then voila – you have your application. What kind of confusion would an app store course amongst more casual users of Windows. Windows has been popular in the corporate world and these are environment in which they exercise total control over the behaviour of the operating system then the question that would beg an answer is how does corporate IT deal with app stores? Where exactly do their policies go in such a mix?

I must admit that Microsoft is not without experience in managing such large scale deployments of software and their associated management though the experience that they have may not scale that well. As the overseers of the most widely used operating system on the planet, one must recognize the fact that distributing updates to millions of desktops and servers around the world requires administrative and organization capacity that would lend itself easily to an app store model. Contrasting this ability with what Ubuntu can brag about, then the only problem with Microsoft’s know-how is that fact that much of it is probably kept within Microsoft’s walls and/or require you to be more than just a casual user of the operating system. Distribution and deployment of Windows updates may not (at least initially) scale well to include third party applications that may have nothing to do with the core operating system in any case.

The apps store model does present a great opportunity for small and/or first time developers as the ability to reach a great number of users with a useful and critical application has become that much easier. While there are business advantages to the app stores, they also do raise the question of how to keep your wares up to date across myriads of app stores, may targeting different variety of consumers while maintaining feature and/or performance parity across all stores.

1 Comment

Cloudy Computing

Hasn’t anybody ever mentioned that all the rage about cloud computing is like a return to the mainframe computing era? The principles are more or less the same (from a certain perspective) and it still remains an effective way of running and provisioning computing resources. Everybody is touting cloud computing this and cloud computing that but very few people actually see that we have been here before. At the just concluded JavaOne conference, Oracle made some product announcements around “cloud in a box”. How this is different from a mainframe is the question that begs an answer.

Cloud computing is as much a hardware paradigm shift (compared to the mainframe era) as well as shift in the way that software is accessed, run and maintained by users. However, cloud computing is also concerned with data and its accessibility to the public. With increased use of the internet, data silos have become great pointers to lost opportunities and even great potential for revenue stream expansion. Yes, the marketing department in the IT industry have an unbelievable ability to rebrand the same old stuff in some colourful words that essentially boil down to the same notion but please forgive them for they have to sell the next versions just as well.

The combined improvements in hardware, software algorithms as well as data explosion gave rise to cloud computing but like all nascent computing paradigm shift there remain great challenges. Data security that very well encompass privacy remains a key concern amongst customers but the lure of a large amount of data that can be analysed and sorted into bottom-line impacting outputs is too great to ignore. So, here we are back to the yesteryears of power existing away from the end user but making sure that shared resources and reasonably and reliably shared amongst all users at any given moment.

I can’t help but wonder if this is not the shape of computing as it was meant to be. The age of the personal computer resulted in a more powerful end user who is so empowered to the point that it would be acceptable to postulate the current data explosion is the direct outcome. There is no need to feel concern for the power of the end user as I would suspect most of them already realize that the power they wield has become too much to contain. We are more comfortable with search engines and would much rather consult with them before starting off looking for information. In any case, the very notion of knowing where to find your data is increasing a losing proposition; casual computer users are ever getting closer to terabytes range for their computer hard disk configuration and this is tantamount to having your very own provide mess of data for your pleasure.

Besides, I think the power of the end user is shifting more towards mobile devices than personal computers. It is not that personal computers will become obsolete but they would generally be those devices you leave at home or at the very least suffer the indignity of hauling a load about. However, the possibility exists that the next generation of end users may not be too interested in personal computers as their mobile devices adequately meet their personal computing needs. The lost of computing power therefore (as a result of the shift in personal computing form factor) needs to be be augmented with a cloud infrastructure.

By all means let us get cloudy but let us also remember that cloud computing is as much a shift (to yesteryears?) in data processing paradigm as a shift in data accessibility paradigms. Users want their data whenever they want it but also want it secure and almost always reachable. We are dealing with some pretty powerful users who would just as easily prefer to haul around their supposedly balky laptops than trust a cloud computing service provider that can not address their need for data access whenever they want it. If the story of cloud computing is data centric, perhaps we may want to keep an eye on the ever more powerful mobile phone, with ever increasing storage capacities.

2 Comments

Side Effects of Competition: Muddled Choices & Feature Creep

Most regulators work on the premise that the more there is competition in the market place, the better choices and better quality there are for clients. That notion has been going through my mind for the last couple of days as having too much choice can be debilitating. From a basic consideration, more choices ultimately does lead the manufacturer/provider to try to differentiate his product/service from his competitors so in the end the end users benefit. However, the struggle to improve the product is shared across all the competitors in the industry so it is reasonable to expect that all products that target the same space would sooner or later reach the status of being good enough for the customer.

It is at this point then that quality parity causes choice to become more of a big problem for customers than a blessing. Such a scenario is currently playing out with smart phones – the staggering number of operating systems is simply amazing. Most of the increasingly leading platforms – iPhone and Android – are adding significant features with every release. It is too early to proclaim Smartphone operating systems mature so it goes beyond copying what a competitor has implement but instead implementing features that make the operating system better at serving end users’  needs. On a feature for feature basis, there isn’t enough difference between an iPhone and Android device.

Sure, the iPhone has a more comprehensive support structure around with the iTunes and the content therein but then again such a support infrastructure is being setup around Android and almost every player in the mobile phone industry wants to have an app store.

The Android ecosystem interesting as it is virtually an attempt to replicate the Windows model on mobile devices – a single platform that is installed on hardware manufactured by different companies. If this analogy is taken further, you will note that on a purely functional basis in, there is not much difference between a Dell, Toshiba, HP, Acer etc laptops or desktops. So far the analogy has not played out that way since Google’s Nexus One didn’t do so well in the market while the Motorola Droid is by the far the most successful Android device so far with regard to the number of units sold.

Another side effect of competition is increased feature creep which ultimately makes a product remarkably more complicated by deluding its raison d’être. A good example in this instance would be Microsoft Office. Think of Microsoft Office 2003 which had the old school menu systems. In an application like Word, there is an incredible wealth of features and capabilities hidden in those menus and few people can reach to them quite easily. In my experience, I have come across word documents that have a table of contends that was constructed manually even though Microsoft Word has had the ability to automatically generate and keep a table of contends updated. However, because of feature creep more of the software’s capabilities are hidden from the user making their accessibility and continued use more complex even for easy task. Still on a related idea, the fact that reaching a feature needs the continued need to navigate a hierarchy of menus, means that the full power of the application is not made easily accessible for daily and repeated use.

Microsoft Office new ribbon interface was meant to bring more of the suite’s capabilities to the users’ attentions so as to enabled repeated and continued use of what the product offers. Has it worked? I am not convinced but in some ways it is an improvement over the old user interface.

In closing, the competition in Smartphone operating system need to be kept sane and focused on delivering real and effective benefits to users instead of just piling on the features which may eventually get in the way of a more enjoyable and productive use of the platform. I must admit that so far Apple seems to be working on this as a deliberate objective in the evolution of its operating system. On the hand, the fundamental model that the Android operating system follows makes it a tough sell to keep that level of focus and in the process ensure a more coherent platform experience for users, developers and network operators alike.

Leave a comment

Microsoft’s Reorg

I finally got around to reading my ever piling up list of unread RSS feeds and one of the items that caught my attention was the announced reorganization of Microsoft’s Entertainment and Devices division. Within the sprawling extend of Microsoft’s business units, these are the people responsible for endeavors like the Xbox, Xbox 360, Zune and of course the soon to be released Windows Phone 7. As some of the analysis that I have read points out, the reorganization comes before the launch of Windows Phone 7 and right after the cancellation of the Courier Project (Microsoft’s answer to Apple’s iPad). Speculations aside, the Entertainment & Devices has not had any undeniably successful product though as noted the Xbox, depending on your criteria for success, accounts for some notable success.

However, a reorganization at such a crucial moment also highlight a lack of consistent vision and/or committed course of action to deal with the increasingly powerful and market and mindshare steals by Apple and Google. It can’t be a question of resources because as it goes, Microsoft has the necessary resource base to put together a compelling challenge. My best estimate is that they don’t understand the market or perhaps they are not comfortable with the underdog position in which they are – more so after having had a head start in the smart phone market with Windows Mobile. Windows Phone 7 is largely seen as a reaction to the modern and buzz inspiring exploits of the Apple’s iPhone and Google’s Android.

This is something that is increasingly more common with Microsoft: the company comes across as less certain of its own ability to take up new challenges and proceed to score major victories in the process. It makes one wonder whatever happened to the spirit that landed them in court for bundling a browser into the operating system in order to response to the threat that Netscape represented. While such bundling was anti-competitive and indeed led to Microsoft being declared a monopoly, their legal troubles seems to have had far reaching side effects than just reigning in their bad business practices.

It can’t all be blamed on their tussles with regulator since it is equally plausible that the current leadership of the company is no longer equally driven as compared to when the company was still starting – with everything to prove and nothing to lose. This tends to happen when companies grow up from their startup roots since they have largely conquered their competition and consolidated on two or three cash cows.

In all of this, please make no mistake that Microsoft is still innovating and improving its products but these innovations and improvements tend to be more vertical in nature i.e. improvements in desktop operating systems and any of the myriad of server software that Microsoft makes. All in all, all these innovations are geared towards protecting their primary cash cows: Windows and Office. Any foray outside of Microsoft’s comfort zones has not produced any breakaway successes.

I remember having a conversation some years back about the fall of Microsoft: this is not yet another declaration of the coming demise of Microsoft as it would be obvious to anybody that Microsoft is an important fixture in the IT industry but it is a fixture that is increasingly losing the central focus as computing leads off to slightly more nuanced but consistent shift towards mobile and web (cloud) computing model. The real danger to Microsoft’s continued relevance is how well it can adopt to these shifts and maintained its central position going forward. It is not impossible to consider the possibility of a few strategic acquisitions to get them back into the game a la Oracle but I doubt Microsoft’s culture would successfully survive such a move.

Leave a comment

Simple Java Persistence API (JPA) Demo: JPA Query

JPA Query Language

I don’t know if this series still qualifies as simple but I thought I add some basic information about queries in JPA. In part II we looked at the EntityManager and more specifically the simple operations that it enables like persist, find, merge, remove and refresh. In addition to these operations, JPA comes with its own query language that allows you to create custom queries over your data set.

JPA abstracts the developer and the application away from the details of how data is represented in the data stores (more likely a rational database) and this abstraction effectively marries the relational and OO paradigms. However one of the corner stones of the relational paradigm is its query capabilities which has so far been unmatched by any software paradigm to date. The query facilities in the OO model are limited in as far as handling a large amount of data. While there are attempts at developing ORDBMS (Object Relational Database Management Systems) data stores, these have never truly caught on in the enterprise and so the bulk of enterprise data remain stored in relational databases. With every other application build on top of a relational database, it becomes important to build query capabilities into abstractions layers such as the JPA.

The default query language in relational paradigm is the Structured Query Language or simply SQL. SQL has a number of standards defined which every vendor of a relational database implements in slightly different manner thus making it a tricky language to adopt as the basis of an abstraction layer like the JPA that is expected to work across multiple relational database products without resulting to expensive and complex workarounds.

The Java Persistence API Query Language (JPA QL) is the result of attempts to abstract the query facilities of a relational paradigm. It borrows from the EJB QL but also fix the weaknesses that have plagued EJB QL. The specifics of what was borrowed from EJB QL and what was fixed are beyond the scope of this post. JPA provides the ability to retrieve JPA mapped entities, sorting them as well as filtering them. If you are familiar with SQL, then you have some degree of familiarity with JPA QL as it is syntax is closely modeled on SQL’s syntax.

Specifying a Query

There are three main ways of specifying JPA queries:

  • createQuery Method of the EntityManager: with this option you compose the query at run time and execute it there and then. The most immediate aspect of this approach to creating queries is that your queries are not checked/parced at deployment time which means that obvious errors are only discovered when the code is executed.
  • Named Queries: Named queries are defined along with the corresponding entity beans. Several named queries can be defined for each entity thus enabling filtering and sorting using various properties of the entity. Unlike with runtime queries, these queries are parsed at deployment time which means that any errors are discovered before code is executed that depends on your named queries.
  • Native Queries: this gives you the ability to define queries using SQL instead of EJB QL. You can create Native Named Queries as well.

Querying

Retrieving data

The most common query operation is the select operation which returns all or a subset of records in the database. With JPA QL, the select operation returns mapped collection of zero or more mapped entities. The operation can also return properties of a mapped entity. A simple select query looks as follows.

SELECT h FROM Hotel h

 

SELECT h.name FROM Hotel h

Notice how you select from the entity and not from a table as you would in SQL but the syntax of the query is not different from what you would write using SQL. The query returns zero or many Hotel entities from the database. The Hotel entity was defined in the first installment of this demo series. The second query in the above sample selects a property of the hotel entity.

Lazy vs Eager Loading: FETCH JOIN

When you design your entity classes with associations and relationships, loading and accessing these relationships at run time becomes important. For example, a hotel has rooms and you can decide if you want the rooms associated with each hotel to be loaded when the hotel entity is retrieved (eager loading) or when you explicitly access (lazy loading) the associated rooms. During the definition of the association between entities you can declare whether you can lazy or eager loading but JQL also allows you to load the objects in an association.

SELECT h FROM Hotel h JOIN FETCH h.rooms

With the above query, all the hotel objects returned will have their associated rooms loaded as well. This gives you eager loading without specifying it in the relationship between the Hotel and Room entities.

Filtering & Sorting

It is not always the aim of any data retrieval operation to return every last record in a database; some times we are interested in only a few of those records that meet a particular criteria for the purpose of our operations at hand. Within the context of the simple app setup for this series, we may just be interested in hotels that are in a particular town. The name of the town in question would form our filtering criteria. The sample below gives a JPA QL query that would enable us to retrieve a collection of Hotel entities that with a particular town property.

//Filtering

SELECT h FROM Hotel h WHERE h.name = “Nairobi”

//Sorting

SELECT h FROM Hotel h ORDER BY h.name

//Filter and Sort

SELECT h FROM Hotel h WHERE h.name = “Nairobi” ORDER BY h.name

Once again notice the similarity to an SQL statement that would return rows that meet the provided sort and filtering parameters. So far these are just simple queries that don’t show much of JPA QL capabilities but a necessary step in appreciating how JPA QL queries are written.

Of greater importance is showing how these queries can possibly be composed within the context of Java code.

Query q = em.createQuery(“SELECT h FORM Hotel h ORDER BY h.name”);

List<Hotel> results = q.getResultList();

A further example of using queries to filter

Query q = em.createQuery(“SELECT h FROM Hotel h WHERE h.name = :hotelName”);

q.setParameter(“hotelName”, hotelName);

List<Hotel> results = q.getResultList();

Something that may be a bit tricky for first time users of JPA is composing queries using the LIKE operator to filter

Query q = em.createQuery(“SELECT h FROM Hotel WHERE h.name LIKE :name”);

StringBuilder sb = new StringBuilder();

sb.append(“%”);

sb.append(name);

sb.append(“%”);

q.setParameter(“name”, sb.toString());

List<Hotel> results = em.getResultList();

Assume for a moment that you want a list of all hotels with a particular number of rooms (say more than 20 rooms for example) … here is how you go about formulating such a query:

Query q = em.createQuery(“SELECT h FROM Hotel h WHERE size(h.rooms) > 20 ORDER BY h.name”);

List<Hotel> results = q.getResultList();

This concludes this look at JPA QL. This is not a complete examination of the power of JPA QL but a glimpse at what is possible.

10 Comments