Skip to content

Commit

Permalink
0.1.9: cleanup, more consistency and MetaMetaClass
Browse files Browse the repository at this point in the history
  • Loading branch information
terimakasi committed Jun 12, 2012
1 parent 2217e04 commit 717f9b9
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 225 deletions.
400 changes: 231 additions & 169 deletions It.java

Large diffs are not rendered by default.

58 changes: 45 additions & 13 deletions readme.txt
Expand Up @@ -50,7 +50,10 @@ Table of Contents
SCOM supports the AOM paradigm (Adaptative Object Model), where business
domain classes are not static like 'regular OOP languages' (e.g: Java,
C#/C++) but instead dynamically created at runtime (much like classes
described by Semantic Web Ontology language: 'Owl')
described by Semantic Web Ontology language: 'Owl') like pure Object
languages (e.g: Smalltalk)

Note: SCOM is 'null safe', this is implemented by a native singleton ('NIL')

2. Getting Started
------------------
Expand Down Expand Up @@ -210,7 +213,7 @@ Table of Contents
note: SCOM is 'null safe', this is implemented by a native singleton
('NIL') which requires a factory method
- subclasses should not add static/class methods
- subclasses must override 'NAME' and 'CLASS_NAME' static fields
- subclasses must override 'BASENAME' and 'CLASS_NAME' static fields

Native Object Model: 'ENVIRONMENT'
----------------------------------
Expand All @@ -236,17 +239,46 @@ Table of Contents
---------------

7. To Do
--------------------
- Quality:
- Unit tests & Automatic Tests
- count It instances and avoid unnecessary duplication of Literals/Constants
(e.g: NEW_F)
- Semantic Network:
- RDF serialization, may be used to specify native Object Model
- Graph Layout (with D3 Javascript framework)
- Languages:
- Implementation of Lisp interpreter
- Encapsulation of Java embedded interpreter
-------------------
- Readme.md or Readme.html ?
- Automatic tests for regression check
- Check if Windows/Unix to adapt (e.g: GetDesktop(),...):
- Text editor (Notepad/vi)
- Events / Hooks / Callbacks ?
- Simulation of digital electronic components (e.g: logic gates)
- Environment
- Implement 'Plugins' for self-extensibility of 'environment'
- SHELL could be a Plugin !
- TextFileWriter could be a Plugin !
- 'ERROR' variable which stores a message about last error
- Shell:
- if input ends with ';' then interpret it as Javascript
- 'info' command in Shell: show version, instance count, plugins
- 'exec' command
- 'run' command (runs commands from a script file)
- 'history' command
- implement 'history' with up/down arrow keys
- StringWriter and TextFileWriter as instances of 'Writer' (check in SHELL with 'list Writer')
- Writer:
- RDF / Owl / JSon
- Database !
- D3/JS Graph drawing
- Html (1 file per object/facet and links)
- GraphViz format
- Reader !
- e.g: read graph from Git or from url
- Database !
- API consistency:
- get rid of 'NewValue()'
- getValue() and 'VALUE' facet should be only 2 different means to access value
- AOM:
- New Integer,...: .next should not be NIL
- Allow to define name when instanciating a class (e.g: New(name, class_it))
- Chain Inheritance (attributes of superclasses recursively)
- 'implement IInterface' cf. Java and allow implementations of multiple 'Interface' classes
- Multiple values for _value of an It instance (getValue() = get(0) and add getValue(index) and valueCount)
- Scope/Context for a facet (ex: localization of 'NAME')
- Port to JVM !

A. Appendix
-----------
Expand Down
5 changes: 3 additions & 2 deletions samples/aom/Test_AOM.java
Expand Up @@ -9,8 +9,8 @@
*/
package scom.samples.aom;

import static scom.It.*;
import scom.It;
import static scom.It.*;

public class Test_AOM
{
Expand All @@ -20,7 +20,8 @@ public static void main(String[] args)

Print(INTEGER);

It thing_class = NewClass("Thing");
//It thing_class = NewClass("Thing");
It thing_class = New("Thing", METACLASS);
Print(thing_class); // instance count should be 0

It thing_it = thing_class.evaluate(); // implicitly calls New(thing_class);
Expand Down
3 changes: 1 addition & 2 deletions samples/arithmetic/Test_Add.java
Expand Up @@ -10,7 +10,6 @@
package scom.samples.arithmetic;

import scom.It;
import static scom.It.*;
import scom.samples.arithmetic.operators.ItAddF;

public class Test_Add
Expand All @@ -19,7 +18,7 @@ public static void main(String[] args)
{
It.Print("**** Test_Add ****");

It add_function = It.New(K_FUNCTION, "add", ItAddF.CLASS_NAME);
It add_function = It.New(ItAddF.BASENAME, ItAddF.BASENAME, ItAddF.CLASS_NAME);
It.Print(add_function.evaluate(It.ToList(new Object[]{0.33, 0.66})));
} //---- main()
} //---------- Test_Add
10 changes: 5 additions & 5 deletions samples/arithmetic/Test_Add_Multiply.java
Expand Up @@ -9,20 +9,20 @@
*/
package scom.samples.arithmetic;

import static scom.It.*;
import java.util.ArrayList;
import scom.It;
import scom.samples.arithmetic.operators.ItMultiplyF;
import static scom.It.*;
import scom.samples.arithmetic.operators.ItAddF;
import java.util.ArrayList;
import scom.samples.arithmetic.operators.ItMultiplyF;

public class Test_Add_Multiply
{
public static void main(String[] args)
{
Print("**** Test_Add_Multiply ****");

It add_function = New(K_FUNCTION, "add", ItAddF.CLASS_NAME);
It multiply_function = New(K_FUNCTION, "multiply", ItMultiplyF.CLASS_NAME);
It add_function = New(ItAddF.BASENAME, ItAddF.BASENAME, ItAddF.CLASS_NAME);
It multiply_function = New(ItMultiplyF.BASENAME, ItMultiplyF.BASENAME, ItMultiplyF.CLASS_NAME);

ArrayList<It> multiply_params = ToList(new Object[]{ 2, 3 });
multiply_params.add(add_function.evaluate(ToList(new Object[]{ 1.5, 3.5 })));
Expand Down
2 changes: 1 addition & 1 deletion samples/arithmetic/operators/ItMultiplyF.java
Expand Up @@ -9,8 +9,8 @@
*/
package scom.samples.arithmetic.operators;

import scom.*;
import java.util.ArrayList;
import scom.It;

public class ItMultiplyF extends It
{
Expand Down
4 changes: 0 additions & 4 deletions samples/lang/lisp/ItCons.java
Expand Up @@ -13,11 +13,7 @@
*/
package scom.samples.lang.lisp;

import java.util.ArrayList;
import scom.It;
import scom.It;
import scom.samples.lang.lisp.functions.ItLispCdrF;
import scom.samples.lang.lisp.functions.ItLispConsF;

public class ItCons extends It
{
Expand Down
7 changes: 4 additions & 3 deletions samples/lang/lisp/ItLisp.java
Expand Up @@ -18,10 +18,11 @@
*/
package scom.samples.lang.lisp;

import scom.samples.lang.lisp.functions.*;
import scom.It;
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import scom.It;
import scom.samples.lang.lisp.functions.*;

public class ItLisp extends It
{
Expand Down
5 changes: 1 addition & 4 deletions samples/lang/lisp/Test_Lisp.java
Expand Up @@ -10,11 +10,8 @@
*/
package scom.samples.lang.lisp;

import scom.samples.lang.lisp.ItLisp;
import java.util.ArrayList;
import scom.*;
import scom.samples.lang.lisp.*;
import scom.samples.lang.lisp.functions.*;
import scom.It;

public class Test_Lisp
{
Expand Down
7 changes: 3 additions & 4 deletions samples/lang/lisp/functions/ItLispAtomF.java
Expand Up @@ -11,10 +11,9 @@
package scom.samples.lang.lisp.functions;

import java.util.ArrayList;
import scom.*;
import static scom.It.*;
import scom.samples.lang.lisp.*;
import scom.tutorials.tutorial1.ItSuccessorF;
import scom.It;
import static scom.It.NIL;
import static scom.It.TRUE;

public class ItLispAtomF extends It
{
Expand Down
3 changes: 1 addition & 2 deletions samples/lang/lisp/functions/ItLispCarF.java
Expand Up @@ -12,8 +12,7 @@

import java.util.ArrayList;
import scom.It;
import static scom.It.*;
import scom.samples.lang.lisp.ItCons;
import static scom.It.NIL;
import scom.samples.lang.lisp.ItLisp;

public class ItLispCarF extends It
Expand Down
5 changes: 2 additions & 3 deletions samples/lang/lisp/functions/ItLispCdrF.java
Expand Up @@ -11,9 +11,8 @@
package scom.samples.lang.lisp.functions;

import java.util.ArrayList;
import scom.*;
import static scom.It.*;
import scom.samples.lang.lisp.*;
import scom.It;
import static scom.It.NIL;

public class ItLispCdrF extends It
{
Expand Down
2 changes: 1 addition & 1 deletion samples/lang/lisp/functions/ItLispConsF.java
Expand Up @@ -11,7 +11,7 @@
package scom.samples.lang.lisp.functions;

import java.util.ArrayList;
import scom.*;
import scom.It;
import scom.samples.lang.lisp.ItCons;

public class ItLispConsF extends It
Expand Down
3 changes: 1 addition & 2 deletions samples/lang/lisp/functions/ItLispEqF.java
Expand Up @@ -11,8 +11,7 @@
package scom.samples.lang.lisp.functions;

import java.util.ArrayList;
import scom.*;
import scom.samples.lang.lisp.*;
import scom.It;

public class ItLispEqF extends It
{
Expand Down
1 change: 0 additions & 1 deletion samples/lang/lisp/functions/ItLispQuoteF.java
Expand Up @@ -12,7 +12,6 @@

import java.util.ArrayList;
import scom.It;
import scom.samples.lang.lisp.*;

public class ItLispQuoteF extends It
{
Expand Down
5 changes: 2 additions & 3 deletions tutorials/helloworld/HelloWorld.java
Expand Up @@ -7,7 +7,6 @@
*/
package scom.tutorials.helloworld;

import scom.tutorials.tutorial1.ItSuccessorF;
import scom.It;
import static scom.It.*;

Expand All @@ -26,10 +25,10 @@ public static void main(String[] args)
Print(item);

// Now print object's value and facets in 'object1.txt' file
Print(item, TEXT_FILE_WRITER);
Print(item, TEXT_FILE_WRITER, WITH_UNLIMITED_DEPTH);

// Now print object's value and facets in a String
String output_str = Print(item, STRING_WRITER);
String output_str = Print(item, STRING_WRITER, WITH_UNLIMITED_DEPTH);
Print(output_str);

// Now print item facets recursively
Expand Down
3 changes: 1 addition & 2 deletions tutorials/tutorial1/ItSuccessorF.java
Expand Up @@ -7,9 +7,8 @@
*/
package scom.tutorials.tutorial1;

import scom.It;

import java.util.ArrayList;
import scom.It;

public class ItSuccessorF extends It
{
Expand Down
8 changes: 4 additions & 4 deletions tutorials/tutorial1/Tutorial1.java
Expand Up @@ -7,7 +7,6 @@
*/
package scom.tutorials.tutorial1;

import scom.tutorials.tutorial1.ItSuccessorF;
import scom.It;
import static scom.It.*;

Expand All @@ -23,16 +22,17 @@ public static void main(String[] args)
It item = New(K_VALUE, "this is item1")
.putFacet(NAME, New("item1"))
.putFacet("version", New("1.01"))
.putFacet(ItSuccessorF.BASENAME, New(K_FUNCTION, "successor", ItSuccessorF.CLASS_NAME));
.putFacet(ItSuccessorF.BASENAME, New(ItSuccessorF.BASENAME, ItSuccessorF.BASENAME, ItSuccessorF.CLASS_NAME));
Print(item);
Print(" successeur de '" + item + "': " + item.getFacet(ItSuccessorF.BASENAME).evaluate(New(2)));
//----- 'item1' It instance


//----- 'Voiture' class -----
It voiture_class_it = NewClass("Voiture")
//It voiture_class_it = NewClass("Voiture")
It voiture_class_it = New("Voiture", METACLASS)
.putFacet(K_MOTOR, New("rolls royce"))
.putFacet(ItSuccessorF.BASENAME, New(K_FUNCTION, "successor", ItSuccessorF.CLASS_NAME));
.putFacet(ItSuccessorF.BASENAME, New(ItSuccessorF.BASENAME, "successor", ItSuccessorF.CLASS_NAME));

It ma_voiture = New(voiture_class_it);
Print(ma_voiture);
Expand Down

0 comments on commit 717f9b9

Please sign in to comment.