-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General "janitorial" fixes #6
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
In JavaScript, differently from C/C++, varibles are function-scoped instead of block-scoped. This patch unifies the declaration of the same variables so that static analyzers don't complain about the code. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
I missed this one in the previous commit. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
If we have an `if`-`else` command where we never continue the execution from the `if` block, then we can be free to unwrap the `else` body from the else. This improves readability by reducing one level of indentation. Note that there was one instance of this removal where the body of the `else` was not even indented, which made reading the code confusing (especially for those that program in languages like Python where indentation matters). Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
This fixes some messages that are shown to the user. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
While JavaScript implicitly "inserts" missing semicolons under some conditions, it is better to make them explicitly, especially if we ever have the hope of running the code under tools like JSLint. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
This was automated with the `dos2unix` tool and while it may look enourmous, it *only* changes the EOL characters. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Some parts of the code had funky and inconsistent indentation. This change is trivial in the sense that it was automated by Emacs's indent-region command. This patch tries to make the indentation consistent with the standard of 4 spaces per level. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
We may want to use an automatic indenter in the near future to take care of some other inconsistencies in the code. Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Removing elses and forcing line breaks after if/for are purely stylistic changes. In my opinion they don't improve anything. |
I agree. I won’t get them done until after the course unless I can get my student to do them. Ed Angel Founding Director, Art, Research, Technology and Science Laboratory (ARTS Lab) 1017 Sierra Pinon
|
Hi, Anton. On Jul 19 2015, Anton Khorev wrote: The main reason for that is to reduce the indentation levels. The main reason for that is we have nested loops and it breaking the lines
Yes, indeed, they are.
In my opinion, they do. Who wins? :) Kidding aside, they improve the style of the code and that is very important In the words of a very important Number Theorist (G.H. Hardy):
Similarly to Prof. Hardy, I also see that computer code (especially that Anyway, by reading the code doing such "frivolous" changes to improve style Anyway #2, I can revert those particular changes if there is intention of Anyway #3, I can simply withdraw the pull request at all and use a forked Regards, Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA |
Since the code goes out to lots of users of my textbook, I do want to clean up the code but it may take me awhile to get to it since the Coursera course is taking a lot of time and SIGGRAPH is coming up in a couple of weeks. As for the Common code, some of the webgl utilities are not mine so I would rather look for an updated version on the web at either mozilla or google. MV.js needs some serious work. Most of it was done by my coauthor quite awhile ago while we were doing the first draft of the book and we never really cleaned it up. There are some inconsistencies on things like error checking I need to go over. Also I need to add a lot more comments to many of the examples. I really appreciate both of your feedback. Ed Ed Angel Founding Director, Art, Research, Technology and Science Laboratory (ARTS Lab) 1017 Sierra Pinon
|
When I have a function with two branches and both of them return something, I don't consider it an improvement to unindent one branch. It makes comparing the code of the branches more difficult and it doesn't really save you any horizontal space because there's that other branch. Additionally, you can't fold the unindented branch in editors that support code folding. Of course I would have written the code differently. Of course I can write a longer post arguing that my way is better and maybe reference some famous person. |
@esangel, are there any commits here that you think are worth cherry-picking? If not, I will withdraw my pull request completely. Otherwise, I can rebase the changes on top of your master branch... I hope that you do find something worthwhile, since the code base could certainly be improved (like, for example removing the executable bits from the source files, removing |
I’ve been slow getting to that site. Been working on a new edition and moving all the support to a new github site.
I did remove the extraneous files. Will clean up the code sometime.
…_______________________
Ed Angel
Founding Director, Art, Research, Technology and Science Laboratory (ARTS Lab)
Professor Emeritus of Computer Science, University of New Mexico
1017 Sierra Pinon
Santa Fe, NM 87501
505-984-0136 (home) angel@cs.unm.edu <mailto:angel@cs.unm.edu>
505-453-4944 (cell) http://www.cs.unm.edu/~angel <http://www.cs.unm.edu/~angel>
On Aug 30, 2017, at 3:47 PM, Rogério Brito ***@***.***> wrote:
@esangel <https://github.com/esangel>, are there any commits here that you think are worth cherry-picking? If not, I will withdraw my pull request completely.
Otherwise, I can rebase the changes on top of your master branch...
I hope that you do find something worthwhile, since the code base could certainly be improved (like, for example removing the executable bits from the source files, removing .DS_Store crap, the Git.zip file and so on, just to name a few things).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#6 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AHewl32O7V3VvYIctx5iZu-kDF-YI_DLks5sddh9gaJpZM4FbUtC>.
|
Hi, @esangel.
As mentioned in the forums, here are some "janitorial" changes to the code. I tried to make each change relatively independend of the others (which is the reason why there is a good amount of them), in the spirit of "Keep It Simple".
Hint: do not try to look at the changes all at once, but each commit in separation of the others, so that you are not overwhelmed with a lot of code changes in just one go.
If you like these changes, then there are more to come, with some of them trying to avoid repetitive code (e.g., the code to sum and to subtract vectors is almost the same and I think that it could be unified in a simple way to avoid repetition).
Anyway, first, let me know what you think of these changes, and then we can proceed to improve the rest of the code.
Thanks,
Rogério Brito.