CyberShadow / DFeed

D news aggregator, newsgroup client, web newsreader and IRC bot
http://forum.dlang.org/help#about
381 stars 35 forks source link

Organize files #39

Closed Paxa closed 10 years ago

Paxa commented 10 years ago

I think currently there are too many files in root folder. Also source code side by side with sql, readme, text files.

I create folders: services, tools, news_sources.

What do you think about this changes?


I also thinking to move database related code to smaller files and make it more structured, may be create folder ./database and ./database/models.

And create folder syncronizers. But I don't understand completely how it works now...

CyberShadow commented 10 years ago

I'm not sure about this change, it changes much but in practice it improves little. I (and anyone else who already has it installed) may need to adapt server scripts for these changes.

Paxa commented 10 years ago

In this case we can leave executable files in root folder, and move other source code files to folder source and make some structure inside it.

.
mldownload.d
nntpdownload.d
rebuilddb.d
rebuildthreads.d
sanitizedb.d
sendspamfeedback.d
dfeed_web.d
data/
README.md
source/
  vendor/ae
  database/
  services/
  news_sources/
  ...

Or just make a small files for executables:

import tools.nntpdownload;

void main(string[] args) {
  return NntpDownloader.execute();
}

Do you really like to have plenty files with different responsibility in root folder?

Paxa commented 10 years ago

In this case we can leave executable files in root folder, and move other source code files to folder source and make some structure inside it.

.
mldownload.d
nntpdownload.d
rebuilddb.d
rebuildthreads.d
sanitizedb.d
sendspamfeedback.d
dfeed_web.d
data/
README.md
source/
  vendor/ae
  database/
  services/
  news_sources/
  ...

Or just make a small files for executables:

import tools.nntpdownload;

void main(string[] args) {
  return NntpDownloader.execute();
}

Do you really like to have plenty files with different responsibility in root folder?

CyberShadow commented 10 years ago

Do you really like to have plenty files with different responsibility in root folder?

It doesn't bother me at all. I would waste (marginally) more time navigating folders.

It's also not outside established D conventions, see e.g. the mostly-flat layout of Phobos.

Paxa commented 10 years ago

If you like flat, I think you should keep it then. I'm sorry for interrupting you.

I make a quick look and see phobos is not so flat, root folder contain only 1 D source code file, rest is quite structured. Even there are many files in "std" but logically they belongs to one domain.

For me it feels more fresh and clean when files are cotegprized and there is a room for improvements and new functions without needs to do refactoring. This also make easier and faster for new developers to get in, because that not make them scare. And when I see usage of class somewhere, I know I can find it in file with same name as class (but use a underscore style for filenames).

Then later can write tests, so for one class - one file with code and one file for tests testing (with a same name + '_test' in tests folder).

I know in environments where you need to require every dependency in every file is more hard to have smaller files (e.g. nodejs, python, go) rather when you can include all once in one file.

I also check some projects on http://code.dlang.org/ and most of them have folder "source" or "lib" but not all-in-root-folder structure.


I started to look at this project because I want to implement markdown for D forum. I think tools are important for performance and level of happiness, and tool that used by coders to communicate should have nice way to show a source code. Like github have :)

But as I see it's harder then I thought :( or may be that people are fine with inconvenience.

CyberShadow commented 10 years ago

I'll think about splitting things into packages it if I'll need to grow the codebase.

I started to look at this project because I want to implement markdown for D forum.

This has been suggested before. We will not be adding Markdown / phpBB / HTML etc. to the forum, because the forum is actually just a web interface for NNTP, and the same content is read and authored by users of other clients - webmail, email clients, news readers. Then problems arise when someone writes a message where formatting is important, and others can't see it; or, when someone writes a plain-text message which accidentally triggers formatting codes and messes up the message for forum users.

The Vibe.d forums have markdown, and you can routinely find examples of misformatted posts. Markdown would be sensible for forums which allow editing a post after sending it, but since you can't un-send an email, this is not possible for DFeed.

Paxa commented 10 years ago

Well github also sending email and nobody can unsend or edit emails, but we still able to edit our messages on github (pull requests, issues, comments)

How many people use nntp and how many people use web interface? I don't even know which client software support this format and I don't know any other project who would support it.

Markdown is very powerful and designed to make readable text looks good. If you don't know syntax andd afraid what accidently some special characters will be treated as markdown syntax then we can enable only few features. For me I would like to have code formatting (with ` and 4 spaces offset), titles, lists. And we don't need to use code from vibe.d, can have own implementation or use some c library.

One more thing most of developers already use github, stackoverflow, coderwall, tumblr on daily basis, so they already familiar with markdown syntax.

I have idea to keep content in database "as-is" from user, for web render it to html, for email also to html, and for old protocols just remove markdown syntax so it will be as usual text, but keep things what looks natural, like lists, titles with dash and equal (=) underline, horizontal line, source code with 4 space indent

CyberShadow commented 10 years ago

Well github also sending email and nobody can unsend or edit emails

The critical distinction here is that GitHub email users will visit GitHub eventually and will see the updated comment. D NNTP/email users need not visit the forum at all.

How many people use nntp and how many people use web interface?

Last I checked, about half. The forum was created long after the news server and mailing list gateway were put in place, and many of D's long-time/core contributors, including Walter Bright and Andrei Alexandrescu, use newsreaders or email.

Paxa commented 10 years ago

Now I don't open github, just reply to email.Do you think now people don't want to edit their messages and the only reason why users may want to edit messages is markdown? How often you you need to type ‎``` in your message? If you try to use stackoverflow then there will be instant preview‎, to reduce syntax related errors From: Vladimir PanteleevSent: Rabu, 5 November 2014 17.48To: CyberShadow/DFeedReply To: CyberShadow/DFeedCc: PavelSubject: Re: [DFeed] Organize files (#39) Well github also sending email and nobody can unsend or edit emails

The critical distinction here is that GitHub email users will visit GitHub eventually and will see the updated comment. D NNTP/email users need not visit the forum at all.

How many people use nntp and how many people use web interface?

Last I checked, about half. The forum was created long after the news server and mailing list gateway were put in place, and many of D's long-time/core contributors, including Walter Bright and Andrei Alexandrescu, use newsreaders or email.

—Reply to this email directly or view it on GitHub.

CyberShadow commented 10 years ago

As for the file layout, as I said above, I'll consider splitting the code into packages. And as for Markdown, considering all arguments, I don't think there is much to objectively improve here without annoying someone.

IIRC Walter Bright is also opposed to the idea - he even asked me to completely forbid viewing attachments or HTML email parts, something that the forum software currently allows.

If you want to post a long article where formatting would significantly improve its readability, you can create a page on the D Wiki, and post a link to it in your forum message:

http://wiki.dlang.org/

If you want to post a long block of code, where syntax highlighting or previewing the program's output would make it more readable, you can save it on DPaste, and post a link to it in your forum message:

http://dpaste.dzfl.pl/

Links to other resources will be equally accessible to all recipients of your message.

jcd commented 10 years ago

In all fairness attachments and HTML email parts are not readable in plain text viewers but markdown is. And a dpaste.dzlf.pl link does work very well when skimming though all posts.

Paxa commented 10 years ago

But if you want to paste small pieces of code then it's more hard to open every in new tab.

I agree that not everybody able to use markdown, but my idea is provide only few features. I would like to see:



Thats how you write it:

This is big title
===========

This is smaller title
------------------------

* this
* is unordered
* list

Here is horizontal line:

---

    someCodeExample("without syntax highlight")

`` `d
someCodeExample("with syntax highlight")
`` `

> quoted text


Thats how you see it in web interface:

This is big title

This is smaller title

Here is horizontal line:


someCodeExample("without syntax highlight")
someCodeExample("with syntax highlight")

quoted text



Thats how someone with nntp or text-only email client will see it:

This is big title

This is smaller title

* this
* is unordered
* list

Here is horizontal line:
--------------

someCodeExample("without syntax highlight")
someCodeExample("with syntax highlight")

> quoted text

~ ~

p.s. I would like to make smaller font size for big and smaller titles, github shows it too big, and make thiner horizontal line

But as CyberShadow said, this technology is too innovative for D developers, so probably it will never happen

CyberShadow commented 8 years ago

The Man changed his mind, Markdown is on the table again: http://forum.dlang.org/post/nd2fu9$2m9$1@digitalmars.com