Board index » delphi » Re: One good argument against using "with"
Ingvar Nilsen
Delphi Developer |
Ingvar Nilsen
Delphi Developer |
Re: One good argument against using "with"2006-02-08 04:14:13 PM delphi155 marc hoffman writes: QuoteJake, try Somevariable := ReadString('APPDATA', 'name', 'Foo'); finally Free; end; I use this all the time, but maybe my code is evil then :) -- Ingvar Nilsen www.ingvarius.com |
Ingvar Nilsen
Delphi Developer |
2006-02-08 04:14:48 PM
Re: One good argument against using "with"
Eric Grange writes:
Quote>[..] can not inspect that instance either. Ingvar Nilsen www.ingvarius.com |
Christopher Burke
Delphi Developer |
2006-02-08 04:27:34 PM
Re: One good argument against using "with"
Ender writes:
QuoteCB>with X.Y.Something(blah).X[I].First.Parent do Not to mention the variables are not declared, nor a program or unit declaration, you didn't pick up on that one either. |
Ender
Delphi Developer |
2006-02-08 06:16:51 PM
Re: One good argument against using "with"
Hello, Yannis!
You wrote on 8 Feb 2006 00:24:12 -0700: Y>Thats what depricated is for. You do not just rename a method that has Y>been used in an application. This is as "evil" as using/not using with. Why? Modification of a class or a method is typical part of refactoring process, which should happen on regular basic. Y>As always anyone can make his life easier or harder based on his/her Y>understanding. The only evil I accept is the lack of choise everything Y>else I either know how to use or not. One may write applications which able to survive even after moderate changes, other one may write applications so fragile that any minor change or enhancement will render it unusable. To be first one, applications at least should avoid unclear or tricky solutions. With best regards, Ender. E-mail: XXXX@XXXXX.COM |
Francois Malan
Delphi Developer |
2006-02-08 06:32:32 PM
Re: One good argument against using "with"
Roger Lascelles writes:
Quote"Robin" <Robin@.com>writes be used with caution. That, of course, is not always evident on this newsgroup. :) -- |
Francois Malan
Delphi Developer |
2006-02-08 06:35:28 PM
Re: One good argument against using "with"
Kevin writes:
QuoteAren't all objects implicit "with" statements? :) unit. :)) -- |
Yannis
Delphi Developer |
2006-02-08 08:25:01 PM
Re: One good argument against using "with"
"Ender" <XXXX@XXXXX.COM>wrote in
QuoteHello, Yannis! of fealure in varius steps (requirement gathering, design etc) Unless you design your classes to be used on single applications I would say that after the proccess of design and implementation any removal of public/published properties is evil since you do not know how it has been used from the varius developers that used it. QuoteY>As always anyone can make his life easier or harder based on even the fine tunning of existing methods but removal is a magor change. Quoteother one may write applications so fragile that any minor to make it work again after changing the code. It is easier to deprecate a method or property before removal leaving the decision on when to remove it to the application not the library. It makes better bussiness sense IMHO. Regards Yannis. |
marc hoffman
Delphi Developer |
2006-02-08 10:38:33 PM
Re: One good argument against using "with"
Roger,
QuoteA similar evil is short if..then statements : c := d else begin e := f; end; -- marc hoffman Chief Architect, .NET RemObjects Software www.chromesville.com and the fifty-two daughters of the revolution turn the gold to chrome |
marc hoffman
Delphi Developer |
2006-02-08 10:39:54 PM
Re: One good argument against using "with"
John,
QuoteIt has it is moments, but I want an IDE refactoring that undoes "with" -- marc hoffman Chief Architect, .NET RemObjects Software www.chromesville.com and the fifty-two daughters of the revolution turn the gold to chrome |
marc hoffman
Delphi Developer |
2006-02-08 10:41:38 PM
Re: One good argument against using "with"
Ingvar,
QuoteOk, have a look at this then: more generic real name)? -- marc hoffman Chief Architect, .NET RemObjects Software www.chromesville.com and the fifty-two daughters of the revolution turn the gold to chrome |
Ingvar Nilsen
Delphi Developer |
2006-02-08 10:59:46 PM
Re: One good argument against using "with"
marc hoffman writes:
QuoteIngvar, I use "with" not much, but in some cases I do. Also for TStringList, TMemoryStream etc. If that is the only objection you have, I am on safe ground! -- Ingvar Nilsen www.ingvarius.com |
Ingvar Nilsen
Delphi Developer |
2006-02-08 11:03:40 PM
Re: One good argument against using "with"
When New Borland (R) is established, maybe we can get this:
function Foo: Integer; begin if (x = y) then Exit with 1; Result := 0; end; That would lift Delphi up to the C# convenience regarding this. The tip is free, provided I get some shares in New Borland (R) <g> -- Ingvar Nilsen www.ingvarius.com |
Jolyon Smith
Delphi Developer |
2006-02-09 03:40:08 AM
Re: One good argument against using "with"
In article <43e9606c$XXXX@XXXXX.COM>, Robin@.com says...
Quotewith MyIBDataSet.SelectSQL do data set to attempt to locate parameters. There are ways of turning this behaviour off, but imho it is better to define your SQL in a local const and assign to SQL.Text in one hit where-ever possible. This also keeps your code cleaner and encourages you to describe what your SQL is doing (by it is const name), e.g: MyQuery.SQL.Text := SELECT_CustomersWithOverdueOrders; +0.02 -- Jolyon Smith |
Robin
Delphi Developer |
2006-02-09 05:30:26 AM
Re: One good argument against using "with"
Roger Lascelles writes:
Quote
-- Robin. <disclaimer>Not an expert </disclaimer> |
Robin
Delphi Developer |
2006-02-09 05:36:17 AM
Re: One good argument against using "with"
Jolyon Smith writes:
QuoteThe bigger problem with this is that repeated calls to "Add" strings to I have started having a 'query' unit, and having functions which build TStrings and I then assign that to the query. Similar idea, but substantially more overhead I'd emagine then your method :-) -- Robin. <disclaimer>Not an expert </disclaimer> |