On Fri, 4 Jun 1999, Maneesh Yadav wrote: > Ok...I promise this my last post that I use to correct the previous one. No biggie. I'm not too fond of Pine either. ;) > Jim, as far as I cant tell Prism isn't anytning at all except some > renaming of terms that are standard in a normal imperative OO language. Well, if that's what you think, then I've clearly done a poor job of explaining myself. I think that's because I've tried to give too much background. Let me try again: Prism is a specification for a programming environment. It specifies: 1) a meta-metamodel (for uniformly modeling concepts such as programs) 2) a global heap (for containing models) 3) an interpreter (for transforming models) It's nothing like C++. C++ is a language specification; Prism is not. There may be some superficial similarities (such as Prism's meta-metamodel and C++ variables both being used to represent information), but Prism and C++ have nothing in common. Prism's goal is to allow the programmer to use multiple languages to model a program. In my last message, I gave an example of this, but it wasn't a very good one. I've thought about it some more, though, and I've come up with an example that is much different from C++ AND solves a real-world problem: dynamic web serving. Dynamic web-page serving is a difficult software engineering problem because there are two very different groups of people working on a project: programmers, who create the web-page infrastructure, and web designers, who create the web-page content. Each group needs a specialized language to do its task. Programmers need to use a general-purpose imperative language like Perl. Web designers generally don't understand programming and need to work with HTML markup. This leads to a problem, because when you're doing dynamic web serving, the programs have to deliver the HTML. Since the programs must deliver HTML, naive programmers hard-code the HTML into their program in the form of strings. This is a huge problem, because whenever the layout of the page needs to be changed (something the marketing department likes to ask for), the programs have to be re-written. And the web designers don't know how to program. So they layout their pages with HTML, and then the programmers get pulled in to transcribe the HTML into the program. Ideally, the team would use two languages: a page markup language for the web designers, and a general-purpose language for the programmers. Sound familiar? It should, because that's the kind of task Prism is designed for. Here's an example. Two, actually. The first example is written in Java, and shows how a general-purpose language would be used. The second example is fictional and shows how some web-optomized Prism languages might be used to do the same thing. --- Java example --- public class ClockPage extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { resp.setContentType("text/html;charset=ISO-8859-4"); PrintWriter out = resp.getWriter(); out.println("<HTML>"); out.println("<HEAD><TITLE>Time</TITLE></HEAD>"); out.println("<BODY>"); String name = req.getRemoteHost(); if ((name == null) || (name.equals("")) { name = req.getRemoteAddr(); } out.println("<P>Hello! You're reading this from " + name + "!"; Calender today = new Calender(); today.setTime(new Date()); int monthInt = today.get(MONTH); String month = {"January", "February", (etc)}[monthInt]; int dayInt = today.get(DAY_OF_WEEK); String day = {"Monday", "Teusday", (etc)}[dayInt]; int date = today.get(DAY_OF_WEEK_IN_MONTH); out.println("<P>Today is " + day + ", " + month + " " + date + "."); out.println("</BODY>"); out.println("</HTML>"); } --- Prism example --- ** use Prism/TemplatedHtml **Time Hello! You're reading this from ${name}!
Today is ${today.day}, ${today.month} ${today.date}. ** use Prism/WebJava ** public name { if ((name == null) || (name.equals("")) { name = req.getRemoteAddr(); } class date { public String month; public String day; public int date; init { Calender today = new Calender(); int monthInt = today.get(MONTH); month = {"January", "February", (etc)}[monthInt]; int dayInt = today.get(DAY_OF_WEEK); day = {"Monday", "Teusday", (etc)}[dayInt]; date = today.get(DAY_OF_WEEK_IN_MONTH); } } --- End of examples --- Even for this simple problem, I think the advantage of using languages designed for the problem is obvious. Web serving isn't the only situation where this occurs, either... any complex application is going to be composed of multiple parts, each dealing with a separate problem. Here's some of the different things you'll find in applications today: graphical user interfaces distributed processing database access business models 3D graphics ... and much more. All of these things can be done with a general-purpose language and libraries, but I contend that they can be done easier and quicker (and in some cases, by non-programmers) if specialized, interoperable languages are used. That's what Prism is for. Jim Prism is at http://www.teleport.com/~sphere