Getters/Setters result in more brittle code? [closed] - getter-setter

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
A small debate flared up in a question about protected member variables regarding the use of getters/setters. There are lots of questions already over whether getters/setters are evil, however one particular argument against them, which was posed by two separate individuals with much higher reputation than myself, struck me.
One said that getters/setters made the code only 0.01% less brittle, and the other stated that adding 10 lines of code where one would do makes the code more brittle.
This goes against most of what I had previously read, been taught, thought, or experienced. Does anyone else agree/disagree with those comments?

I know it is close to herecy, but I hate get/set methods. Loathe them. Almost never write them.
Generally, a class should either provide much more high-level operations than directly and simply reading and modifying internal state variables, or it should get the hell out of the way and act like the struct it is.
Even if I were to write one, I would almost never use it inside the class. The whole point of them is that you can change the internal representation of thing without affecting a client. Inside the class, it is the internal representation you care about! If you are tempted to do a lot of operations on the class using its own interface inside the class, you probably have a second class in there fighting to get out.

Related

Why is Perl market position in server-side scripting so low, even less than Java? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
As per the article at W3Techs, Perl ranks the lowest among the server side scripting languages, even less than Java? Is there any reason behind it? Perl, as far as I see, is very popular, and an awesome language, how come it is hardly used by websites? Does it have issues with server side scripting?
This article has a lot of details on how W3Techs gets their data: http://w3techs.com/blog/entry/usage_of_perl_for_websites_fell_below_1_percent
As i did some analysis on this, let me summarize in short that the data presented by W3Techs is deeply flawed and extremely misleading. First off, it is important to know that they detect technologies of sites by running simple scripts at them that look for file suffixes in urls and then just take that and never verify with the site owner. As such they have a "no-detect" rate of 17.6% (plus an unknown "false-detect" rate). A more correct version of their chart would be this:
If you'd like to get more details and more mistakes in their data methodology, please take a look at the comments of the article, especially those written by "Mithaldu" or "Christian Walde", i.e. me. I posted extensively there as to why their data is nearly useless and why they're even misinterpreting the data they do have.

What is an "Object Database" and when is it beneficial to use one? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm quite familiar with what I understand to be relational databases such as mysql where you have tables, rows, columns and joins to figure out how content relates.
Someone suggested I use an object database for a project I'm busy with but I don't know what an object database is nor when it would be beneficial over a relational database.
I have already googled, wikipedia is a wealth of information (yes, sarcasm) and I must admit the few links I followed were not particularly enlightening. I therefore turn to the future google; crowd sourcing information. Does anyone know a good article I can read, or could anyone explain it to me.
Thanks in advance.
The main idea behind an object database is that you would be storing the objects as is inside your database, e.g. not breaking them up into relational constructs like tables with rows and columns.
The basic premise is that retrieving an object from such an object database would be much simpler - just "grab" the object, no mapping, no translation or anything needed.
See some links for more information:
db4o (db4objects) - maker of an object database for .NET and Java (open source)
ODMBS.org - site with lots of good (and freely useable) information on ODBMS
The biggest challenge for OO-DB is making the finding and retrieving of those objects stored as simple as possible, and also provide good performance. And their lack of widespread use also hinders their adoption.

What are the coding-styles for grouping declarations of properties and corresponding synthesize calls? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm still learning, so I don't have my working convention yet for grouping my properties in header files, and the same is about synthesize calls. Sometimes I group them in one order, sometimes in another order. Also, I'm synthesizing those properties in one or two paragraph of calls, but I saw some people use different synthesize call for every property. However, my laziness tell me that approach is a little big coding overhead :)
Later, I'm adding new stuff as development goes thought, so very often, I end up in a sort of a mess IMHO :) I do understand and try to use as much MVCs as I can, but still some of my MVCs contain 20 - 30 properties because of a lot of graphics that are designed in IB. Later, I'm doing some refactoring but still curious maybe some of you have a strong rules for code cleanness?
With #synthesize I always put them on separate lines so each prop has its own synth directive, this really helps with version control and clarity.

Flexibility of Yii [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I have come across a fair bit of information on CI being a really flexible framework. Does Yii also allow great flexibility? And the ability to pick and choose when to use it or your own php?
Flexibility is very subjective, so this question is a bit vague.
From my experience I can tell you that Yii is very very powerful, but in most cases when you want to go into really advanced territory you have to do things "Yii's way". If you do, you will find that the pieces of the puzzle click together really well and things go smoothly. If you don't (because presumably you haven't realized yet what "Yii's way" is), it's going to give you a hard time.
I am using YII since 2 years. I use it with combination with Zend AMF and create backend systems for Flash campaigns, create HTML5 webpages, simple pages, different competition pages and and find it usable for every case you need. The main advantage that it is really structured, logical and fast. So because of that I am spending my time on creating application logic, not on setting up environment, setting up all requests, pages, subpages etc., MVC model + ActiveRecord saves my time here.
I have been using Yii for a year now and find it very flexible. You can add your own methods to any model or write components outside models. You need to be familiar with the MVC structure, Object-oriented programming and for writing components, you need to know how to register the component in the config file and how to call it the Yii way.

How to add a new feature to an existing component? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
We have this legacy image viewer component in our project that's working fine but it's source is a real mess. I have to add a new feature to this component so that people can add annotation to images using a light pen which is not a complicated task per se but could be a nightmare dealing with our existing code.
I'm really confused right now I don't know where should I start . do I have to refactor the existing code?if not what else can I do?
So here's my question: What could be the best (less painful) approach dealing with such situations?
The question is not an exact duplicate, but this exact same answer applies (you just have a list of one change)
https://stackoverflow.com/questions/1386824/hired-as-a-developer-to-maintain-and-update-current-code-base-no-docs/1386844#1386844
Write lots and lots of tests that will allow you to verify that changes you make to the system do not change or break existing functionality.
These tests are like the brace-work that is used to support a physical building when a construction crew is doing reconstruction. That brace-work is used to keep the existing infrastructure intact. You need to preserve the infrastructure of your system with as many unit and integration tests as you have time to write.
These tests will allow you to make small, iterative changes to the system and easily verify that those changes still maintain the expected behavior.
You should read this very good article Big Ball of Mud. And for your answer we all get a big ball of mud at some point and we need to add new functionality to it. Re-factoring such a code is not a good idea since it require alot of testing. But adding few new lines will not harm it. So unless you have alot of time and so does the tester just add the new functionality to your existing code. Although the current code look messed up but remember it works and tested. Read the article and makeup your mind as to which approach is good.