Friday, July 4, 2008

Now I'm pissed at CodeGear RAD

I just wasted a good 4 hours because of retarded behavior of CodeGear RAD. Lets say I have a form called Form1, and a file called global.pas. I define a custom class called TestClass in global.pas. In the "uses" section of Form1, I add global. In the implementation section of Form1, I have a procedure called Proc1. In the "var" section of Proc1 I declare "test: TestClass;". In the code section of Proc1, I write "test := TestClass.Create;". 

I figure since "global" is in the "uses" section of Form1, I'm good to go with using "TestClass" in Proc1. I compile with no errors. When I run my app, I get an "access violation". I rack my brain and use all the google-fu at my disposal to figure out what I'm doing wrong. Cause obviously the fault lies with my code somewhere right? Wrong. I must use a "test := global.TestClass.Create;" in Form1. In order for it to run properly. I completely lose my fucking mind at this point. 

In any programming language known to man, something is either visible to you, or it is not visible to you. There is no "well, you can see it at compile time, but not at runtime". If "TestClass.Create;" was NOT in the proper visibility, THE COMPILER SHOULD HAVE THROWN AN ERROR. If "TestClass.Create;" was IN the proper visibility, THE RUNTIME SHOULD HAVE EXECUTED PROPERLY. 

I understand when I waste my time because of something I did. I can accept that. What I cannot accept is when someone else wastes my time. The group of monkeys that made CodeGear RAD need to go take a class in compiler theory. 


Before anyone bitches at me, please read the paragraph above on visibility, and why the compiler should have thrown an error. 

16 comments:

  1. I'm reluctant to comment as it's obvious that your just trying to generate traffic on your blog by baiting Delphi users.
    It seems that most of the community has decided to simply ignore you, I guess I should do the same but....

    I've tried to reproduce the "problem" your say you experienced and I was unable to do so.
    Please post the "problem" code or least some screen shots not childish rants.

    ReplyDelete
  2. Why is the rant childish? Is it because it criticizes your favorite tool? And I don't care if no one reads this blog. If CodeGear RAD has flaws, am I supposed to post "happy thoughts" just so other CodeGear users don't get upset? Just to be perfectly clear, my problem is NOT with Delphi. My problem is with CodeGear RAD.

    As far as posting screenshots, I'll see if I have some time today to extract out the problem code and put it in a separate project, who's source I can post freely. By the way, did you scroll down a bit and see my screenshot of CodeGear RAD crashing?

    ReplyDelete
  3. Also, I think your sarcasm meter is broken. You should get that fixed.

    ReplyDelete
  4. Branden, could you post a small demo program to demonstrate your problem? To me it's not quite clear what you do (wrong). I'd like to help out, but need a bit of sample code to do so.

    ReplyDelete
  5. I just setup a codegear install on a my home pc, I'll setup my sample code there, and see if I can recreate the problem. Also, since it will be my code, I can post it online!

    ReplyDelete
  6. Branden:

    Rad studio is not made to use by monkeys. Is intended to be used by serious developers. I dont sure if you get wich i say, according for the reads i do to all your posts... In the meantime, that is my last post here, seems like you never will learn nothing about delphi and vcl. I suggest you reading my friend. If you dont read, you act like a monkey with a nail.

    ReplyDelete
  7. No, you misunderstood what I wrote. I said CodeGear RAD was MADE BY MONKEYS, not used by monkeys. Act like a monkey with a nail... funny, but I'd prefer to be a chimp, cause chimps are smarter. If you think CodeGear RAD is flawless, and the best thing since sliced bread, who's the real monkey?

    ReplyDelete
  8. unless you have another TestClass (and that should be TTestClass by convention BTW) defined somewhere in your form unit there should be absolutely no need to prefix the unit name. Was TestClass the actual name of the class you used or did you change it for the purpose of this blog post? Did you add the global unit to the interface uses clause or the implementation uses clause?

    I have noticed that the editor can sometimes get confused when a symbol is declared in two units and one is included via the implementation uses and the other via the interface uses.

    Please post the code of the two PAS files.

    BTW: the product name is "RAD Studio" or simply "Delphi", never "CodeGear RAD". That's like referring to VS as "Microsoft Visual"...

    ReplyDelete
  9. I understand that you wrote. Im telling you a monkey cannot use that.

    I will explain in detail. Seems like you always need things explaind in detail.

    Wich do a moneky with some new to him? Just start touching and rotating without know how to use. That is how you behave with Delphi ide. Get now?

    For that reason i tell you CODEGEAR RAD IS NOT FOR USE BY MONEKYS.

    If you dont undesrtand now... well. a lot of things get sense...

    ReplyDelete
  10. Donald:

    Again, do you actually read the technical content of my posts? Or are you just upset because I posted a picture of a monkey with RAD Studio? So tell me Donald... what do YOU think RAD Studio or Delphi could do better?

    ReplyDelete
  11. Animal:

    Thanks for the tip on the proper name for RAD Studio.

    And yes, I did change the name for the post. I'll examine the code again to see in which 'uses' TestClass is declared. I really hope the fault lies with my code.

    ReplyDelete
  12. Branden: Roman said "errare human est, perseverare diabolicum". You still make big mistakes because you don't care to learn, and instead telling yourself "I need more training, let's read some manual", you keep on blaming the tool. If you need a fully qualified name, you simply have another TestClass declaration in your scope. But if never took the time to learn Delphi namespaces and scopes, you would never discover it. Again, you're the monkey, sorry.

    ReplyDelete
  13. See this link: http://www.dummzeuch.de/delphi/classvariablepitfall/english.html
    It's a direct response to your problem (the user couldn't post on your blog, apparently), and I can personally vouch for that solution since I also ran into the problem a few months ago, but was able to figure out for myself (of course, the source code wasn't as complicated as yours probably was, it was just a hobby program).

    In the future, I'd suggest trying on a less aggressive, pre-assumptive attitude, or else most people will think that you're a douchebag troll like they just did. If you continue on that path, people with no bias towards a tool or programming language (i.e.: neutral) will likely see you as a fanboy hating anything competing with his favorite tool rather than others as fanboys defending their favorite tools.

    The problem was really that simple, albeit tricky to discover. If you used the standard Delphi name conventions (why in the world are you even programming in Delphi if you don't want to use them? It's like wanting to make your life easier, but instead proceed in a round-about and detoured way), all of these problems would most likely not have even existed for you.

    ReplyDelete
  14. Cloud: The emotion in my post was from banging my head against simple issues like this for several hours. I was in no mood to go to a Delphi forum, have my hat in my hand and ask for help. I needed to vent.

    As far as not using standard Delphi name conventions, the job that I was working on had mandated use of Delphi, I was brought on because of my expertise in the field at hand, not because of any expertise in Delphi.

    Also, I find it funny that some of them were calling me an MS fanboy and telling me to run back to C# and Java if I can't handle Delphi and Rad Studio. I think in a comment on a later post I mention that they can slam me if the want, but most likely I will never use Delphi again, thus will never pay for a developers license from whoever owns Delphi, and Delphi will continue its long slow slide into oblivion, with only a few legacy users left. That's what happens when you WANT more people to use your system, yet you slam the noobs. After that more people seemed to be helpful.

    About twm not being able to post on my blog, that was an oversight on my part, I originally had all comments reviewed by me and I wasn't getting to them fast enough. Once I realized that I stirred up a hornets nest and that there were Delphi supporters itching to get at my blog I opened up the commenting to everyone. I figure since I posted it in public, its only fair for fanboys of all sides to be able to comment on it.

    In any case, I saw the project I was working on as being not sustainable in the long term, for reasons unrelated to Delphi or Rad Studio, so I left that project. I do value the time I spent in Delphi, learning a new language is always a good thing. There are things that I like in Delphi/Pascal, and indeed some of its syntax has made its way into Go, which is Google's new homegrown language. In general I was far more frustrated with Rad Studio, and with the core API, than I was with Delphi.

    ReplyDelete
  15. As a follow on comment, some of those who posted on my blog were extremely helpful, and should be commended for taking their time to help some random person on the internet solve a problem. Others were just angry that I poked fun at their favorite language/IDE.

    ReplyDelete
  16. Ah, I see. Banging your head for several hours is extremely frustrating to the point of almost throwing the computer out the window. I guess you needed to vent out your anger rather than find a solution in the very short term. :P

    As for Delphi name conventions, I guess it's understandable that you didn't knew or thought about it until then. I too remember that, coming from Pascal in high-school (no naming conventions), I didn't know about the conventions, and when I did I was a bit reluctant since it was different than what I would normally do. However, once I got frustrated when I first started building real (end-user) apps (coincidentally, the app I'm talking about is the hobby app I mentioned in my previous post about visibility and the access violation, though those two things didn't come at once for me as it did for you), I immediately switched to the standard naming conventions just to be able to use my preferred field names (type names didn't matter as much to me), and soon after my love of the conventions grew so much that I'm actually thinking of integrating it with all my hobby programs (if I'd do this at work, my colleagues would probably kill me :P).

    I can understand your frustrations with Delphi. I have a few issues with it as well (IDE is almost always buggy, but the bugs are minor), but for the most part it is OK.

    Your problem most likely is because of what twm said, from the sounds of it. It seems Delphi allows you to also use an instance's constructor (in the form of Object.Create) as well as a class' constructor (in the form of TClass.Create). I also got frustrated with Delphi a bit then about not being able to use classes at all (and instead decided to replace them with records that can also handle methods), only to find out later I was calling the instance's constructor all the time (guess I was really tired).

    Anyway, your problem is very likely that you had a global variable named TestClass in one of the units in the uses clause that came after the unit where you declared the TestClass type. That way, whenever you mention TestClass, Delphi always looks at the most recent mention of that name in it's uses clause if it's not declared in your unit, and in your case that was the TestClass variable. It then proceeded to call the variable's constructor, and all hell broke loose.
    It was not a visibility bug, nor a problem with RAD Studio (I think it's ok the way it looks at names, granted people follow naming conventions). It was a problem on the programming part, most likely because programmers from other languages tend to use the same names for their variables as their type's name, albeit with different case. Delphi is case insensitive (which I think is the right approach), and thus your problem. Using the Delphi conventions would have probably solved your problem instantly.

    Case insensitivity and naming conventions are the reasons why it's harder to produce bad code in Delphi, in my opinion. But they must be use together (in other words, you MUST use the naming conventions, otherwise this happens).

    Anyway, I'm glad you've grown fond of Delphi, and I'm sorry to hear about your troubles with RAD Studio, although I think you understand now that it was not the problem.

    Also, I'm sorry for posting this so late (and double posting it on another blog of yours, as I thought you wouldn't get any updates about blog comments), and probably sounding a bit angry in my last post (I didn't mean it, but re-reading it again gives me that impression, especially the second paragraph - I merely wanted to emphasize how you might look to others with that attitude).

    Wish you all the best!

    ReplyDelete

Note: Only a member of this blog may post a comment.