|
But IDE doesn't have mind reader ability. When we delete some spaces accidentally, at the last line of a code block in particular, how can it know that it was a mistake? How can it know that line of code should be a part of above block, and not simply the next line of execution?
|
|
|
|
|
As I said, every language has its own quirks. In C type languages accidentally inserting or omitting a semicolon can completely change the meaning of a block of code, and adding/omitting '=' or forgetting a 'break;' can completely screw your conditional statements and an IDE wouldn't know about that either.
In Javascript objects assigned from another object are references, not copies; this can be useful, but also makes it very difficult to ensure that data is atomic or immutable when that's necessary (ie code inside a deeply nested function can change apparently unrelated variables by 'remote control' if you are not careful).
No language is perfect, and I have indeed had Python code behave unexpectedly due to indentation issues, but this has not been any more of a problem than things like those above, in fact, less.
It is very easy to write tests for things in Python (because the language is so versatile) and that catches such things readily. For my web apps I use selenium for testing the 'user' interactions and my own internal tests for the model code.
At the end of the day, very domain specific stuff possibly excepted, programming is programming and the language you use irrelevant.
You are testing your code, aren't you 8)
|
|
|
|
|
Really?
var foo = "Hello";
var bar = "World";
var message = foo + " " + bar + "!";
I am pretty sure the IDE will throw an error right away if I deleted an ;
Compare it to Python:
price = 1100
discount = 50
qty = int(input('How many do you want to buy? '))
total_price = qty * price
if qty > 10:
discount = discount + total_price/100 * 5
total_price = total_price - discount
print(total_price)
The IDE won't find out anything if the indentation TAB on 2nd last line is accidentally deleted.
But you are right, we should have made unit tests for everything. Only that I got lazy sometimes, especially if it's just a simple function. Ha ha ha.
|
|
|
|
|
It's easy to find similar examples in any language 8)
Javascript:
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
var me = person;
me.firstName = "mike";
What does person.firstName hold now? Would an IDE warn you that me was a reference? What if the assignment to firstName is miles away in other code?
Compare that with similar code in C++, which by default will make a deep copy of the object so that person and me are not pointers to the same memory.
In C:
a = 1;
b = 1;
c = 0;
if (a != b);
{
c = 1;
}
What value does c hold?
I'm not saying a good IDE doesn't help, because it does - but that's true with any language, including Python. You can write bad code in any language (BTDTGTTS!), so my point remains: Python is different, but that doesn't make it better (or worse). You should use the most appropriate tool for the job, and for which you have the most skill. FORTRAN code is (was) position dependent too...
|
|
|
|
|
By the way, no more _ required to break a line in VB.Net anymore..
|
|
|
|
|
I know. And like VB _, with enough complaining, perhaps Python will be fixed or at least make optional to allow code block delineation tokens.
|
|
|
|
|
There are some technical and historical reasons that BASIC was THE de facto programming language for students and non-professionals for a generation. The main one, in my opinion, is not that the language was so easy (it IS pretty easy, though), but that it WAS (emphasis on "was") so easy to get started. You literally turned on the computer (TRS-80, Commodore 64, etc.) and you had a BASIC prompt. It's now actually harder to get started in programming because there are just so many layers of tools to get going. (There are notable exceptions, but there is no universal simplicity like what was on the home computers of the 1980's.)
You CAN write high-quality, well structured software in BASIC (and Python, and you name it). You can also write garbage. I've read thirty-year-old BASIC code and re-written it in C. The original code was impeccably constructed!
|
|
|
|
|
...where I open up a file to fix a bug in someone else's code and my brain goes WTF, my eye's pop out, I start crying, and I lose all motivation to do anything for the rest of the day.
|
|
|
|
|
... and eventually realize it is your own code.
|
|
|
|
|
Exactly.
|
|
|
|
|
CPallini wrote: and eventually realize it is your own code.
hahaha, no, if it's my own code, I take out this.
|
|
|
|
|
Usually used on the missus ?
or used BY the missus, more likely...
|
|
|
|
|
I just feel sorry for the poor bloody croc.
|
|
|
|
|
V. wrote: or used BY the missus, more likely...
Ain't that the truth!
|
|
|
|
|
I know what you mean, because it never happens with any of my own code that I look at
I just discovered a pivotal piece of code(not written by me) that has a parameter in the signature of a stored procedure which is not referenced in the body of the stored procedure.
Am I going to 'fix' it?
Heck no - the whole darn edifice will come crumbling down just as I leave for home if I do that!
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
GuyThiebaut wrote: Am I going to 'fix' it?
Shot, boiled in oil, hung, drawn and quartered, the penalty for removing or reordering a parameter in a stored proc.
We have a whole set of reporting procedures that take in the same 3 parameters, some are not used but the service passes them to conform to a reporting framework we use .
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Charming!
That is a possibility and why I did not 'fix' it - however it's not a pattern I have seen in any of the code where I work.
A better way of coding for this sort of issue is not to have unnecessary parameters but to have an 'entry point' stored procedure which then decides on which stored procedure to call.
The entry point stored procedure having all the parameters and each subsequently called stored procedure only having the parameters required.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Yeah, one of those day. The program didn't happen to store part of the code in database and inject them dynamically, does it. That is exactly what I have to deal with recently.
I inherited a web application where all the page elements plus the JavaScript code for handling user interactions as well as the associated data are all stored in the database. When the whole thing injected onto the browser, it didn't have anything showing in the DevTool. The whole app is the slowest I've ever seen. The really odd thing is the Web app is used by a single person at a time.
Luckily I convinced the customer to rewrite the whole thing from scratch in Desktop.
|
|
|
|
|
Bug ahem...those where feature someone put in the program...you are not supposed to fix things that are not broken.
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
With $500 million of debt.
So a guitar, advertised by Jimmy Page, Slash, Bowie, AC/DC etc etc etc, I mean, etc for the next freaking 6 miles of typing etc, goes bust? Realy?!!!???!!!!!
What the hell kind of moronic management have they had in there? I mean a three year old could manage this. Just dont change anything! Keep churning out Les Pauls and SGs!
F*** me!
|
|
|
|
|
Munchies_Matt wrote: advertised by Jimmy Page, Slash, Bowie, AC/DC
WHo? Oh those old guys.
It's all Adam Levine and First Act guitars now. Kwality. WAlmart.
https://i.stack.imgur.com/ZR25E.jpg [^]
|
|
|
|
|
raddevus wrote: WHo
Rickenbackers wasnt it?
|
|
|
|
|
|
Yeah, SGs in his later days. But the classics, pretty sure it was a Rickenbacker.
|
|
|
|
|
Yes, was. He has gone over to the Dark Side now. That would be Fender.
|
|
|
|