Slashdot Mirror


Lit Window Library 0.3 released

hajokirchhoff writes "The first public release of The Lit Window Library (for C++) is now available at from LitWindow itself. The goal of The Lit Window Library is to speed up C++ GUI coding by a factor of 10. It greatly reduces the amount of work needed to code user interface requirements. This is not just another "better widgets" library. The library introduces two new, different concepts to UI coding: a data abstraction layer (reflections) and rule-based programming."

These will eventually allow the creation of a library of high-level UI design patterns such as "Add/Modify/Delete", "Select 1 of n, m of n", ready to be used out of the box, yet tightly integrated into ordinary C++ code.

Data Abstraction Layer:

While most libraries force their data structures on the programmer, the data abstraction layer enables the library to use almost any struct/class definition or container chosen by the programmer. The library works even with third party data structures, over which a programmer has no control.

Rules based programming:

The library adds a new element to the "Properties, Methods, Events" GUI coding paradigm. The "Rules" mechanism lets a programmer describe the interactions between widgets in a simple rule language. This elminiates the countless OnSomething methods that litter todays GUI source code.

For a comparison between traditional C++ source code and the Lit Window Library read
http://www.litwindow.com/lwl/doc/html/comparison_1 0x.html.

Release and licence:

The library is being released as an open source project hosted at sourceforge and made available under the BSD licence and The wxWidgets Library Licence. The library is using C++ and currently supports wxWidget as the UI framework. Other frameworks may follow.

Comments and feedback is very welcome.

Wanted: Volunteers with linux knowhow to help with porting. Good knowledge of C++ templates and compiler limitations/bugs concerning templates would be very good."

29 comments

  1. leakage by Anonymous Coward · · Score: 0

    Yes but will it fix my memory leaks?

    fp0st

  2. Long way to go. by Circuit+Breaker · · Score: 3, Interesting

    Will probably converge to K or APL eventually.


    When it is comparable to this example (yes, the text above is both the logic and the GUI for the game below), or this calculator or spreadsheet implementations I'll be impressed.
    It may look obfuscated, but it isn't to one versed in K programming. And if you aren't versed, anything (except perhaps Python) looks obfuscated.

    1. Re:Long way to go. by Anonymous Coward · · Score: 0, Flamebait

      Frankly, I'd rather be gang-raped by burly men using giant squashes than have to become versed in K programming - it makes Perl look readable, and that's saying something.

      I measure the quality of code by (a) how easy it is to read and (b) how easy it is to write. K fails it. Come back when you've learned the difference between unnecessary verbiosity (Java's problem) and useful information encoded in variable and function names.

      In case you haven't got the message yet - K is never going to be a popular language. Sorry, but we all have our favourite toy languages, and most of us do eventually wake up and smell the Java...

    2. Re:Long way to go. by tilk · · Score: 2, Insightful

      Hey, but it IS ugly and obfuscated. The )@\:&/'s make me think about Befunge, and `l`x`k's about Unlambda. It's cryptic, hides structure and meaning.

    3. Re:Long way to go. by parla · · Score: 1
      I worked at a company which had a very C++-like scripting language with added UI elements. This meant you could write stuff like this:
      STRING c = "Title"
      class FOO {
      public:
      FOO(STRING a, INT b, DOUBLE c, FLAG f) : a(a), b(b), c(c), f(f) {}
      STRING a;
      INT b;
      DOUBLE c;
      FLAG f;
      };
      window (caption=c) {
      // A button that changes the caption of the window
      button (caption="Foo", icon="foo.ico") {
      c = "New Title"; // changes caption of window
      };
      vector<FOO> test;
      test.push_back(FOO("list 1", 1, 1.0, TRUE));
      test.push_back(FOO("list 2", 2, 2.0, FALSE));
      test.push_back(FOO("list 3", 3, 3.0, TRUE));
      // A multi-column listbox
      listbox(test) {
      toggle(test[row].f);
      enter(test[row].a); // in place editable
      show(test[row].b);
      enter(test[row].c); // in place editable, and checks DOUBLE format
      };
      // Also weird stuff like this
      // Which in this case gives you three buttons
      for (UINT i = 0; i < test.size(); ++i) {
      button (caption=test[i].a) {
      test[i].b++;
      }, // comma means put the next widget besides as opposed to below as implied by semicolon
      }
      }
      All of this also was automagically resizable with splitters between EVERYTHING that could resize..
      (ok, why does the ecode element remove all my spaces and tabs?)
    4. Re:Long way to go. by Circuit+Breaker · · Score: 1

      I know K is never going to be popular. Neither will Lisp or for that matter, any other language that has a nontrivial learning curve.

      I'm really sorry that you have to smell the Java. Really. I hope you'll be able to enjoy programming once more some day.

      Readability is relative to knowledge. How much is "1/2"? In C it is 0; In Pascal it is 0.5. What happens in "if (peace or destroy(world))"? In Pascal, it is undefined. In C (assuming "#define or ||"), it will destroy the world only if there is no peace.

      is "object.frobnicateOtherObject(other)" more readable than "+/v" ?

    5. Re:Long way to go. by Circuit+Breaker · · Score: 1

      Maximum substring sum is written in K tersely as "|/0(0|+)\" and verbosely as "max over 0 (0 max plus) scan". More readable?

      It's notation for semantics, and the semantics are what you're missing. K is not readable with just knowledge of C/Java/Lisp; It has a learning curve. But it is well worth it - can you do the max substring sum _efficiently_ in 9 chars?

    6. Re:Long way to go. by SamNmaX · · Score: 2, Insightful
      Will probably converge to K or APL eventually.

      When it is comparable to this example (yes, the text above is both the logic and the GUI for the game below), or this calculator or spreadsheet implementations I'll be impressed. It may look obfuscated, but it isn't to one versed in K programming. And if you aren't versed, anything (except perhaps Python) looks obfuscated.

      I did some J programming a little while back, and K as far as I understand is similar. Anyway, code I wrote in J definately did not look like some fo those horrible strings of who-knows-what those example have. Code in J just has to be broken up the code into smaller chunks, and you have to comment it well. I found it to be necessary to write more comments than code in order to make things readable, as language itself was not. (not a good thing, imo) Just because the language makes it easy to shove a whole lot of 'code' into a line, doesn't mean that's what you should be doing.

    7. Re:Long way to go. by dustman · · Score: 1

      "max over 0 (0 max plus) scan" is not very readable to me. But, the fact that I don't understand this statement is relatively unimportant.

      It's a pretty straightforward translation that you've offer, "|/0(0|+)\" is "max over 0 (0 max plus) scan". Each character in the first translates 1:1 into terms in the second...

      But, why even bother with the first notation? It's pretty ridiculous. *Anyone*, even an expert in the language, would have an easier time reading the verbose version.

      Representing "Maximum substring sum" with the "verbose" form is still plenty tight enough...

      Introducing this "terse line noise" form just increases the barrier to entry.

    8. Re:Long way to go. by Anonymous Coward · · Score: 0
      if(state_array & IS_PLAIN_OLD_TEXT & USE_ECODE)
      {
      work();
      }
      else
      {
      dont_work();
      }
    9. Re:Long way to go. by Julian+Morrison · · Score: 1

      is "object.frobnicateOtherObject(other)" more readable than "+/v" ?

      Yes.

      Although, I still prefer the Ada way around for object messages. That would be something like Frobnicate_Other_Object (object, other) - since this means you don't get a messy syntactic difference between methods defined "in" the object, versus methods defined "outside but using" the object.

      (frobnicateOtherObject is still a dumb function name. "frobnicate" isn't meaningful enough and "OtherObject" is semantically redundant.)

    10. Re:Long way to go. by wabewalker · · Score: 1
      Introducing this "terse line noise" form just increases the barrier to entry.

      True, but it doesn't mean it isn't worth it. To use Perl and Python, Emacs and VI effectively, you need to know regular expressions. They are usually terse line noise but it's a powerful tool once you've learnt it.
      --
      --- Premature complacency is the evil of all roots
  3. The logical next step by mattgreen · · Score: 1

    Part of me knew that despite .Net getting GUI development completely right, that there was still a better way to express constraints in GUI programming beyond glorified code generators. This looks like exactly the ticket.

    Who wants to work on a WTL port of this?

    1. Re:The logical next step by jdowland · · Score: 1

      .net got GUI development completely right? Please enlighten me, for I am not well versed in the .net stuff, but getting GUI development completely right is something I'd like to understand.

      How does .net handle seperating the UI logic from the code? Can you take an application and switch the UI to something different, like a text-based or web-based one, with minimal reworking of the application logic? How are accessibility issues dealt with? How do you unit test the UI?

  4. Show me the code. by noselasd · · Score: 1

    Cut the fancy talk. How does some "simple" code look like ?

    1. Re:Show me the code. by Anonymous Coward · · Score: 0

      What about the link, that is mentioned in the article?

    2. Re:Show me the code. by hajokirchhoff · · Score: 2, Informative

      Here, as advertised on the homepage:

      http://www.litwindow.com/lwl/doc/html/comparison_1 0x.html

      or here for a real-world example:

      tutorial for a simple rssreader (incomplete)

  5. Java by Hard_Code · · Score: 2, Interesting

    Hehe...I chuckled as I read the first two examples in documentation, loading and saving settings, and showing a specific type of dialog, since these two utilities are almost identically what is used in Java to do the same:

    Properties p = new Properties();
    p.load(new FileInputStream("/path/to/Settings"));

    ---

    JOptionPane.showMessageDialog(null, "hi!");

    Notwithstanding that we still complain.

    Apparently what C++ needs is just a decent platform and standard library.

    --

    It's 10 PM. Do you know if you're un-American?
    1. Re:Java by hajokirchhoff · · Score: 1

      Do reflections in java support containers? And if so, can you extend them to add your own container implementation?

      IOW: does p.load(...) work if p contains a vector of elements (that may itself contain another vector)?

      And, yes, I agree. C++ needs a decent standard library and reflections should be part of it :)

    2. Re:Java by Hard_Code · · Score: 1

      The facility I was citing does not use reflection. The Properties class is simply a hash table which reads a file in the format:

      key=value...

      However, there IS a full-fledged Preferences API which I believe is capable of storing an arbitrary hierarchy of objects, which was introduced due to the deficiencies of stashing flat settings files in user directories (I never personally had a problem with that strategy).

      You can do reflection in Java, but it is a bit cumbersome, and it's too late in the lifespan of the language to go back and redo all that plumbing. For instance, C# introduced the concept of delegates precisely because it was just a PITA to write these little anonymous handler classes...it's just so much easier to say "hey guy, just call this thing I point to". Although there are some Java frameworks and language mods that allow this, it is not easily done out of the box.

      --

      It's 10 PM. Do you know if you're un-American?
    3. Re:Java by Anonymous Coward · · Score: 0

      Way to *not* understand the examples. But what do you expect from java programmers in general? To never ever learn any new language, never mind that it would improve their java skills. Instead roam any semi-relevant forum and try to boost java at any chance you get.

      Because while people are waking up and smelling the coffee, you java people are losing your jobs. Oh, apart from the bank industry and other thins you are so rpoud of - you know what? It's just COBOL once again. The banks bought into something and now they have to follow through.

      I'd actually have some respect for your views if you ever actually had tried any other languages. But no, "it's the holy grail of everything and the bible tells me everything I need to know. I don't need no stinking progress."

      Here, for you who think I'm trolling (and maybe wants to bite): There isn't one single thing java does best, and it is not especially general, lightweight, effecient, fast to write, easy to read or anything like that. What, exactly is the benefit of this language? Hell, I could just say Perl, or Ruby.. or maybe even Python to have you beat on all of those, and execution speed is not unsimilar (except for python, which is hella-slow).

  6. Boost? by genneth · · Score: 1

    How far does this fit w/ the stuff that Boost is producing? It might be a good idea for it to undergo a boost review process at some point, so that some _really_ funky template-foo can be done. Plus, some components of what he's produced could probably be boostifid. For instance, the semantics + syntax of "rules" is very similar to Spirit's rules; perhaps there's a common abstraction there?

    1. Re:Boost? by hajokirchhoff · · Score: 2, Interesting

      I'd love to use boost and probably will at some point in the future. I all but stole the semantics for + from boost anyway. I didn't use boost at this point because I want to support wxWidgets and that in turn still supports some rather old compilers and I was unsure how well the boost library compiles with them. I also did not want to require yet another library.

      But I agree that I'd love to see some convergence with the boost library.

      BTW, whats the 'boost review process'? I have browsed the boost documentation, but don't follow the boost development.

      Hajo

    2. Re:Boost? by genneth · · Score: 1

      The boost review process is where you simply submit some code, and ask for feedback. It usually follows a request for insertion into boost. The boost people really are the C++ guru's of our day, and they seem to have a philosophy of solid design above everything else.

  7. GUI Language by descubes · · Score: 2, Interesting

    From a concept-programming standpoint, LitWindow seems to be a sort of hacked-together meta-programming language for GUIs. The concepts are good, but the implementation is sorely limited by the language they use (C++).

    For instance, their data adapter are the poor's man meta-program generating useful reflective data from a data structure. You actually need to duplicate the description of the data structure, precisely because this is not a _real_ meta-program, but only a clever hack using the C preprocessor...

    Now, what if you had a real way to extend the language as you need it, rather than this crude hack? Wouldn't it be cool if the data adapters could be generated automagically?

    --
    -- Did you try Tao3D? http://tao3d.sourceforge.net
    1. Re:GUI Language by civilizedINTENSITY · · Score: 1

      A real way to extend a language? So you want us to use lisp?

  8. MUI! by EvilIdler · · Score: 3, Interesting

    This is wxWindows meets MUI (Magic User Interface on the Amiga).
    Lovely!

  9. zero memory by BinLadenMyHero · · Score: 1

    I know the parent was (trying to be) funny, but I'll reply seriously, with another new concept on GUI programming: Zero Memory Widget, that uses no memory at all!

  10. Similar to Cocoa Bindings in OS X by rockrat · · Score: 2, Interesting

    The code examples, especially the rule-based GUI coding looks a lot like the Cocoa Bindings system in OS X. I wouldn't be suprised if this library was using something similar to Cocoa's controller layer under the hood. What's impressive is that they're able to do this in C++. Objective-C's more dynamic calling system makes this a lot easier.