-
Notifications
You must be signed in to change notification settings - Fork 280
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
Code metrics improvements / code optimizations / production (readability/coupling/complexity) #66
Conversation
…ity/coupling/complexity) LinkedList<T> optimizations: -added counter variable -added overflow/underflow exceptions -moved counter to read-only property -moved code to function nodeAtIndex function -changed variables to optionals for readability -removed overcompilcated code blocks -removed Enumerable constraint for T -removed print LLNode<T> optimizations: -added default init and parametrized init to LLNode<T> Tests modifications: -added try! code block to bypass exception handling
-added formatting / removed extra lines / -added SequenceType protocol implementation -adjusted test/code to match the changes
-added default initializer and parameterized initializer (Array<T>!) -added self-described functions for readability -added ArrayLiteralConvertible protocol requirements -moved some optionals to values in safe function calls -moved code to contained class/miscellaneous code improvements (LLNode<T>) Stack<T>: -removed complexity -added count > 0 checks before pop() LLNode<T>: -added complexity to LLNode<T> from LinkedList<T> to lower coupling -removed default initializer Tests: -removed one extra test (LLNode<T>) -moved from optional to value in filter test (LinkedList<T>)
-addLinkAtIndex to empty list is not allowed by now
-added removeNode parameter
Currently working at My opinion that it is essential to replace spaces with tabs, because different users like different tabs on XCode [Preferences - > Text Editing -> Indentation]. I prefer 2, GitHub prefers 8, so for commits using tabs it will not overcommit the lines and extra spaces |
-removed uncovered function (removeNode())
-removed extra brackets (removeLinkAtIndex)
My concern with tabs vs spaces is Xcode's default is to use spaces to indent. Either way, the precedent for tabs vs spaces shouldn't be evaluated on a case-by-case basis per PR; someone should add a style guide or contributing guide to this repo. Until then, you may want to stick with spaces since the rest of the project already uses spaces--but, if you don't, it's not such a big deal. |
-removed force unwraps (@morganchen12)
For the map and filter functions, consumers probably shouldn't have to know about the func map<U>(transform: T -> U) -> LinkedList<U> instead of func map(formula: LLNode<T> -> T) -> LinkedList<T> |
There are a few |
the |
-removed LLNode<T> dependency for map function (@morganchen12)
@morganchen12 Hi! Could you advice easy to read names for the duplicate function naming (if i understood remark correctly) for addNode, addLink functions? (i.e. append<...>, prepend<...>)? I'm not a native speaker and do not understand the mush difference and verbosity then |
|
-removed filter dependency on LLNode<T>
-removed extra defer in loop (waynewbishop#66 (comment))
-removed ! requirements for several params/return values (waynewbishop#66 (comment))
Thanks for submitting this pull request. Since this submission the code has been changed considerably. Feel free to check the latest version on Regards; |
LinkedList optimizations:
-added counter variable
-added overflow/underflow exceptions
-moved counter to read-only property
-moved code to function nodeAtIndex function
-changed variables to optionals for readability
-removed overcompilcated code blocks
-removed Enumerable constraint for T
-removed print
LLNode optimizations:
-added default init and parametrized init to LLNode
Tests modifications:
-added try! code block to bypass exception handling