code-organization

Haskell module naming conventions

我是研究僧i 提交于 2019-12-02 18:52:37
How should I name my Haskell modules for a program, not a library , and organize them in a hierarchy ? I'm making a ray tracer called Luminosity. First I had these modules: Vector Colour Intersect Trace Render Parse Export Each module was fine on it's own, but I felt like this lacked organization. First, I put every module under Luminosity , so for example Vector was now Luminosity.Vector (I assume this is standard for a haskell program?). Then I thought: Vector and Colour are independent and could be reused, so they should be separated. But they're way too small to turn into libraries. Where

How to code a simple versioning system?

*爱你&永不变心* 提交于 2019-12-02 15:15:31
I want to do a simple versioning system but i don't have ideas on how to structure my datas, and my code. Here is a short example: User logs in User has two options when uploading a file: Submit a new file Submit a new version of a file Users should be able to see the tree. (the different version) The tree can only be up to 2 levels: | |--File_A_0 \--File_A_1 \--File_A_2 \--File_A_3 \--File_A_4 There are also 2 types of file, a final (which is the latest approved version) and a draft version (which the latest uploaded file) The file will be physically stored on the server. Each files are owned

Avoiding virtual functions

丶灬走出姿态 提交于 2019-12-01 15:51:52
So suppose I want to make a series of classes that each have a member-function with the same thing. Let's call the function void doYourJob(); I want to eventually put all these classes into the same container so that I can loop through them and have each perform 'doYourJob()' The obvious solution is to make an abstract class with the function virtual void doYourJob(); but I'm hesitant to do so. This is a time-expensive program and a virtual function would slime it up considerably. Also, this function is the only thing the classes have in common with each other and doYourJob is implimented

Where should I put my JavaScript - page or external file?

心不动则不痛 提交于 2019-12-01 11:46:07
In VS 2008, I have an ASP.NET content page having one master page. I would like to add JavaScript functions for client side validation etc. for this page. My questions are: Should I write these scripts in a separate .js file, or embedded within the .aspx file. Does this choice affect the performance of the website? Are there any rules for writing a JavaScript file? It depends on your use. If its a page specific functionality then try and implement it in the page itself. If it is used by many pages then put that inside a js file. Does it affect the performance of website? Yes, it can. If you

Where should I put my JavaScript - page or external file?

試著忘記壹切 提交于 2019-12-01 08:11:05
问题 In VS 2008, I have an ASP.NET content page having one master page. I would like to add JavaScript functions for client side validation etc. for this page. My questions are: Should I write these scripts in a separate .js file, or embedded within the .aspx file. Does this choice affect the performance of the website? Are there any rules for writing a JavaScript file? 回答1: It depends on your use. If its a page specific functionality then try and implement it in the page itself. If it is used by

What is the best way to separate a large html file into three smaller html files? [closed]

浪尽此生 提交于 2019-12-01 06:53:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I have a very large website, and I was wondering how to separate a single HTML file into 3 separate HTML files. In order, to organize the code as individual components of a whole like this: Header.html Body.html Footer.html How can I break the html code into three separate html

Do modern Java compilers/JVM inline functions/methods which are called exactly from one place?

谁说我不能喝 提交于 2019-11-30 17:29:43
问题 I found out that the C++ compiler does so but I want to know if the Java compiler does the same since in that answer they said adding static would do so but static is different in java and C++. In my case performance would matter since am using functions that are called only once per frame in a game loop and called nowhere else, to make it more readable In my code I have it setup up similar to this, except with many more calls while(running) { update(); sync(); } and then update(), render()

Organizing Actions in a Swing Application?

白昼怎懂夜的黑 提交于 2019-11-30 13:51:54
My current application has a JFrame with about 15 actions stored as fields within the JFrame. Each of the actions is an anonymous class and some of them are pretty long. Is it common to break actions into their own classes possibly within a sub-package called actions? If not, how's this complexity usually tamed? Thanks If it is possible that your actions could be reusable (e.g., from keyboard shortcuts, other menus, other dialogs, etc.) and especially if they can work directly on the underlying model (rather than on the UI), then it is generally better not to have them as anonymous classes.

Should I put many functions into one file? Or, more or less, one function per file?

点点圈 提交于 2019-11-30 12:39:19
I love to organize my code, so ideally I want one class per file or, when I have non-member functions, one function per file. The reasons are: When I read the code I will always know in what file I should find a certain function or class. If it's one class or one non-member function per header file, then I won't include a whole mess when I include a header file. If I make a small change in a function then only that function will have to be recompiled. However, splitting everything up into many header and many implementation files can considerately slow down compilation. In my project, most

Git submodule or sub-repository or remote?

末鹿安然 提交于 2019-11-30 12:33:32
问题 I'm using GIT to manage a Content Management System (CMS) project. The CMS can have multiple plugin (module). So basically, I want to have 3 types of repositories: The core CMS development ( every new project is a checkout of that last stable & unconfigured version ) 1 repository per module/plugin. ( every new project will checkout the last stable version of the module they want to implement ) 1 repository per project ( each client will be a repository that represent the personalization from