Timeline for Regex parser - request for review and optimization
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 28, 2013 at 20:45 | vote | accept | JavaDeveloper | ||
| Nov 18, 2013 at 14:45 | comment | added | rolfl |
I think you underestimate the power of final. Apart from the logic-constraints you describe above, it has proven to be a defensive bug-trapping tool, performance enhancing, and intent-revealing mechanism. This is in my experience at least. final is like a door. It is better to close your doors even when you live in a safe area because an open door is an invitation to come in. Regardless, this is an opinion thing, and will never be resolved. By the way, I prefer vi over emacs, eclipse over intellij, and linux over windows or mac... . ;-)
|
|
| Nov 18, 2013 at 7:42 | comment | added | amon |
This is a great answer except for the first suggestion. The final modifier has three distinct roles: On classes, it makes them uninheritable, on methods, it makes them non-overridable, and on variables, it makes them assign-once. Disallowing a subclass to override a method is more often than not a stupid idea (compare Open-Closed Principle), whereas single-assignment is a useful technique to reduce bugs. Note that there are few cases where a final modifier on a variable would actually affect performance.
|
|
| Nov 18, 2013 at 3:04 | comment | added | JavaDeveloper | Firstly a huge thanks, improved code and re-posted. Secondly "".matches(""); returns true in java, so keeping implementation aligned with it. | |
| Nov 18, 2013 at 1:15 | history | edited | rolfl | CC BY-SA 3.0 |
change passing to failing ... hmmm
|
| Nov 18, 2013 at 1:07 | history | answered | rolfl | CC BY-SA 3.0 |