Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was wondering how the cover flow effect is coded. I used this link which gave me the code on how it all worked out : http://luwes.co/labs/js-cover-flow/. I am completely new to complex programs so I had a hard time in understanding how it all works out.

Why do we program each file separately and place them in separate folders and how do all these file come together? Why is there build files, what do they do?

share|improve this question
4  
Can you limit the above to a single specific question? –  PeeHaa Mar 6 '13 at 18:20
6  
Its for organizational purposes, that's all. Why do you have a sock drawer? Why not just throw all of your socks on the floor? –  Robert Harvey Mar 6 '13 at 18:22
    
@CopyDevil He doesn't have a problem, he simply wants to understand why the files are seperate and why there is a build file. Since javascript is not a compiled language, I think that is a reasonable curiosity to wonder what the purpose of the build file would be. –  AaronLS Mar 6 '13 at 18:37
add comment

migrated from stackoverflow.com Mar 6 '13 at 18:23

This question came from our site for professional and enthusiast programmers.

1 Answer

Looking at the build file, it is just a command line, I saw uglifyjs2 which is being passed on the command line a list of files. I googled uglifyjs2 and apperently it is a combiner/minifier. You can remove most of the whitespace and comments in a javascript file and it will work fine, so we do so to make the file smaller when downloaded to the browser. This is minification. We also combine multiple javascript files into one so that only one request is needed to retrieve them.

They are edited in seperate files just to make it easier to understand the layout of the program. There are other reasons that relate to version control, architecture, frequency of change, etc. that might have been a factor in the developer deciding how to sepereate them out. Some might actually be javascript files from other projects on which this program depends/needs. Since those files might be updated by the other projects, keeping them separate allows the developer to just copy the file over the old one when it is updated. This would be very difficult if he copied those other project's code into a single file.

Since for development you want seperate files, the build file is an automated way to to keep the files seperate, but combine them whenever you want to create the single minified/combined "release" file that you will provide to those who want to use your tool/application.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.