Forgot your password?
typodupeerror

Comment: Re:Getters and setters (Score 1) 543

by MemeRot (#44332365) Attached to: Visual Studio vs. Eclipse: a Programmer's Comparison

About the only thing a getter and setter offers is an advantage of doing something before / after accessing the variable for a read / write operation... which breaks the objected oriented mentality.

How does it do that? A form might pass over [date] [time] [timezone] and my object might have [utc_datetime]. The setters for date, time, and timezone set private variables that i don't care about individually. And my getter for utc_datetime will stick date and time together, then look at the timezone and the date and figure out what amount of hours to add or subtract, and return the utc_datetime. But only in cases where the calling code actually ends up requesting it. Otherwise that calculation can be skipped.

Comment: Re:Biggest Visual Studio defect: Runs on Windows (Score 1) 543

by MemeRot (#44300929) Attached to: Visual Studio vs. Eclipse: a Programmer's Comparison

There is a product by a company called Xamarin that lets you write C# and compile it for many platforms - iOS, Android, Mac, and Windows. You can either develop in their IDE, or treat their product as a plugin to Studio.

There's also Mono. The ServiceStack web services framework is completely portable between windows and mono on linux.

Or you can use PyTools (http://pytools.codeplex.com/) to write python.

It's still predominantly used for Windows. But the other opportunities are much more than they used to be.

Comment: Re:Getters and setters (Score 2) 543

by MemeRot (#44300825) Attached to: Visual Studio vs. Eclipse: a Programmer's Comparison

Not mentioned in the other responses is the opportunity to use the "resource acquisition is initialization" or "lazy loading" pattern. You may have a field that gets populated by a relatively expensive operation like a database query. So your options are to fill it in during the object initialization. Or to have a get method that will check whether the private variable it exposes has a value yet. If not it goes and fills it in and then returns it. If you access that field in ~50% of your uses of the object you've saved a ton of database queries. The the calling code just uses CompanyConfig.AllowSomeOption freely.

That requires you to actually code that of course. The automatic get/set is just giving you the opportunity to do stuff like that. Once your class has exposed a public int MyField; you really can't come back later and change that. But exposing a public int MyField {get; set;} lets you come back and fill in the get/set logic when needed

Comment: Re:Getters and setters (Score 1) 543

by MemeRot (#44300731) Attached to: Visual Studio vs. Eclipse: a Programmer's Comparison

The automated get/set provides the ability to come back later and add your own custom get/set functions. Knowing that 90% of the time you never will. But if you do come back and do it, you have to do the whole shebang - declare your private variable and have the get and set operate on that variable. I believe the need for an explicit common private variable to use in both of them is why you can't leave one as automatic

Comment: Getters and setters (Score 3, Insightful) 543

by MemeRot (#44299293) Attached to: Visual Studio vs. Eclipse: a Programmer's Comparison

"One full-time Java programmer told me that he hasn’t had to manually type in any setters and getters in years, and he has a template from which all his objects are typed in automatically, thanks to the code snippet tools in his favorite editor (which isn’t Eclipse—he uses IntelliJ). Clearly, methods of automated typing seem to be a favorite among a lot of programmers. So why did Visual Studio remove a feature that facilitated this? Who knows."

Let's not mention the fact that in C# you don't need to manually type in all the getter/setter junk, just public int MyField {get; set;}

"Most of us, when all is said and done, like what we like and make up reasons for it afterwards." -- Soren F. Petersen

Working...