Note: acknowledgements (and thanks!) to Máximo Prieto (our OOP guru) who had this idea and he implemented it on Smalltalk.
We want to have a collection that filters its elements as we add them using a given condition. For instance, we can
have an Array
that only allows even numbers.
First, and important, is to understand what a filter is. “filter” is a very overloaded word, and sometimes used in a technical way. Let’s say that a filter is someone with the single responsibility of deciding if something has to pass over or not.
14 Jul 2016
On the first part of this article I explained why java generics don’t allow up-casting for generified types. In this part we will see why, arrays don’t have that restriction, and the implications for reflection.
If generified lists aren’t allowed to up-cast, why arrays are?
The reason is very simple: arrays don’t erase their element type. At runtime, each array knows exactly which kind of element it should allow in. If you try this code:
String[] stringArray = new String[1];
Object[] objectArray = stringArray; // Perfectly normal
The compiler allows you to up-cast. What if we try to put something in the string array, that is not a string?
2 Dec 2014
When you use a compile-time typed language, like Java, you expect that types in each variable will help you by restricting the possibilities for a value. Instead of being able to do everything, you want to do things that are valid in your domain.
Discussions aside about strong vs weak typing, when you code with types you think of types as sets. A variable can be one of the elements of the implicit set for its type. Thus Integer a
means that variable ‘a’ will be one of the elements in the Integer set, and only that.
If you have a String variable ‘a’ and want to assign its value to a variable ‘b’ of type Object:
String a = "A";
Object b = a;
2 Dec 2014
OOSCM (Object Oriented Software Configuration Management) is a tool we are developing to better support traits that are unique to object oriented development. Current SCM tools (CVS,SVN,GIT,Monticello, etc) are file based solutions, the file is the minimum versionable element, but when developing with objects files are not the elements we manage, we manage and version classes, methods, packages, etc. OOSCM will keep the history of changes of these elements (from basic changes like modifying a method to composite one like renaming a class) providing at the same time means to treat products, baselines, projects, etc. as first class versionable elements with the objective of helping team development in all its steps (programming, integration, etc). The talk provides a description of the tool’s objective, architecture and current development state.
2 Oct 2010