|
Eddy Vluggen wrote: must have been written by a VB6-programmer
This joke is less and less funny when you know, work with, and refactor code by vb6 programmers
If it moves, compile it
|
|
|
|
|
loctrice wrote: This joke is less and less funny when you know, work with, and refactor code by vb6 programmers
It's not a joke, it's sarcasm. Those prefixes are heavily in use by both Access (VBA) and VB6 developers. You won't see these kind of examples in a book on Sql. Most "experienced" programmers that I worked with are multi-lingual and rarely label themselves using a certain language.
..and yes, I too, worked a lot with VB6. The Professional edition!
Bastard Programmer from Hell
|
|
|
|
|
|
Pascal Ganaye wrote: Type prefixing is far more common in C++ than VB.
Granted; and Apps Hungarian is still in use, with a good reason. Systems Hungarian has been abandoned, also with a good reason. It's not a problem to have used it, but it IS a problem if you still see a modern-day use. Especially since the argument is over ten years old.
..and ffs, why in Sql? Is it really that complex code? No, it simply someone religiously following his "coding standard".
Bastard Programmer from Hell
|
|
|
|
|
Sometimes because "Our Dear Leader" dictated that all stored procs shall be prefixed with
sp_ at least I could convince him that we should use
usp_ , with difficulty... Sys Hungarian is also common throughout the system, such that
Dim iVariable As String also happens to be a common sight
|
|
|
|
|
Whehe, aight
The last example shows how it does more damage than good. I've seen these quite often, and it costs more time than that it actually helps.
Was I right in my guess? And if I also guess he's Dutch?
Bastard Programmer from Hell
|
|
|
|
|
Again I am playing devil's advocate here.
I am not suggesting that you should write this code.
However
Sometime the DBA through SQL user access rights settings won't let program access the database through SELECT/INSERT/UPDATE statements but allow execution of stored procedures.
In those scenario you must use STORED procedures to do anything.
|
|
|
|
|
I don't mind use of stored proc.. It is terrible when INSERT/UPDATE/DELETE done in the same stored proc and code is calling the same stored proc with only way to find what operation it is doing is via flag is a big fat FAIL !!!
Zen and the art of software maintenance : rm -rf *
Math is like love : a simple idea but it can get complicated.
|
|
|
|
|
Just came across this code from an ex-coworker (names changed to protect the innocent):
Select Case DoStuff(SomeVariable)
Case 0
Case 1, 2
Case Else
result = "omgnub"
End Select
When I saw that, I . Well played, n00b, well played.
|
|
|
|
|
Nice, that's epic!
""Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
That reminded me of a custom exception one of my friends made: NoobDetectedException . He said he would take it out when he turned in the project, but he didn't. The professor hit the exception, and was not very pleased.
The professor showed the class the exception, which had the message: "You are a noob. You will be assimilated. There will be no escape. (This also applies to <professor name omitted>")
public class SysAdmin : Employee
{
public override void DoWork(IWorkItem workItem)
{
if (workItem.User.Type == UserType.NoLearn){
throw new NoIWillNotFixYourComputerException(new Luser(workItem.User));
}else{
base.DoWork(workItem);
}
}
}
|
|
|
|
|
good practices to use a memcached client to make your site faster!
public IEnumerable<Product> GetProductList()
{
List<Product> data = null;
var key = string.Format("{0}", "Some_Beautiful_Key");
if (_cache != null)
if (_cache.Contains(key))
data = _cache.Get< List <Product> >(key);
data = TheDao.GetProductTable();
if (_cache != null)
_cache.SaveOrUpdate(key, data);
return data;
}
Rudy Alvarez // rdebug.com
|
|
|
|
|
Cache smash. Who needs it anyway?
"You get that on the big jobs."
|
|
|
|
|
When you already omit the {curly brackets}, you should not hesitate and do the next step: omit indentation, or better use random indentation.
public IEnumerable<Product> GetProductList()
{
List<Product> data = null;
var key = string.Format("{0}", "Some_Beautiful_Key");
if (_cache != null)
if (_cache.Contains(key)) data = _cache.Get<List<Product>>(key);
data = TheDao.GetProductTable();
if (_cache != null) _cache.SaveOrUpdate(key, data);
return data;
}
And such features will be even harder to spot for the guys who have to fix your code.
|
|
|
|
|
|
I'm the guy that fix code :'( jajajaja
|
|
|
|
|
Just saw this legacy gem
if(myArrayList.Contains(something)==true || myArrayList.Count>0)
{
if(myArrayList.Contains(something)==false)
{
default=something;
}
else
{
default=myArrayList[0];
}
}
this is for C#.net.
|
|
|
|
|
If you look at MSDN[^] you will see it returns a virtual bool , so obviously you can't trust it!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
"virtual bool" so anyone can override to make it float.
|
|
|
|
|
Well, you wouldn't want it to sink, would you?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I love how the first Contains is redundant and the default does not get set if myArrayList is empty.
|
|
|
|
|
Still worse: when the array list does not contain "something", the default is set to something. When the array list contains something, the default is set to the first element of the array list, which may or may not be "something"...
|
|
|
|
|
Hey guys, i'm a software developer from Romania, and I've been a lurker here for quite a while. Currently, i'm working on an Android project, and, well, this morning I've caused a wtf fail. Thankfully, I realized it immediately (i.e. after the first NullPointerException) and quickly fixed it.
However, I could not resist posting this here, as it's a beginner's mistake, and I shouldn't have done it in the first place (shame on me). Variable and method names changed, and the original class was much, much larger
public class CategoryProducts extends ListActivity {
private RangeSeekBar<Integer> seekBar;
private int minPrice = 0;
private int maxPrice = 100000;
private void initFilterView() {
if(seekBar == null) {
RangeSeekBar<Integer> seekBar = new RangeSeekBar<Integer>(minPrice, maxPrice);
seekBar.setOnRangeSeekBarChangeListener(new PriceLimitListener());
}
((LinearLayout) filterView.findViewById(R.id.priceSeekBar)).addView(seekBar);
}
}
The explanation (if you haven't spot it already) is that seekBar gets declared as local in the "if" of the initFilterView method, and visible only in that scope. The local "seekBar" and the global "seekBar" are in fact 2 different vars, and nobody guarantees that the global "seekBar" will not be null (which happens in this case). The correct code was
...(same as above)
if(seekBar == null) {
seekBar = new RangeSeekBar<Integer>(minPrice, maxPrice);
seekBar.setOnRangeSeekBarChangeListener(new PriceLimitListener());
}
...(same as above)
|
|
|
|
|
My vote of 5, to accept your mistake.
Newton's unspecified law:
No code in world is bug free!
|
|
|
|
|
Interesting!
How did that compile without an error:
"A local variable named 'seekBar' cannot be declared in this scope because it would give a different meaning to 'seekBar ', which is already used in a 'parent or current' scope to denote something else"
Because it won't for me!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|