I still don't see why it should be wrapped in a BrokenCodeException in ModelConverterFactory.createConverterFor, if you leave them as regular RuntimeExceptions your program will die as well.
@skiwi actually no. I additionally want to be able to notify the user, that the problem will persist and also occur the next time he starts the application..
that's not implied when you have a RuntimeException.
@Vogel612 Then you should handle all BrokenCodeExceptions at some outer point in your application... But I don't know how your application is exactly built and how that would work
} catch (IllegalArgumentException e) {
Log.doLogError(e.toString());
e.printStackTrace();
throw new BrokenCodeException(
"Could not instantiate ModelConverter, because the Arguments didn't match",
e);
I don't see why you should log them there
I would just let them bubble up and let the container log them
Suppose it's in production for a few months and it logged a bunch of errors, then I will investigate to fix them, ensure there's no regression, and run again
Even if say files got stuck in my system or files would get deleted, then there are even outside guards that prevent the file from being permanently lost.
So they'll be tests, but I am not going to use them as regular tests (which you usually run after every change), because they could take easily an hour
Like a few months ago on an older version, I would test 14 invoices manually after every significant change to test for regression, and that took like 30 - 60 minutes already and was awful :P
But if you know an IBAN consists of letters and numbers only, then why is there no freaking trigger in the database that raises an error if you try to insert spaces or colons or whatever
the if statements look really messy to me, I would much rather put this into a Switch and use 2 ternary operator statements so that I am only performing if calculations when I absolutely need to.
using the switch I was also able to get rid of the boolean variable and the assignments to that va...
I've coded a Calculator in C# with WPF as the UI. I wish to know mainly about this points:
Ways of optimizing.
Better techniques, tactics and ways of coding this.
All flaws on the surface as well as deep.
Simpler logic
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using ...
@skiwi yah HQ9+ is for code golf, it prints hello world, 99 bottles of beer on the wall and it's own source code depending on the characters in the source file
@HassanAlthaf Could you please ask less questions and start to read the official documentation for whatever programming language you are working in? It would be best for all of us.
@Pimgd because it's around the bush and from behind... The intention of the code is not clear IMO... you should be able to formulate that clearer (read, not need a continue;)
@HassanAlthaf Yes, you are too curious. You are focusing on way too many things at once, and Code Review is not really the best place for any of them. I believe that what you primarily need is patience, and the ability to self-learn better
If I run the following program, which parses two date strings referencing times one second apart and compares them:
public static void main(String[] args) throws ParseException {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str3 = "1927-12-31 23:54:07";
...
I've coded a Calculator in C# with WPF as the UI. I wish to know mainly about this points:
Ways of optimizing.
Better techniques, tactics and ways of coding this.
All flaws on the surface as well as deep.
Simpler logic
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using ...
@HassanAlthaf - it may sound like a harsh thing to say, but, people who like dealing with broken code, or code with issues, answer things on Stack Overflow. People who like to make working code better, answer things on Code Review. If your code is not working, then the right people to bug are on the Stack Overlfow side of things. While the people here on Code Review probably can help you with problems, if they wanted to help you, they would be present on Stack Overflow as well.
SO is nice, but all the questions that are on my level get swept away by more experienced users, so I restrict myself to certain tags. Then I found code review and here it's okay if you take your time for an answer
Plus I put in a question today and got a nice answer back with results I didn't expect
java-8 was doable on SO when it was in early access and also a few weeks after release, but then it got totally swamped with FGITWs, I had hit the repcap like five days consecutively though when Java 8 launched ;-)
One of the interesting things about Java 8 is that it has prompted the Scala community to get serious about upgrading. There's talk of moving off 6 finally and skipping straight to 8.
@Donald.McLean I don't know how much to the JVM changed in all honesty, I think a lot of support for lambdas was already prepared in Java 6 (if unlucky in Java 7)
@Donald.McLean invokedynamic got added on JVM 7 (JDK7), which I do not fully understand, but it is something they may want to use in Scala then for higher-order functions as it has something to do with dynamically typed language/code
The only 'issue' I have with people answering a question really fast over here (while I am typing a thorough answer that gets more upvotes in the end), is that I cannot get the enlightened badge anymore then