Live data from Hacker News

Get Rid of Source Code Templates

hackerboss.com

1–10 of 23 posts

Re: Get Rid of Source Code Templates

#2
I use templates.

My Perl template is:

   use MooseX::Declare;

   class $classname {
   }
My Haskell template is:

   module $module where
If you need anything more complicated than that, it's time to write code to fix the problem, rather than have your editor type the same text again and again and again and again.

Re: Get Rid of Source Code Templates

#3
For smallish (one or a few files) library/API/snippet type stuff, I kind of like the style of putting the authors and changelog at the top of the file, along with brief documentation of using it and a statement of license terms. Bigger libraries will of course have separate ChangeLog and README files and such, but for one-file stuff, I often just end up copying the file into my own project, and it's nice when it's a self-contained file with the relevant info all in there.

How common that is might vary in different programming languages. It's quite common to share Javascript code by just swapping standalone .js files, and it's not uncommon in the Lisp world either.

Re: Get Rid of Source Code Templates

#4
post #2

I use templates. My Perl template is: use MooseX::Declare; class $classname { } My Haskell template is: module $module where If you need anything more complicated than that, it's time to write code to fix the problem, rather than have your editor type the same text again and again and again and again.

Comment not related to the article.

The "templates" the article is talking about are large boilerplate comment blocks at the top of source code files, with license, attribution, changelog, etc. information. Nothing about executable code.

Re: Get Rid of Source Code Templates

#6
post #4
post #2

I use templates. My Perl template is: use MooseX::Declare; class $classname { } My Haskell template is: module $module where If you need anything more complicated than that, it's time to write code to fix the problem, rather than have your editor type the same text again and again and again and again.

Comment not related to the article. The "templates" the article is talking about are large boilerplate comment blocks at the top of source code files, with license, attribution, changelog, etc. information. Nothing about executable code.

Yup, and my templates include that section.

Re: Get Rid of Source Code Templates

#7
Errr, but how does someone know that something is copyrighted and what license if nobody is writing this info? Who do i contact when i have no info of copyright and want to use some others code?

It may be ridiculous for that author but it's quite important.

Re: Get Rid of Source Code Templates

#9
I don't know. I didn't find the article interesting. I mean copyright, comments and what not on files...? Come on!

These templates are written for a reason. Some companies DO write templates to make their files "standard". This is nothing new especially in a corporate environment.

Re: Get Rid of Source Code Templates

#10
Yikes!

"This means that you don’t need to do anything to have copyright over your works."

But you DO need a copyright notice to collect damages for infringement. Without a notice, the most you can get is an injunction to stop infringement.

"Often, source code files repeat the file name in the file itself."

So you can tell which file when printing, or when viewing through a broken web interface.

Post reply on HN