Converting code from NetLogo

M

Max

Is there an easy way to convert code from NetLogo to Java? If so, what
is it? I've been using NetLogo for a few years, and would alike to be
able to re-use at least some of my old code in Java.
 
J

John W. Kennedy

Max said:
Is there an easy way to convert code from NetLogo to Java? If so, what
is it? I've been using NetLogo for a few years, and would alike to be
able to re-use at least some of my old code in Java.

No. They are nearly as different as Shakespeare and Algebra.

Moreover, Java is a much worse language than NetLogo to write the sort
of program that NetLogo is designed for. Why buy a forest and cut down
the trees in it to build your house with when you can buy pre-cut lumber?

However, because NetLogo is written in Java, and they provide an API,
you can use Java /with/ NetLogo, if you need to write a program that
combines the sort of thing that NetLogo does with some bits that are
awkward or impractical in that language.

--
John W. Kennedy
"Give up vows and dogmas, and fixed things, and you may grow like That.
....you may come to think a blow bad, because it hurts, and not because
it humiliates. You may come to think murder wrong, because it is
violent, and not because it is unjust."
-- G. K. Chesterton. "The Ball and the Cross"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
M

Max

No. They are nearly as different as Shakespeare and Algebra.
Moreover, Java is a much worse language than NetLogo to write the sort
of program that NetLogo is designed for. Why buy a forest and cut down
the trees in it to build your house with when you can buy pre-cut lumber?

I guess my message was unclear, but I wasn't wanting to convert an
entire program, just take pieces of code from a NetLogo model to a
Java applet. I'd rather not completely re-write what I've already done.
 
O

Oliver Wong

Max said:
Is there an easy way to convert code from NetLogo to Java? If so, what
is it? I've been using NetLogo for a few years, and would alike to be
able to re-use at least some of my old code in Java.

Have you considered asking a NetLogo discussion group? Given that
NetLogo is implemented in Java, I suspect most "advanced" NetLogo
programmers will know of Java, whereas most "advanced" Java programmers
will never have heard of NetLogo before.

As someone who has never heard of NetLogo before, a quick glance at
their webpage reveals no Java API that the "NetLogo engine" (my
terminology, they don't actually name it that) exposes for your Java
program to interact with, and the project doesn't seem to be open source.
The worst case scenario seems to be for you to manually implement a
NetLogo parser yourself, providing hooks so that your Java code can invoke
NetLogo code.

- Oliver
 
J

John W. Kennedy

Max said:
I guess my message was unclear, but I wasn't wanting to convert an
entire program, just take pieces of code from a NetLogo model to a
Java applet. I'd rather not completely re-write what I've already done.

Well, as I say, the two languages are about as different as two computer
languages can be, and if NetLogo is the only language you know,
acquiring facility in Java is going to take a while -- about a year. I
/do/ recommend it, if you're serious about programming. Languages of the
NetLogo family are very, very powerful for what they're designed to do,
but they tend to break down on problems they're not meant for. Java is a
pretty good example of the current state of the art in mainstream,
general-purpose languages. That's why the creators of NetLogo used Java
to write NetLogo in.

--
John W. Kennedy
"I want everybody to be smart. As smart as they can be. A world of
ignorant people is too dangerous to live in."
-- Garson Kanin. "Born Yesterday"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
J

John W. Kennedy

Oliver said:
As someone who has never heard of NetLogo before, a quick glance at
their webpage reveals no Java API that the "NetLogo engine" (my
terminology, they don't actually name it that) exposes for your Java
program to interact with,

Actually, they do. It's in the "Extensions" chapter of the manual.
and the project doesn't seem to be open source.

Not, they say, until they've cleaned up the source enough so they're not
ashamed to publish it.


--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
* TagZilla 0.066 * http://tagzilla.mozdev.org
 
M

Max

I'll just have to re-write it. It really isn't too much code, just
something that works already.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,260
Messages
2,571,038
Members
48,768
Latest member
first4landlord

Latest Threads

Top