View RSS Feed

Uncategorized

Entries with no category

  1. The Decorator pattern

    by , 07-23-2011 at 02:42 PM (JosAH's blog)
    Greetings,

    the previous blog article talked a bit about the Visitor design pattern. This article talks a bit about additional functionality that is sometimes wanted, i.e. the functionality is optional. Assume there is a lot of optional functionality that people want.

    This article discusses the Decorator (or 'Wrapper') pattern. For the sake of the example we'll use array manipulation. People always fiddle diddle with arrays, i.e. they copy values from one array to another, ...

    Updated 07-23-2011 at 02:45 PM by JosAH

    Categories
    Uncategorized
  2. The Visitor pattern

    by , 07-23-2011 at 02:35 PM (JosAH's blog)
    Greetings,

    Java claims to support OO, so why not use it? In this article we're going to talk a bit about when and why to apply certain patterns. We'll start with the Visitor pattern. The pattern is also named 'double dispatch' which will become clear near the end of this little article. Here's the story:

    Suppose some time ago you wrote a bunch of beautiful, efficient classes; they're real gems. For the sake of this article let's use the following classes:
    ...
    Categories
    Uncategorized
  3. Compilers

    by , 07-16-2011 at 04:41 PM (JosAH's blog)
    Greetings,

    Frequently a question pops up in this forum (or other forums for that matter) where the OP wants to implement a calculator or wants to compile an expression given in text (String) form. Often they get lost in tokenizers or regular expressions or whatever. This article describes how a compiler (for expressions) can be designed and implemented. The attachment contains a zip file with all the sources for a complete compiler.

    Top level architecture
    ...

    Updated 07-18-2011 at 05:18 PM by JosAH

    Categories
    Uncategorized
    Attached Thumbnails Attached Files
  4. Sudoku

    by , 06-23-2011 at 01:32 PM (JosAH's blog)
    Greetings,

    a couple of years ago a large part of the world went totally mad. Not because of global climate changes, not because of terrible wars that were started in the Middle East, nor because of global famine, nor because of large investment banks going bankrupt and nor because of Tsunamis, but because of a puzzle: Sudoku.

    This is what Sudoku is all about:

    Java Code:
    	+-------+-------+-------+ 
    	| . . . | . . . | . . . | 
    	| . . . | . .
    ...

    Updated 06-23-2011 at 03:52 PM by JosAH

    Categories
    Uncategorized
  5. Script Engines

    by , 06-12-2011 at 10:07 AM (JosAH's blog)
    Greetings,

    Introduction

    Java is not Javascript and most of the times when questions end up in the wrong forum, they're moved to another forum as soon as possible. Accidentally this article talks about Javascript a bit but it belongs in this Java section.

    Since version 1.6 of Java a script engine comes packaged with the core classes. A script engine is an abstract little framework that offers support for other languages, scripting languages to be exact, ...

    Updated 06-12-2011 at 10:10 AM by JosAH

    Categories
    Uncategorized
  6. Heap Sort II

    by , 06-12-2011 at 09:54 AM (JosAH's blog)
    Greetings,

    This is the second part of the Heap Sort article (that dumb forum software only allows 10000 characters per article part. Here's the second part:

    The first part of this article explained a bit about the heap sort algorithm itself. Now let's get back to our original problem: given the two arrays:

    Java Code:
    String[] first= { "Fred", "Barney", "Wilma", "Betty", "Bambam", "Pebbles" };
    ...

    Updated 06-12-2011 at 04:30 PM by JosAH

    Categories
    Uncategorized
  7. Heap Sort I

    by , 06-12-2011 at 09:52 AM (JosAH's blog)
    Greetings,

    A lot of topics are started here in this forum (and a lot of other forums too) mentioning a problem about sorting data.

    Examples of two main problem scenarios are like this:

    1) an array containing a first name and another array containing a last name and possibly a third array containing the age of a person; how to sort the arrays according to, say, the first name.

    2) a List of objects where each object contains a first name, ...

    Updated 11-18-2013 at 08:46 AM by JosAH

    Categories
    Uncategorized