Dalija Prasnikar 1397 Posted May 2, 2022 43 minutes ago, wuwuxin said: Thank you for the link. On one hand, string is listed as a reserved work, on the other hand, it also says "System.String" is an alias for "UnicodeString".......... Being reserved word only means that you cannot use those words as identifiers. It does not tell you anything what each reserved word represents in the language. If you are asking about coding style and why is string written in small caps, then being reserved word has a meaning in that context because there is a coding style rule (which you don't have to follow, of course) that says reserved words are written in small caps. When you are talking about string being an alias for UnicodeString then this describes its semantic - its behavior and what it represents. "string" describes default string type and its definition can change in different compilers. For instance, in Delphi 1 string was alias to ShortString, and in Delphi 2 - Delphi 2007 it was alias for AnsiString, and since Delphi 2009 string is alias for UnicodeString. 1 Share this post Link to post
TheOnlyOne 10 Posted January 27, 2023 On 2/20/2022 at 9:20 AM, dummzeuch said: When posting something's like this, one has to expect feedback. And usually negative feedback more than positive. It's difficult to deal with that if you have no experience. There is nothing wrong with negative feedback as long as it comes with an explanation, an explanation that will help one fix the problem. Share this post Link to post
TheOnlyOne 10 Posted January 27, 2023 (edited) On 2/23/2022 at 11:25 AM, Mike Torrettinni said: There's quite a lot of inconsistency in Delphi sources, in some cases very obvious when a different developer implemented a change and introduced new variables. Completely different style, or usage of L prefix. I hate that!!!!!!!!!!!!!!!!! My colleagues use L a lot. And G (guess for what). We have thousands of those global variables. And they say it is fine as longs as you marked them with G. ______________________ About all these code formatting guides: every time I see one, I wonder myself why is this written like this and not otherwise. Is there any philology involved? Is in any way the human factor taken into consideration? For example, if you have: if (SomeKindOfCondition > 0) and (SomeOtherCOndition < 1) and (x=42) | <- here comes the end of the screen and you don't see the rest of the code wound't be (for the brain) better written as: if (SomeKindOfCondition > 0) and (SomeOtherCOndition < 1) and (x=42) and (Y = that) then and even better: if (SomeKindOfCondition > 0) AND (SomeOtherCOndition < 1) AND (x=42) AND (Y = that) then I think the brain would want to know what happens BEFORE it happens (the "and" condition). The eyes should be able to parse the code as easily as possible. I am just saying. I don't know what would be the results of an MRI scan of a person reading code like the above, where the logic is written in "post" style (2nd block of code) and "pre" (3rd block) style. It was fed to us that we have to write the code in this style. Is this the standard solution. Yes. Is it also the best solution? god knows! Edited January 27, 2023 by TheOnlyOne Share this post Link to post
programmerdelphi2k 237 Posted January 27, 2023 (edited) if was possible, what would be better? Quote wherearewally?wherearewally?wherearewally?wherearewally?wherearewally?wherearewally?wherearewally?WhereAreWally?wherearewally?WHEREAREWALLY?wherearewally?wherearewally?wherearewally?wherearewally?wheREARewally?wherearewally?wherearewally?wherearewally?wherearewally?whereareWALLY?whereAREwALLy?wherearewally?wHEreAREwally?wherearewally?wherearewally?wherearewally?wherearewally?wherearewally?wHEREarewally?wherearewally?wherearewally?wherearewally? or Quote if WallyIsHere then ... Edited January 27, 2023 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted January 27, 2023 maybe some like this would better: IsTrue := ((a + b)=1) and (c = d); if IsTrue then ... 1 Share this post Link to post
programmerdelphi2k 237 Posted January 28, 2023 thank you @Stano, after all, disagreements have always existed, however, we must not let them create distances between us. 🙏 Share this post Link to post
Lars Fosdal 1792 Posted January 30, 2023 On 1/27/2023 at 7:29 PM, TheOnlyOne said: We have thousands of those global variables I am at a loss for words... How old is this codebase? Share this post Link to post
Fr0sT.Brutal 900 Posted January 30, 2023 1 hour ago, Lars Fosdal said: I am at a loss for words... I have some Run Lola RUN!! 🙂 Share this post Link to post
TheOnlyOne 10 Posted January 30, 2023 (edited) 2 hours ago, Lars Fosdal said: I am at a loss for words... How old is this codebase? Define "old". This is the current code. The previous programmers worked on it each day. But our boss will not allow us to allocate time to refactoring. As I said, if he wants a new feature implemented (let's say a new pretty Search box) he will personally verify at the end of the sprint if the conditions are meet (DoD) checking only the GUI. The code that's under that pretty GUI... is the hag that nobody checks. You want more juicy stories? We keep all data in strings, but sometimes we keep it in visual controls (listboxes) placed on the form outside the visible area. The form is 1024 pixels, so we have in the main form about 100 invisible controls, starting at pixel 6000. The whole story is here: Edited January 30, 2023 by TheOnlyOne 1 Share this post Link to post
Lars Fosdal 1792 Posted January 30, 2023 I'd be looking for a new job with a competent manager. This sounds like an ulcer-inducing task. Share this post Link to post
TheOnlyOne 10 Posted January 30, 2023 6 minutes ago, Lars Fosdal said: I'd be looking for a new job with a competent manager. This sounds like an ulcer-inducing task. I am much better than the other two programmers (since their code), so this job is for me quite trivial. Share this post Link to post
Lars Fosdal 1792 Posted January 30, 2023 But... so much shit to clean up, and no time allocated to doing it... I'd go nuts. Share this post Link to post
omnibrain 15 Posted January 30, 2023 1 hour ago, TheOnlyOne said: I am much better than the other two programmers (since their code), so this job is for me quite trivial. Being overworked is not the only reason for burnout. It can also happen due to the opposite (boreout) or just working in a bad environment. Be careful. Share this post Link to post
Fr0sT.Brutal 900 Posted January 30, 2023 Only Hercules could clean up Augeas stables but even he cheated. 1 Share this post Link to post
Tom Chamberlain 47 Posted January 30, 2023 3 hours ago, Fr0sT.Brutal said: I have some Run Lola RUN!! 🙂 +1 for the Run Lola Run reference....Manni!!!! Share this post Link to post
TheOnlyOne 10 Posted February 2, 2023 (edited) On 1/30/2023 at 12:33 PM, Lars Fosdal said: But... so much shit to clean up, and no time allocated to doing it... I'd go nuts. Yes. That's part of my dilemma now. What would take for those non-tech people in the management to understand that it is not enough to write a function once and forget about that code for 25 years? What would it take to understand that pausing the production for 2 months to pay 25 years old technical debt will make the production faster (once you unpause). Edited February 2, 2023 by TheOnlyOne Share this post Link to post
Lars Fosdal 1792 Posted February 3, 2023 Is it possible to do a divide and conquer - split up the problem into multiple revisions - modernize bit by bit, or is it a house of cards... Share this post Link to post
Fr0sT.Brutal 900 Posted February 3, 2023 You can create a visual presentation - show support complexity (and thus productivity, possibility of errors, etc) with old code and shorter new one, list bugs that could've been avoided with new arch, benchmarks that show speedup if speed is of value... IOW, try to sell your boss an upgrade 🙂 Coders are weak sellers usually but it's the only way 1 Share this post Link to post
Lars Fosdal 1792 Posted February 3, 2023 Less duplicated code -> less work to fix a duplicated error Less duplicated code -> less work to modify a duplicated behaviour Less code -> less chance for errors Less code -> easier to maintain Easier to maintain -> easier to add new features Modern quality code -> shorter time to market Share this post Link to post