If I'm understanding correctly, the desired functionality you require
from such a system is already present.
Templates as they stand, allow you to render content from arbitrary
modules. To compliment this, event callbacks may be delegated to any
specific module. This permits you to build mini-components, that can
function on any given page.
For instance I built a simple login form 'component' which I include
on all my pages. The login component has simple logic, to control the
way it renders itself depending on whether the user is logged in, or
not. If a user/password is submitted, it's received by the login
module for processing.
Is this what you mean by mini-application?
- Tom

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Nitrogen Web Framework for Erlang" group.
To post to this group, send email to nitro...@googlegroups.com
To unsubscribe from this group, send email to nitrogenweb...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/nitrogenweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Happy as a kid in pie that you're on the case.
Nitrogen Parts
1. Allow the encapsulation of a "mini application".
Yes
2. Are modular and shareable.
Yes
3. Contain their own visual interface and back-end logic.
Yes
4. Could be responsible for persisting their own data.
Yes
5. Are stylistically sandboxed so that styling of one does not affect
the other.
Styling could be tricky, but maybe not necessarily so. Probably a matter of how the style tags are factored and named.
- Imagine a control with prompts, labels, input boxes, a submit button (if people still use these things) and, perhaps, a reset buttons -- a simple form.
Some style tags dictating the relative positioning and sizing of these elements are probably best left to hard-wired style tags; e.g. just to maintain the integrity and coherence of the form layout. On the other hand, we may want the page designer to specify the tag for the background and font color independently of the rest of the page, while the border type and width tags are controlled by a master page style sheet.
As you know, the cascading feature of CSS should make this fairly easy to accomplish. The trick is for the Part designer to decide which tags are hard-wired, and which can be configured by the page designer and at what level.
Seems to me that all this should be fairly easy to achieve if each part is enclosed in it's own named DIV.
6. Can talk to each other.
Yes, but not sure we need to go much further with this than allowing a link in one Part to link to a specific display state of another Part. For example, a user can click on a link in a menu of conference speakers, which is display by one Part in the page grid to call up a photo and bio of the speaker for display by another Part in another panel of the page grid.
7. A page containing parts can modify the visual interface or backend
logic through configuration properties or injected functions.
I'm not sure what you mean by this. We'd most certainly want Parts to able to call functions in the back-end logic I'd think. I can't think of why we might want it to work the other way but there may well be.
8. A user can navigate away from a parts page, navigate back, and the
state remains.
Yes
Does this capture everything?
In essence, yes, yes, yes!
Think of it this way, designing a page is like selecting ICs for bin of parts and plugging them into a prototype or circuit board. Each IC may need a bit of surrounding circuitry, in our case, some site-specific prompt language, an image file, or some site, page, or instance-specific styling.
Once the parts are selected and configured at page design time, then the page display logic becomes largely a matter of walking down a list.
> For the most part, Nitrogen Elements fill #'s 1, 2, 3, 4, and 7 above.
Rusty, you are fast becoming my Hero of the Year. And I'm sure you know that you already stand high on my list.
> Admittedly, there are no clear, illustrative samples online, but you
> can see some complex examples if you look at the inplace_textbox or
> wizard controls in the Nitrogen source code. Tom McNulty's login
> example should further illustrate the concept. The key to unlocking
> this support is to set the delegate attribute on your #events. The
> delegate attribute will cause an event to fire back to a
> DelegateModule that you specify rather than the page itself. Very
> simple, very powerful.
A second key, I think, is an explicit set of conventions/protocols/architectural specifications, what have you, that make the Parts as interchangeable and sharable as possible, while still giving the application designer flexibility in morphing the functionality of the Part to his/her specific needs and the page-designer sufficient flexibility to integrate a set of Parts into a page so that they look like they belong together.
A third key might be factoring common functionality across Parts in such a way that a relatively small set does, say, 80% of what we might want to do on a page, while providing a foundation for building ever more specialized Parts that can make a site or web application truly distinctive and special.
If this works the way I hope it would greatly benefit the application developer, the content providers, and the page designer without comprising anything a one-man-band might want to do. The application designer is saved from reinventing the wheel over and over again; freed to concentrate on just that 20% of new stuff that's most interesting and challenging. The content providers and page designers can mix and match parts to create exciting, page designs rich in functionality, working with familiar, consistent elements of great expressive and functional power.
I can imagine a set of Parts that, taken together, would make it very easy to create a fully customized web store, including product display, check-out, shipping, payment, and traffic-auditing modules, admin stuff, etc. (Ah, I can see here where data exchange/coordination between Parts may be more involved than I suggested above. Nothing like a good example to clarify your thinking.)
> An addendum to #2, Nitrogen Elements are certainly not as shareable as
> they could be. We really need a widely adopted Ruby Gems like system
> for Erlang. Someone go make that happen, and figure out how to deal
> with module naming collisions in the process. :)
Are you suggesting an on-line archive of Parts? Maybe developing a set of Parts to implement such a resource would be a good place to start. I'd imagine that with careful factoring, many of the Parts would be quite useful in other applications and other contexts.
> #6 is interesting, as Nitrogen does not currently let elements talk to
> each other. Currently, things only happen when a user clicks/drags/
> mousesover/types something on a page, and then the event goes either
> to the PageModule or a DelegateModule, which can then update the page.
> This is where more thought needs to happen, and more work needs to be
> done.
I trust that you and other Nitrogen wizards are fully up to the task. One day, sigh, I hope I can jump in and help. Maybe we can devote some brainstorming time at Erlang University.
> #5 will require some dirty hacks to happen automatically, as it goes
> against the grain of HTML. You can do this easily enough manually
> through the proper use of CSS classes.
Probably need to run through a number of prototypes to get it right.
> #8 would require URLs with a bunch of extra crap on the end, which
> looks gross, or heavy use of sessions, which decrease scalability. As
> it is now, ALL of a page's state is stored on the page itself (or more
> accurately, in Javacript variables) and the state is shuttled back and
> forth and updated on each postback.
Yes, I worry about this; wonder if connection-specific processes might be a way to go. But my experience is too limited to really weigh in. Actually, it was this problem that first got me thinking seriously about Erlang for some of the stuff I'd like to do.
When I developed a system somewhat along these lines in Cold Fusion for my conference marketing/management system I relied on ugly URLs and some code to more or less automate their formation and management. Actually, two different mechanisms since Cold Fusion forced me to manage URL and POST variables in somewhat different ways. It was all an ugly hack I assure you. Developing some conventions for naming the state variables helped a bit.
> Along a slightly different train of thought, I feel like you might
> have some new ideas about how Parts should actually placed on a
> Nitrogen page? I would be interested to hear more about what you think
> there. In your view, is a page still made up of a module? Is it a
> configuration file? Maybe a parsed template?
How about a simple text list of Parts that gets fed to a page-display controller function? I do something like this in the Python framework that drives my manga, ayatakeo.com. Works great; no idea how it might or might not scale.
> Anyway, I already have some ideas for #6 floating around my brain.
> They are part of a new (and very exciting) Nitrogen feature on the
> horizon. Let's just say it will let Nitrogen do something that that no
> other web framework can do.
Rusty, did I tell you that you are my hero?
All the best,
Lloyd
> As requested, here is how I handled a login box.
Many many thanks for posting this.
> LRP you wanted to keep HTML out of erl files.
Actually, it was Vijay Kandy who expressed concerned about HTML in erl files. For my part, I'm agnostic, since I'm too naive to understand the implications.
I do have a sense that HTML will be essential inside the Part, whether in an erl file or not. For one thing, I think Parts should be enclosed in named DIVs to provide flexibility with discipline in styling. And I can see how HTML and some styling tags would be necessary inside a Part to maintain layout integrity.
Please see my most recent post to Rusty for a few more thoughts on the matter.
> In general I tend to favor simple frameworks that allow me to create
> what I need using basic constructs. As opposed to complex frameworks
> which provide support for adding pre-built components simply.
I totally agree re: simplicity. But it seems to me that the Nitrogen framework can be kept relatively simple. And each Part can be build using basic constructs as far as possible, striving for the greatest possible simplicity consistent with its inherent functionality. Each Part, moreover, should be built under a consistent set of interfaces with other Parts and the Nitrogen framework itself. In other words, if functional complexity is inherent in the Part, it should be encapsulated within the Part.
This, then, would push complexity from the Nitrogen framework off into the individual Parts. As a developer you can be highly productive while working within a simple, consistent framework while delivering ever more sophisticated functionality simply by adding additional Parts to the catalog.
But, I'm with you all the way in this regard, if it turns out that these ideas threaten to compromise the essential elegance of Nitrogen, then I'd be first to say bag 'em.
Tad of background...
I spent a whole bunch of years working with another programmer to build, enhance, and maintain an amazingly full-functioned web-based conference marketing/management system that supported world-class technical conferences around the world.
Our direct liaisons with our primary client were marketing managers who just happened to turn over every year. Each new crop was forever demanding new functionality and changes in existing functionality. We were constantly under intense, immutable deadlines. Hardly even time to test, and no time to document or step back to think about what we were doing.
You can imagine how ugly the code grew over time. We were forever dropping good code off the edge of the table while reinventing the wheel to do something ever so slightly different. Aged me before my time.
A system somewhat along the line of Parts is what we came to in later years. Implementation was ugly as hell under Cold Fusion, partly due to the language, but largely because we were still feeling our way. But it more or less worked. We started to see notable increases in productivity.
I cobbled up a crude next gen as my first Python project. It now drives my web manga, ayatakeo.com. Other than ugly learning curve code, the whole system is very simple in its fundamentals. I looked at it recently and saw that it could be ten times simpler yet.
> Nothing really interesting here.
Quite the contrary. I nominate your login box as the starting point for the very first entry in our official Nitrogen Parts catalog.
Best wishes and thanks again,
Lloyd
-1
for the concept of configuration file. God help me, if ever have to
work in a configuration file.
> for the concept of configuration file. God help me, if ever have to
> work in a configuration file.
Yes, configuration files can be a pain. Can you suggest a simpler alternative?
Best wishes,
LRP
I'd venture that the truest thing one can say about templates is, "different horses for different courses."
Page-level, monolithic templates are fine for relatively simple pages.
But I argue that there is a conceptual mismatch between the way many web developers, particularly those on the programming side, see the web and the way many many sites are presented today, indeed, the way many page content developers and designers conceptualize a web page.
On the one hand, the conceptual unit is the "page." Makes sense, since the page is the basic unit of HTML.
But for well-trained designers the page is simply a frame for a "page grid." Squint your eyes and look at any magazine, newspaper, or even well-designed brochure, and you'll see a mathematical "grid" structure, where each panel in the grid is a container for content. True, many designers spread content over two or more panels, but the basic structure holds.
The grid system is a fundamental concept in many graphic design text books. Why? Because it provides a coherent way of organizing disparate elements of content.
Squint at many, if not most, well-designed, high-traffic websites and you'll see the grid system at work organizing the content. The grid system is like a well-organized closet with shelves and cubby holes -- everything has a place and everything is in its place, whereas a page-oriented design is more like one of my wife's kitchen drawers, everything tossed in a jumble with everything else (I should talk; my closets and drawers are even more disorganized).
Now take a look at amazon.com. I have no idea of how Amazon constructs its pages. Maybe as someone suggested it's a big hairy content management system. Doesn't matter to my basic argument.
Call up page source for the Amazon home page. Now squint your eyes and substitute variables for every substantive element; e.g. in your mind, turn the source into a template. Now imagine a programmer giving you a list of variable names for different dynamic content elements and working through the template to match content item with place-holder in your big, long, hairy template file.
I'm sure no one does it quite this way, but you get the idea.
Now take another look at Amazon's home page. Squint your eyes and you'll see a simple three-column grid, or "make-up" as a designer would say; e.g. left and right side bars surrounding a main content panel.
Look more closely at the top of the grid and you'll see three content elements (personalization line, personal menu, and search bar) that span the content column and right side bar. They're still consistent with the basic grid, but they add visual diversity and interest while keeping content well organized.
Further note that the basic columns contain simple lists of content elements stacked one atop another.
Now, look at the variety of content elements that fill the panels in the grid and think about the code, HTML formating, and CSS styling tags needed to create each element. You'll note that some elements are straight text, some are text and graphics, some made up of hyper links, some form elements, some buttons, and some report data drawn up from a database.
When I talk about "Parts," this is essentially what I'm talking about. Content elements can be abstracted into a set of "Parts," distinguished by underlying logic.
Now imagine a page construction process that goes like this:
1) Programmers provide an inventory of Parts, single-function black boxes of code that can be configured with content and styling to generate content elements.
2) Select the Parts you need to convey the information you want. Enter content for each.
3) Design (or select from an inventory) a page grid, essentially a list of DIVs (see my earlier post for example).
4) Develop (or select from inventory) CSS file(s) for your page
5) Plug parts into the page grid
6) Tweak styles in each part if necessary to maintain stylistic consistency with page.
A system like this:
1) Is conceptually consistent with the way content developers and trained designers think
2) Does not necessarily require the page designer to adopt any additional tools beyond HTML and CSS.
3) Breaks down a potentially confusing task into a set of relatively simple tasks.
4) Content and styling can be configured with a simple text editor on the one hand, or sophisticated GUI tools on the other. Indeed, GUI tools could be an additional layer on top of the simpler system.
If the base system were open-source, then specialized parts and GUI systems could add value to meet specialized requirements or support a variety of business models.
E.g., Parts could be open-source or proprietary; offering the best of both worlds.
5) Encourages substantial code reuse.
6) Pushes code complexity down into the Parts. With careful factoring, code complexity may never even be an issue but for the rarest and most algorithmically challenging Parts.
7) Offers great flexibility. Change the page grid and/or the high-level CSS file and you change the basic look of the page. Reuse content elements across pages. Change a content element with little to no interaction with other content elements.
8) If we fore go fancy GUI content editing and styling tools, then this system can be fairly simple to implement; puts no added burden on the one-man-band web site developer.
9) In my experience with systems that conceptually approach this model I've seen substantial acceleration of productivity.
So, I argue, divide and conquer!
All the best,
Lloyd
> Interesting. I have recently started to play around with grid based approaches
> using the Blueprint-CSS ( https://github.com/joshuaclayton/blueprint-css/tree
)
> and I like it a lot.
Blueprrint-CSS does indeed look interesting. And looks like the people behind know what they're doing from hard experience.
I've only taken a quick look-see, but look forward to spending some serious time looking into it.
> I guess that this still allows for using template-snippets or ehtml
> or whatever, as basis for the generated HTML ?
I would think so. From my experience web content comes about in four ways: entered and edited as page content by content providers (or editorial surrogates); delivered over the network from some remote node; composed as reports from db-based data; or synthesized through some algorithmic method.
Obviously, how content comes about is the essential business of the programmer. But from the point of view of the content provider and page designer (I think of these as roles, not necessarily as separate people), the technical processes behind how content is taken from raw input to display is of little concern, as long it's easy to make happen and it works. Thus, my argument for named, encapsulated, black boxes of code.
> I wonder how these parts should be described to help the 'designer' to choose
> the parts he needs? I'm thinking that perhaps could a template-snippet
> be both the base from where the HTML is generated as well as the documentation
> in a form that the designer will understand?
Those are excellent questions; worth considerable discussion and prototyping.
As to naming, names should clearly reflect functionality as understood by the page developer; e.g. "login1," "textPanel1," "imageWithCaption1," "registrationTool1," etc.
Note that I index the names to allow variations on the same function.
An important convention in building Parts, I believe, would be to provide a short, descriptive paragraph that describes the function of the Part."
In a perfect world there'd be at least one open-source archive of Parts. Developers may well also maintain their own proprietary archives.
> If you are using some kind of 'ehtml' then that need to be documented in some other
> form, or?
I have no opinion yet. I've done much of this, crudely, in Cold Fusion and Python. But I'm still working toward how to Think Erlang.
> Interesting, do there exist any examples of systems built up like
> this?
As noted in an earlier post, I spent some 12 years building and rebuilding a large, full-featured, web-based conference marketing and management system. Written in Cold Fusion with an SQL db back-end, it supported both public pages for marketing the conference; form pages for on-line registration; on-site conference delegate tools for maintaining personal schedules, arranging meetings with experts, etc., etc., etc.; and extensive back-office administrative support. Sort of soup to nuts.
As our thinking evolved, it converged toward the architectural ideas I've been advocating. Each step closer gave us enhanced productivity.
I also built a simple prototype in Python for my manga site, ayatakeo.com.
> Or are we perhaps talking about CMS like systems?
I'm thinking a base system where everything can be done through a text editor. This should be quite adequate for the one-man-band site developer or, even, the tech-savvy web development house.
As I suggested earlier, fancy CMS functionality, GUI tools, etc., can be built on top of the base system. I can imagine half a dozen systems, all designed for different work environments and to meet different requirements, all built on top of the base system.
As stressed earlier, keep it simple; walk before you run.
> Thanx, you really provided some food for thoughts here!
Thank you, Tobbe. I'm pleased that these ideas are sparking interest among serious folks. Hope to see you at Erlang University.
All the best,
Lloyd
> And this is exactly the layout of http://www.tornkvist.org/ :-)
Blueprint-CSS specification looks fairly straight-forward. I need to look deeper.
Your home page is beautiful. I did get an error when I clicked on The Priority List.
You're doing some exciting work, Tobbe!
Best,
Lloyd
> You are wiring components with CSS?
Not sure I'd use the word wiring, but using a CSS file to create the page grid, then interpreting it within body to create the DIVs and call in the components.
> I think that's what Tobbe showed in his example ...
Must have missed this. Will take another look.
Best,
Lloyd
> Apache Tapestry - a simple to use, page-oriented framework with good
> separation: http://tapestry.apache.org/
> JBoss SEAM - a more complex/capable full-application framework:
> http://seamframework.org/
Just took a very quick glance at Tapestry and SEAM. From the little I gather they look rather interesting.
I don't know Java, but people tell me that my thinking about Parts is similar to the Java servlet concept. Do you have a sense of the strengths/limitations of servlets?
Two basic concepts seem to be bubbling under the surface of our thread:
1) Encapsulate code into single-function Parts/components that can be mix, matched, and reused in web pages.
2) Use the existing presentation technologies of HTML, CSS, and Javascript to control where, when, and how Parts/components are called up to deliver content.
Four tricky issues seem to lurk in the dark doorways:
1) How to manage state and state variables
2) How to manage interaction across Parts/components
3) How to deal with persistence requirements of Parts/components
4) How to do this simply and elegantly in Erlang
And a big question:
Is this asking too much of Nitrogen?
Not sure I've got that quite right. Welcome refinement.
If we can find a clear, comprehensive way to frame the issues/questions, then the answers shouldn't be too far behind.
All the best,
Lloyd
--
A while back I began thinking how to make web pages behave more like
regular functions and came up with a few ideas.
The problem with web pages is that they can't call each other and that
each HTML file needs a new file. Why can't I stuff all web pages into
one file. If I have (for example) an abstraction "rounded corner
boxes" why can't I define it *once* and reuse it several times (well I
can but I have to drop into javascript)
Also "what is a web page". A first try at answering this might be "a
function that returns HTML" but this is not good enough. Let's try
again "a function which returns HTML *and HEADERS" - better but not
perfect.
Try again: "A pure function of an environment which contains headers, etc,
and returns HTML and a new environment"
(Note the environment in addition to headers, can contain, for example
the state of a data base etc - the environment contains the *state* of
the session)
At the moment one web page = one HTML file. But this doesn't have to
be so.
In what follows I'll outline a syntax and semantics of a system that
provides composable, side-effect free web pages. I implemented this a
few years ago but haven't done anything with it - it might be nice to
relaunch this in a nitrogen context.
Idea 1)
Stuff many web pages into one file (call these ".web" files)
For example: the file myproj.web
@webpage index(Args)
<title>index</title>
<h1>I am the index</h1>
<p>Go to <a href="page1.html?a=1&b=2">page1</a>
@webpage page1(Args)
<h1>Page 1</h1>
@webpage page2(Args)
...
-- end
This defines three web pages in the same file. When I reference
http://site/myproj/index.html I call the Erlang function
myproj:index(Args) - Args is a data structure containing the HTML
Headers and command arguments
Idea 2)
Web pages can call erlang.
Example:
@webpage index(Args)
<h1>hello</h1>
<? A1 = foo(Args), A2= bar(A1), baz(A2) ?>
<p>
<? z(A2), ... ?>
@webpage ...
The stuff inside <? ... ?> is regular Erlang.
The bindings A1, ... are carried through the function precisely as in the
body of an erlang function.
Semantics: <? E1, E2, ,.. En?> is evaluated. The value of En is pasted
into the HTML and replaces <? ... ?>
Idea 3)
Erlang can call a web page. More tricky this one.
A web page is a function of type Name x Args -> Headers x HTML.
(almost, I'll pretend this is true for now, later I'll make a better
version)
This needs an example:
@webpage index(Args)
<h1>hello</h1>
<? rounded_corner_box("Title", "body") ?>
@webpage mybox(Args)
<div class="..." id=<?newid()?>
<?getArg(title, Args)?>
...
@erl
rounded_corner_box(Title, Body) ->
{Headers, HTML} = mybox([{title, T}, {body,B}]),
HTML.
-- end
Idea 4) Webpages have side effects - update databases etc.
This is actually a generalisation of the the idea of "headers"
Wait a bit to see how this is compiled/translated
---- How is this compiled/translated?
A .web file is *really* just an Erlang module
example: foo.web
@webpage index(Args)
<h1> ....
@webpage page1(Args)
...
@erl
foo(A, B) ->
...
Is compiled into a module foo.erl which exports index/1, page1/1 foo/2
etc.
How is this translated?
Easy - here's an example
foo.web
@webpage index(Args)
<h1>hello</h1>
<? A1=foo(1,2), B=baz(A1), "hello" ?>
<p>bar
@webpage page1(Args)
...
@erl
foo(A, B) ->
..
Is translated into
-module(foo).
-export([index/1]).
index(Args) ->
R1 = <<"<he>hello</h1>">>,
A1 = foo(1,1),
B = baz(A1),
R2 = <<"hello">>,
R3 = <<"<p>bar">>,
{[], [R1,R2,R3]}.
page1(Args) ->
....
Easy :-) (There are better translations, but this way is easy to grok)
R1, R2, ..are new unused variables containing the "result"
Haven't we forgotten anything? - Yes side effects (Headers etc.)
We add a single pseudo variable which *must* be assigned in
a <? ... ?> black, called OUT. The translation is like this:
@webpage foo(Args)
<h1>hello</h1>
<? OUT=[lib:add_header("Context-Type/blaaa")], "" ?>
<p>a
Translates into
foo(Args) ->
R1 = <<"<h1>hello</h1>">>,
Out = [lib:add_header("Context-Type/blaaa")],
R2 = <<""">>,
R3 = <<"<p>a">>,
{Out, [R1,R2,R3]}
....
In some ways this is like PHP, only the sematics is "done right" with
no unecessary side effect (which will make things nicely composable).
/Joe Armstrong
Delighted that you've given this issue thought.
By composable, do you mean web pages that are build on reusable Erlang functions?
Are these functions what you mean by "rounded corner black boxes?"
If so, I'm with you on that. And keeping these functions side-effect free makes good sense based on arguments you've presented elsewhere.
As to definition of a web page, your third definition, "A pure function of an environment which contains headers, etc, and returns HTML and a new environment," rings the most bells for me.
But I have trouble with trying to put the whole web site into one file. Wouldn't it be great if we could. But as I've argued elsewhere in this thread we often have different "roles" involved in the creation of the site -- the programming role, the page content role, and the page design/styling role. Except for those renaissance type one-man-band site developers, each of these role players sees the work of the others as so much noise.
I spent years developing in Cold Fusion, a proprietary predecessor of PHP which uses the same logic embedded in presentation style of development. Believe me, with more complex pages, particularly in the days prior to CSS, it was a bitch.
This, I think is the reason that many frameworks try to separate data from logic and logic from presentation. Yet, you're right, having all those pesky files to dig through can be a pain.
Now, embedding simple id-type tags that reference reusable functions, each with all the functionality that goes within a DIV does make sense to me and is what I've been advocating.
How best to make it happen, however... I just don't know enough Erlang yet to proceed.
With good minds like yours hammering on it, however, I can't help but see a truly stupendous solution somewhere not that far down the line.
All the best,
Lloyd
> I mean a web page is a represented as a pure function with no side effects.
> pageName(InArgs) -> {OutArgs, HTML}
Got it. Thanks.
> Yes - it seems to me that shipping an application an "open" file structure
breaks a basic principle of encapsulation. In my perfect world there would be
a single directory "/apps". To install an application I'd drop a
single file into "/apps" - that's it. To uninstall I delete the file -
after uninstalling the system
shoud be in the same state as it was prior to installing (with the exception of
a log file, that said that I installed and unistalled, etc., possiblly
some settings
that I might want to use if I reinstall later)
It might be valuable here to clarify what we mean by "application."
Is it:
- the web site as a whole?
- a page in the web site?
- a unit of functionality in a page?
I have been arguing for encapsulation of distinct units of functionality.
By unit of functionality I mean a "rounded corner black box," to use your term, that delivers a unit of meaningful information to the ultimate consumer. It might be as simple as a block of text or a site navigation menu. It might be as complex as a sequence of conference registration panels. But in principle, and probably in general, a single web page would be composed of MORE THAN ONE of these "rounded corner black boxes." And the purposes and functionality of each of these units would in all likelihood be different one from another, as would the technical underpinnings.
Given this, I completely agree that our "unit of functionality" should be "composable," e.g. completely encapsulated. But it may be more expedient to encapsulate it within a single directory than within a single file.
Why? Presumably we'd want to reuse our nifty little black box, but in such case we'd want to alter content (text and images) as well as styling.
In contrast, I see major challenges in trying to encompass an entire site or, indeed, an entire page within a single "rounded corner black box." Among other things, we would most definitely lose the virtues of reusability. Why would you want my page in your site?
But given all that, I totally agree that encapsulation at some level would improve ease and productivity of web site construction immeasurably.
> The point is a user shoudl not see the internal structure of an appliction -
a *developer* should see the necessary parts of the structure, necessary for
the the construction. File systems (by exposing everything) break basic
principles of encapsulation (an object is a black box with a defined interface).
With you 100%.
> Better would be that "make_app" creates a single file whies content is
> revealed through a defined interface (like a database, in fact)
Or, as argued above, a single directory.
> I have no real preference here - since I see no differences between
> logic and presentation. presentation *is* (constant) logic
> Imagine a page like like this
> <h1>hello</h1>
> <? aFunctionWhichReturnsHTML(...) ?>
> <p>hello
I would imagine it more as:
<? Function1WhichReturnsHTML(...) ?>
<? Function2WhichReturnsHTML(...) ?>
<? Function3WhichReturnsHTML(...) ?>
No more, no less.
> I see this as a list of functions:
> id("<h1>hello</h1>")
> aFunctionWhichWhenReturnsHTML(...)
> id("<p>hello")
> The id function just returns it's argument (id(X) -> X)
Are we talking about the same thing here? If reflect on the fact that most textual content within typical web pages is more of the form:
<h4>headline</h4>
<p>paragraph of text</p>
<p>another paragraph</p>
<h3>subhead</h3>
<p>paragraph of text</p>
...then I believe we are.
> Web pages with arguments are just lambda abractions
> ie
> <p>hello ${name} you are ${age} years old
> *is* a lambda abstraction
> fun(Name, Age) ->
> ["<p>hello", Name, "you are", Age, "years old"]
> end
OK. But I would see this embedded within our "unit of functionality."
> Viewed this way there is no separation of logic and presentation - everything
is logic :-)
OK
> Another way of thinking might be to view a web page as a process
> containing named holes.
If we substitute "Part," a name that I suggested earlier for our "units of functionality" for "web page" in your above sentence, then everything you argue below makes sense with the added benefit that it enables one "Part" to pass messages to another part within a given page.
All the best,
Lloyd
> Can you (or anyone) help me understand what in your "parts" vision is not
> fulfilled by custom Nitrogen element? (Functionality which already exists in
> Nitrogen.)
> A custom Nitrogen element lets you add to the basic elements provided (such
> as #textbox, #table, #panel, etc.) with elements of your own design (such as
> #loginform, #rssfeed, #feedbackform, etc.) Tom McNulty already posted an
> example of this.
> Am I missing something?
More likely you're seeing my limited understanding of Nitrogen. I don't understand yet how to build out from it, so merely expressing what I'd like to do with it.
My apologies if I've confused the issue or wasted anyone's time.
> I feel like we keep talking about some magical,
> encapsulated, mini-application as if it is some unreachable vision of the
> future, when in reality it already exists, and is what Nitrogen is based on.
Clearly I need to develop a deeper understanding of Nitrogen.
> Maybe the problem is just a lack of documentation?
For me it definitely is an issue. Others seem to catch on... through analysis or intuition I can't say. But I need to follow a few clear examples, experience a bit of success, then experiment to see how I can extend and build on those nuggets of working code.
For me it also helps to have a conceptual overview of the system and how the key subsystems work together. I suppose I should be able to dig that out of source. But I'm just now learning how to do that.
I haven't looked at Nitrogen for several weeks now (last time I did notice and admire your attractive new web design), so maybe there's more there now than I'm aware of.
If I ask naive questions, please bear with me. If I'm uninformed or confused, chances are a few others are too.
Once again, many thanks for your great work with Nitrogen.
Lloyd R. Prentice