May 14, 2011
This should be also be posted on the Announce list!

I'm considering D for web develoment and your libs provide a nice solution, the only issue is until now we would have to dig on this NewsGroup for your posts (the big ones), so that we could have an ideia how to use them.

I would also like to suggest to you if possible, start hosting your scripts using a VCS, would be nice to spot your updates and changes.

Any way thank you for sharing your amazing work.

Adam D.  Ruppe wrote:
> For people who haven't read about this, I just wrote up a quick document about it:
> 
> http://arsdnet.net/web.d/dom.html
> 
> I really rambled at points, but I wanted to cover all the bases.

May 14, 2011
"Alexander" <aldem+dmars@nk7.net> wrote in message news:iqm4ru$qj3$1@digitalmars.com...
> On 13.05.2011 17:19, Adam D. Ruppe wrote:
>
>> It's *much* better, especially for rapid development. The compiler will tell me if my changes anywhere break things anywhere else, so I can modify with confidence.
>
>  Sure, there are many pros. And one significant drawback - it couldn't be
> easily embedded into HTML code.
>
>  Either, you have to generate all your pages from inside of CGI script, or
> use templates - but the main advantage of PHP is that you can mix it with
> page text.
>

That's not an advantage at all. That was considered an advantage of PHP (and ASP) ages ago, but then web developers quickly discovered that was a horrible, horrible thing to do and caused nothing but terrible code. Even the PHP/ASP worlds have pretty much abandoned that, and for good reason.


May 14, 2011
On 14.05.2011 17:13, Adam Ruppe wrote:

> 1) I wrote a little program called dhp.d - write D in a PHP style.

  Not really a solution. It doesn't work like PHP/ASP do - the result cannot communicate with other pages even if you implement the caching.

  Basically, you have to implement the whole framework around this, and somehow find a way to share the data etc - which is not so trivial in D right now.

> 2) While you could do it, you shouldn't do it. This is bad form even in PHP. See part of my DOM template writeup for a brief on why: http://arsdnet.net/web.d/dom.html

  Sorry, not very convincing. There are many people and many solutions, your is not universal, unfortunately.

  When I say "not universal" - I mean simply "not everyone will like and use it" (I don't like DOM and XML, for instance - so I try to avoid them as much as possible).

  Different developers do things in different way, that's why embedding code in web-pages (PHP/ASP way) is (for some people and/or applications, at least) is more preferred or productive.

> Basically, it gets ugly, fast.

  Depends on how you do this ;)

/Alexander
May 14, 2011
On 14.05.2011 21:48, Nick Sabalausky wrote:

> That's not an advantage at all. That was considered an advantage of PHP (and ASP) ages ago, but then web developers quickly discovered that was a horrible, horrible thing to do and caused nothing but terrible code.

  *All* developers? ;) Sorry, I've to disagree - still there are way too many projects where this is not considered "horrible" (just two quite popular examples - Drupal & Wordpress).

> Even the PHP/ASP worlds have pretty much abandoned that, and for good reason.

  Many examples in documentation (both for PHP and ASP), including various tutorials, show how to mix the code and the data - this means "abandoned"?

  Perhaps, you could tell me this "good reason"? I see no good reasons, to be honest.

/Alexander
May 14, 2011
>   Not really a solution. It doesn't work like PHP/ASP do - the result
> cannot communicate with other pages even if you implement the caching.

Can you show me a PHP example showing what you mean? I can't think of anything you can do in PHP that D can't do at least as well. If by communicating with other pages you mean something like php's include(), that's trivial (just include the file here too!)
May 14, 2011
>  *All* developers? ;) Sorry, I've to disagree - still there are way
> too many projects where this is not considered "horrible" (just two
> quite popular examples - Drupal & Wordpress).

#1: Wordpress /is/ horrible. One of the worst projects I have to deal with for work... (in the OT subthread where I talked about immutable $_POST, that was inspired by some awful code inside Wordpress!) The template system (see next) has lots of required boilerplate and ugliness too. Take a look at twentyten/header.php for some examples.

#2: Even Wordpress doesn't mix code with output very often - it uses a template system too - the themes folder. Sure, PHP is it's template language, but it does separate the main code from the template code. It fits under the category of disciplined php I touched upon in my document.


I don't know drupal so I can't comment on that.
May 15, 2011
Yea, I'm going to start storing or at least linking some of my writings in that new web.d directory so it will be easier to find.

For a version control system though, blargh, it always feels like
extra work to me. I very rarely use them at all. Most my basic libs
though are pretty stable now. cgi.d and dom.d are both in good shape.
(cgi.d did recently get new cache control functions. I discussed that
in a forum post here: http://www.sveit.com/forum/viewtopic.php?f=25&t=3407

But, the core of it, is pretty much done to me.)

The actual web.d file though - the site/api generator - has been getting a lot of changes these last couple weeks. It's in a state of rapid change now since I've started using it on some more projects.


Once that part is solid, I'll write about it in that new folder and post some links to the announce group.
May 15, 2011
"Alexander" <aldem+dmars@nk7.net> wrote in message news:iqmrh6$22b0$1@digitalmars.com...
> On 14.05.2011 21:48, Nick Sabalausky wrote:
>
>> That's not an advantage at all. That was considered an advantage of PHP
>> (and
>> ASP) ages ago, but then web developers quickly discovered that was a
>> horrible, horrible thing to do and caused nothing but terrible code.
>
>  *All* developers? ;) Sorry, I've to disagree - still there are way too
> many projects where this is not considered "horrible"

There's always shitty programmers out there. *Especially* in web development.

> (just two quite popular examples - Drupal & Wordpress).
>

Not familiar with drupal. Wordpress is pure shit. And no, popularity does *not* equate to quality.


>> Even the PHP/ASP worlds have pretty much abandoned that, and for good reason.
>
>  Many examples in documentation (both for PHP and ASP), including various
> tutorials, show how to mix the code and the data - this means "abandoned"?
>

You're being extremely nitpicky.

>  Perhaps, you could tell me this "good reason"? I see no good reasons, to
> be honest.
>

Do it professionally for a few years and you'll see the reasons.




May 15, 2011
"Nick Sabalausky" <a@a.a> wrote in message news:iqnl10$au2$1@digitalmars.com...
> "Alexander" <aldem+dmars@nk7.net> wrote in message news:iqmrh6$22b0$1@digitalmars.com...
>> On 14.05.2011 21:48, Nick Sabalausky wrote:
>>
>>> That's not an advantage at all. That was considered an advantage of PHP
>>> (and
>>> ASP) ages ago, but then web developers quickly discovered that was a
>>> horrible, horrible thing to do and caused nothing but terrible code.
>>
>>  *All* developers? ;) Sorry, I've to disagree - still there are way too
>> many projects where this is not considered "horrible"
>
> There's always shitty programmers out there. *Especially* in web development.
>

As an example, I once worked at a place where the code was all VB6, it was filled with meaningless variable names like "stbbb" and "aaa", and they frequently used the following idiom:

If {condition} Then
    {do stuff}
    Goto label
End If
{do stuff}
label:

All of that *was considered acceptable practice*. But the fact they found it acceptable obviously doesn't change the fact that those are horrible practices: it just meant they were a bunch of complete fucking amateur morons. And such people are *all over* web development. Full time, with a salary. It's pathetic, but very, very true. So no, of course not "all" developers consider classic-style-PHP code/html-mixing to be horrible, but the ones who actually have at least somewhat of a clue what the hell they're doing certainly do.


May 15, 2011
"Adam D. Ruppe" <destructionator@gmail.com> wrote in message news:iqkbm3$8gc$1@digitalmars.com...
> Nick Sabalausky wrote:
>> Be glad it's not VB6, or worse, VBScript.
>
> Oh, I know it! One of my side jobs I picked up this year is maintaining somd old VBS program, using classic ASP.
>
> There's so much nonsense. It doesn't help that the original author was horribly incompetent - he never used functions/subs, just copy and pasted everything. Over and over and over again.
>
> (And to make it worse, the authors apparently didn't know HTML. Not a single standard link or form. *everything* is done as javascript or client side vbscript - mixed at random - calls in href attrs.)
>

Ouch. I've been to sites that couldn't figure out how to make a link without JS. It gives you the same sort of feeling as watching a perfectly healthy grown adult be unable to...I dunno, insert anything blatantly obvious that most toddlers have mastered here. ;)

>
> My biggest problem when writing code for them though is that I instinctively put semicolons at the end of thoughts....
>

Heh, I have the exact same problem anytime I use a no-semicolon language. :)

>> CGI has had a stigma of high startup costs
>
> I'm now convinced almost all of CGI's bad reputation is actually Perl's problems that got misattributed.
>

Yea, I don't that. Especially since I've started noticing at least one shared web host that took "CGI" to mean "Perl and Python".