Sunday, September 29, 2013

The OpenTech confrence

Hi All,
In the last few month I swarmed with work and I didn't have enough time to explore the benefits of new dynamic languages. In the small time that I have I understood that it need to be explore more deeply.
More than that there are other very important fields that rise dramatically over the past few years:
Web technologies HTML5 & javascript that also part of the dynamic languages
The Cloud - A big changing in the way we develop and maintain software
Mobile - A big changing in the way we consume software.
Therefore, we decided in SELA to create a conference for these changes, so the software developers in Israel will be able to catch up with all the new technologies in these areas
here is the link to the conference: http://www.sela.co.il/s/opentech/index.html
Enjoy.
 

Sunday, June 16, 2013

Making order in the new programming languages – Part 1

Recently, we are witnessing to a large number of programming languages that gain popularity in the software industry.  Many of them are known as interpreter languages or also known as script languages. One of the reasons for these blossoms is now you can compile many of these languages to java byte code and run it on the JVM so the differences in the performance become very minor. So now java is not only a language it is .more like an echo-system. 
Today, there are more than 100 programming languages that run on the JVM! and the real questions is how do I know in which one to use and why, or I just need to stick with java
Well, the answer for that is depend on your requirement, each language has its own philosophy if your requirement and the way you like to write code is suitable to the language it means that you should use it. Java is a very object oriented language that encourage the programmer to write in object oriented paradigm. If you like to write object oriented (like I do) and you have a big project that include a lot of maintenance I think java is the language for you, for example java support strict typing and encourage you to write class for any type of object. Java supports interfaces and not multiple inheritance, encourage the developer to set properly the inheritance tree.  Most of the other languages do not try to compete java in that area, however, some of the languages has some features that better in java for that purpose.
Since i'm still not an expert with all these languages, i may find myself wrong about it and maybe i will find languages that has the same philosophy, I will be happy to discuss it.
However, sometimes you have other requirements and maybe for some applications object oriented programming can be cumbersome and awkward. for example, did you try to write swap function in java that swap the value of two numbers, you will find out there is no good way of doing it. Therefore, in the next few posts I will try to label the different programming languages and try to see when you need to work with what. So you use the most suitable programming language to your needs.

Saturday, June 8, 2013

How to choose good framework

The java eco system is full of exciting frameworks most of them are open source, many of them provide the same purpose as others. Many time during the development of your project you consider using one of these frameworks, personally I believe using external frameworks is a great idea. It is best advised to focus on your business logic instead of reinventing the wheel. But how do I know which framework to choose?
In this post I will define some criteria that I think are the most important criteria for choosing a framework, some criteria are controversial but I think there are very important arguments in the decision.

1. Good framework, is framework with big community - this is very important mainly in open source frameworks. Since open source frameworks grown by their community. Usually the community is other engineers that work in places like you are. And if many engineers think it's a good framework and invest time of using it (on the way debug it) and maybe even develop it. It is probably a good framework. If you want to know the size of the community looks for the number of Q&A in stack overflow or number of posts, training solution for this project.

2. Who behind this project, who developed it? Who is the company behind it, if it is top level project of apache you can sleep well at night. If it is one of the big companies like red hat or HP. it is also something safe. Stay away from academic frameworks that more suitable for theoretical issues.

3. Good Framework is well documented framework. Some developers thinks that open source framework should not be well documented since the owner of the project would like to earn money from training.
Well, I believe if we have big community the training will not be the problem.

4. The framework should mature enough - it was already debugged and has many successful case studies around the world. You have enough developers that work with it and usually in this case the code is already optimized for better performance.

5. The framework is easy to use - there is no complicated API, the framework focus in one major thing and not try to resolve everything. When you read the code of the example is very understandable and you can easily integrate it in your program,

So you can see, that in small reading and paying attention to this issues you can determine if you have good quality framework or something that it is not good idea to work with.
I hope it will also help you in choosing your framework


Friday, May 24, 2013

Linux distributions


Linux is one of the leading open source projects in the world, but what is Linux, we have many "Linuxes" - red hat, blue cat, ubuntu, suse so what does it means that all of them are Linux. well, Linux is a standard there are set of rules that if you wish to be Linux you have to satisfy, these rules are in two different standards - POSIX and GNU, POSIX talk about rules for the core of the operating system mainly the kernel and stands for portable operating system interface and GNU stands for gnu not Unix specify applications that complete the Unix standard. Every distribution has to implement these standards so it can be called Linux.
One of the rules is the license of Linux that should be open source and free to download. And usually each Linux distribution builds from a Linux program. The distributers download the code and then add and modify the code for a new Linux, this new version usually called Linux distribution.
I would like to present some of the popular distribution of Linux:

Ubuntu: Ubuntu is distributions that focus on the user and try to provide him easy interface for his work, many feature like plug & play and easy installation are provided in ubuntu. 
Today many users that wish to work at home with Linux work with Ubuntu and it became real (small) competitor for windows.

Red Hat: The biggest distribution for enterprise Linux, the main advantage of the red hat distribution is application called RPM that allow you to update software automatically and in very easy way. the red hat is of course free of charge but if you wish you can be connected to the red hat servers and update your Linux automatically for money. this is highly important feature for enterprise companies who has large number of servers and need to maintain them constantly and be up to date as soon as possible due to critical systems that run on these Linux servers.

Suse: also well known large distributer of Linux, developed by novel and consider to be very reliable and effective Linux distribution. One of the major advantages of Suse Linux is the interoperability with Windows and Microsoft technology so working in this hybrid environment becomes much easy.

Blue cat: this Linux distribution is used for embedded and real-time system it allows you to configure your kernel and customize it to be suitable for embedded systems, remove the mouse and keyboard from the kernel. 

Monday, May 20, 2013

Preform background operation with swing worker

Hi,
I think that one of the suffering things in UI is making a progress bar, you need to update it constantly while the operation is invoked by another thread and calculate the progress of the task.
From java 6.0 we have a new utility that help us with that called SwingWorker.
SwingWorker is an abstract class that you can extend and the abstract method called doInBackground  that allow it to preform background operations. SwingWorker also can update the progress bar with the process method and by firing events for changes in the progress bar.
Let's see an example
In our example, we would like to send mails in the background for large number of users that defined in the Swing application. once the submit button is press the application will send the content of the mail to all the users, let's see the code of the application:

public class Application extends JFrame {
 
  // The UI Components
  private JProgressBar progressBar;
  private JTextArea mails;
  private JTextArea message;
  private JButton sendMails;
  private JLabel status;
 
  public Application(){
   setSize(600, 600);
   message = new JTextArea();
   JPanel rightPanel = new TextAreaPanel(new JLabel("message"), message);
   add(rightPanel, BorderLayout.EAST);
   mails = new JTextArea();
   JPanel leftPanel = new TextAreaPanel(new JLabel("mails"), mails);
   sendMails = new JButton("send it!");
   add(leftPanel, BorderLayout.WEST);
   add(sendMails, BorderLayout.NORTH);
   progressBar = new JProgressBar();
   progressBar.setStringPainted(true);
   add(progressBar, BorderLayout.SOUTH);
   sendMails.addActionListener(new ActionListener() {
  
  @Override
  public void actionPerformed(ActionEvent e) {
   String addresses = mails.getText();
   String[] add = addresses.split("\n");
   SendMailsWorker worker = new SendMailsWorker(message.getText(), add);
   // A property listener used to update the progress bar
      PropertyChangeListener listener = 
                                 new PropertyChangeListener(){
        public void propertyChange(PropertyChangeEvent event) {
          if ("progress".equals(event.getPropertyName())) {
            progressBar.setValue( (Integer)event.getNewValue() );
          }
        }
      };
      worker.addPropertyChangeListener(listener);
   worker.execute();
   
  }
 });
  }
  
 
  // The main method
  public static void main(String[] args){
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        Application app = new Application();
        app.setDefaultCloseOperation(EXIT_ON_CLOSE);
        app.pack();
        app.setVisible(true);
      }
    });
    System.out.println("finish main");
  }
}

// and another class for handling the panel is
public class TextAreaPanel extends JPanel{

 public TextAreaPanel(JLabel label, JTextArea text) {
  text.setPreferredSize(new Dimension(120, 120));
  add(label, BorderLayout.WEST);
  add(text, BorderLayout.CENTER);
 }
}

The action of sending the mail should be in the background, therefore, we should create a swing worker that handle the task, let's see it
public class SendMailsWorker extends SwingWorker {

 private final String message;
 private final String[] addresses;

 public SendMailsWorker(String mes, String[] mails) {
  message = mes;
  addresses = mails;
 }

 @Override
 protected Integer doInBackground() throws Exception {
  int matches = 0;
  for (int i = 0, size = addresses.length; i < size; i++) {
   // Update the status: the keep an eye on thing
   publish("send mail to: " + addresses[i]);
   matches += sendMail(message, addresses[i]);
   setProgress((i + 1) * 100 / size);
  }
  return matches;
 }

 private int sendMail(String message2, String string) {
  // sending the mail
  try {
   Thread.sleep(10000);
  } catch (InterruptedException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  return 1;
 }

 @Override
 protected void process(List chunks) {
  for (String message : chunks) {
   System.out.println(message);
  }
 }
 
 @Override
 protected void done() {
  System.out.println("finish sending mails");
  super.done();
 }
}
as you can see from the code, the operation of sending the mail is done by the SendMailWorker that extend SwingWorker. the method doInBackground preform the operation and set the progress so than you can write to the console or to any other place the progress of the writing. I think SwingWorker is very nice utility that simplify the ability to preform background operations.

Sunday, May 12, 2013

What is my problem with Microsoft technology

As an architect that working in the software industry almost 15 years I came across many technologies some are great and some of them are not so great...
In this post i would like to refer to technologies that came from specific vendor - Microsoft.
As you probably can see from my blog name i'm a java person and i don't have a lot of experience in Microsoft technology. I did some projects that related to .NET and Microsoft but i'm not expert.
Generally, i can say that .NET is pretty good framework, some of the things i like some are not but I think this framework contribute a lot to the software industry.
However, The Microsoft technology has one big flow, it refuses to collaborate with many other technologies that exist in the world. for example, last week i lectured about ALM and architecture and one of the listeners ask me if TFS (the Microsoft ALM tool) can work with subversion. The ALM guy that run the user group ask her why she would like to use subversion you can use Microsoft tools instead. this is of course a Microsoft user group...
The philosophy of we will provide you anything that you need and you can't use any other technology is annoying. I personally believe that each framework, tool or language are means to do my job better and every one of them should be used differently according to the circumstances.
If you are eating steak you should do it with fork and knife and not with spoon. it doesn't mean the spoon is redundant t just means that it doesn't feet for me right now.
No company not matter how big it is can't provide solutions to all the use cases in the world, therefore, good technology is a technology that can integrate easily with other technologies.
More than that, Microsoft prove that when it is important for them they can do it better than anyone else, you can see it in the integration inside Microsoft technology and also in there cloud solution, azure.
So i hope Azure is a good start in this direction and hopefully Microsoft technology will be more open for integration with other technologies in the near future.  

Tuesday, May 7, 2013

My lecture about SOLR in the SDP

Hi,
Yesterday i was lecturing about SOLR in the SDP, it's the larget confrence of sela with international speakers about many technology mainly in Microsoft technology - www.seladeveloperpractice.com 
The presentation of Solr can be found here.
Enjoy :-)