Corporate Programming Style/Patterns/Anti-Patterns

Status
Not open for further replies.
So I work for a large company ( > 10,000 employees), and when I first started there, I had much to learn...and admittedly much to still learn today, but the good thing is that I'm aware of that fact. Now I wouldn't consider myself a coding whiz or anything like that...we build your typical CRUD intranet business apps. But I do want to build systems that are easily maintainable and well designed.

Having said that, I have noticed, as I get better at development and am more able to see poor implementations, that all of the stuff written around me is done following this style:
[*]"as long as it works, the job's done"

No one around me cares about SOLID principles or design patterns. They don't know what they are and when I try to explain why I coded something the way I did, I get something like: "Too many classes, too complicated...interfaces are not needed, Unit Tests seem like a lot of work...etc."

Is this typical for other Corporate environments or is my company the exception??
 
It's common in small to medium shops too. I've been on a few interviews for software developer positions and talking with their senior developers about practices didn't fill me with confidence.

I don't necessarily think Agile, Design Pattern dogma, TDD or whatever the latest in thing is matters so much, but things like no automated builds, Source Safe and lack of testers just seems to be the norm!
 

Dracorat

Ars Tribunus Militum
2,798
dolphyjazz":1znjyosg said:
Now I wouldn't consider myself a coding whiz or anything like that...we build your typical CRUD intranet business apps. But I do want to build systems that are easily maintainable and well designed.

Mirror all this for me and what I'm about to type...

Having said that, I have noticed, as I get better at development and am more able to see poor implementations, that all of the stuff written around me is done following this style:
[*]"as long as it works, the job's done"

This is not an invalid stand-point especially in a business sense. That said, it's not exclusive (one or the other) to the rest of what we're about to talk about either.

No one around me cares about SOLID principles or design patterns. They don't know what they are and when I try to explain why I coded something the way I did, I get something like: "Too many classes, too complicated...interfaces are not needed, Unit Tests seem like a lot of work...etc."

This is the problem. "It works, it's done" is fine, but "we've always done it like this" isn't. Systems emerge, languages emerge, standards emerge and in order to be the best at what you do (or even just to stay relevant) you have to be constantly re-emerging as a programmer. Sticks in the mud won't cut it. Eventually, they'll be obsolete.

Is this typical for other Corporate environments or is my company the exception??

This is typical for organizations where the management are managers but have no coding/technical expertise. Companies that realize that their management should be educated on the core job functions of its employees and thus coder-managers would be able to do some coding (or have at least in the past) usually realize the benefits of standardization, adaptation and education. And in those organizations, the problems herein aren't "eliminated" but they are "greatly reduced".
 

shade1978

Ars Tribunus Militum
2,525
Subscriptor++
Is this typical for other Corporate environments or is my company the exception??
This describes the corporate environment I used to work in. One incident I particularly remember: We were a VB6 shop in the process of transitioning to .NET. They sent us to two weeks of .NET training that covered C# and VB.NET, and it was unbelievable how much people were complaining about being asked to learn even the basics of C# -- apparently, the syntax was too different and scary.

Stagnation, unfortunately, seems to be the norm in corporate IT, and is why I don't want to go back.
 
Dracorat":2qodyx46 said:
This is typical for organizations where the management are managers but have no coding/technical expertise. Companies that realize that their management should be educated on the core job functions of its employees and thus coder-managers would be able to do some coding (or have at least in the past) usually realize the benefits of standardization, adaptation and education. And in those organizations, the problems herein aren't "eliminated" but they are "greatly reduced".

I believe this is the problem. The manager's only technical experience is/was an Access database he built for the department in the 1990s that improved workflow, reporting, etc. He was eventually promoted to run the developer group and everyone has their own way of getting the job done. The problem now is that everyone wants web apps and I'm currently the only one who's capable (which is good and bad). The others fiddle in the DB and support legacy ETL operations for reporting.

My personal favorite is when they update records in the table because "so-and-so" told them to do so...an audit nightmare.
 
We have a bunch of issues, but for the first time in my life, I have a manager that is actually a better coder than me. Imagine asking technical questions to your manager! Never seen that before in my life. Anyway, he has low tolerance for crap.

We went from a crusty, poorly maintained SVN installation to agile, automated build and testing, ticketing system, code reviews, unit tests, etc. in the space of a year.

There's still a lot of old crap, but it's liberating to have superiors that care and actually mandate you to do things right.
 

Sleepperi

Ars Scholae Palatinae
679
dolphyjazz":3soh1ebw said:
No one around me cares about SOLID principles or design patterns. They don't know what they are and when I try to explain why I coded something the way I did, I get something like: "Too many classes, too complicated...interfaces are not needed, Unit Tests seem like a lot of work...etc."
My condolences. Hopefully you can at least fence off the area of code you are working on, and set up reasonable processes preventing the dinosaurs from creating more mess there so it will eventually be clean and stay clean.
 
Sleepperi":3ckeyd0j said:
dolphyjazz":3ckeyd0j said:
No one around me cares about SOLID principles or design patterns. They don't know what they are and when I try to explain why I coded something the way I did, I get something like: "Too many classes, too complicated...interfaces are not needed, Unit Tests seem like a lot of work...etc."
My condolences. Hopefully you can at least fence off the area of code you are working on, and set up reasonable processes preventing the dinosaurs from creating more mess there so it will eventually be clean and stay clean.
To be fair, any interface with only one implementation is not needed. A few years ago in Java enterprise circles it was all the rage to have a Customer interface and a CustomerImpl class in another package entirely, and that made me cry.
 

Geck0

Wise, Aged Ars Veteran
176
My experience is that the "it's ok because it works" argument usually gets applied to things that are actually pretty dodgy and, at least half the time, end up not working very well. For example some dreadful architecture or design decisions that are going to cause fire and pain later down the line don't matter because the system "works" ...

I try to say to people, writing code that "works" is the absolute bare minimum, if you can't do that then you've got no job as a developer. Writing stuff that is reliable, maintainable, supportable etc that is where you really have to be aiming for if you want to be any good.
 
Geck0":30971k6e said:
For example some dreadful architecture or design decisions that are going to cause fire and pain later down the line don't matter because the system "works"

Technical debt is a difficult concept to wrap your head around for a number of reasons. Given that businesses are at once myopic and abulic, it's hardly surprising that it's rarely accounted for.
 

ronelson

Ars Legatus Legionis
21,399
Subscriptor
That's typical, especially at larger shops with a lot of inertia and resistance to change.
It's typical, period. "Common" might be a better word.
For example some dreadful architecture or design decisions that are going to cause fire and pain later down the line don't matter because the system "works"
"Broken gets fixed, shoddy lasts forever."

That applies across all walks of life, from programming to owning a house.
 
aliftedlorax":3ejqs69t said:
Sleepperi":3ejqs69t said:
dolphyjazz":3ejqs69t said:
No one around me cares about SOLID principles or design patterns. They don't know what they are and when I try to explain why I coded something the way I did, I get something like: "Too many classes, too complicated...interfaces are not needed, Unit Tests seem like a lot of work...etc."
My condolences. Hopefully you can at least fence off the area of code you are working on, and set up reasonable processes preventing the dinosaurs from creating more mess there so it will eventually be clean and stay clean.
To be fair, any interface with only one implementation is not needed. A few years ago in Java enterprise circles it was all the rage to have a Customer interface and a CustomerImpl class in another package entirely, and that made me cry.

This is somewhat outside the scope of the conversation, but I disagree completely. The whole reason that you should program to an interface and not to an implementation is so that your API remains flexible whenever it's needed. I have developed APIs where I provided a single default implementation for the interface and thus made using the API easier, but still programmed to an interface within the code itself.

Just because your code is used one way today doesn't mean that's the way it's always going to be used, and if you can do a little extra work to make sure that it doesn't need to be modified after you're no longer maintaining it, you're doing your job well, instead of simply doing your job.
 

Pont

Ars Legatus Legionis
26,160
Subscriptor
But if you're coding in Java or C#, just use the damn refactoring tools. If you're developing a framework, go at it with Interfaces and Implementation separation. If you only have one implementation, then fuck the Builder, Factory, BuilderFactoryBuilder bullshit and just new-up an implementation (or maybe ClassName.FromConfig() or something simple like that).

...and if you find yourself developing a framework, stop and ask yourself if you really need to. 'cuz there be dragons.

If you only have one implementation, then you can easily refactor that into an interface later. Heck, you could do it without refactoring tool support.

1) Define your new IMyInterface
2) Rename MyClass to MyClassObsolete
3) Build
4) The compiler now gives you a handy list of all the places MyClass is being used in the form of errors
5) Change them to IMyInterface
 
SituationSoap":3fjge0i3 said:
aliftedlorax":3fjge0i3 said:
To be fair, any interface with only one implementation is not needed. A few years ago in Java enterprise circles it was all the rage to have a Customer interface and a CustomerImpl class in another package entirely, and that made me cry.

This is somewhat outside the scope of the conversation, but I disagree completely. The whole reason that you should program to an interface and not to an implementation is so that your API remains flexible whenever it's needed. I have developed APIs where I provided a single default implementation for the interface and thus made using the API easier, but still programmed to an interface within the code itself.

Just because your code is used one way today doesn't mean that's the way it's always going to be used, and if you can do a little extra work to make sure that it doesn't need to be modified after you're no longer maintaining it, you're doing your job well, instead of simply doing your job.

Most program code is not reusable. Planning to have others reuse your code is like planning to have others reuse your Kleenex -- a waste of time and kind of gross.

Sure, in cases where you are expecting users of the library to provide their own command, strategy, templates, or callback hooks, use an interface -- you have to. How do you know when you need that flexibility? Because you already have two or three legitimate alternatives implemented or conceptually well-specified.

There are no legitimate alternative implementations to an application-specific domain object. Granted, I think a big part of that trend was due to tools that required interfaces in order to automatically generate boilerplate code.
 
SituationSoap":3p0n219c said:
This is somewhat outside the scope of the conversation, but I disagree completely. The whole reason that you should program to an interface and not to an implementation is so that your API remains flexible whenever it's needed. I have developed APIs where I provided a single default implementation for the interface and thus made using the API easier, but still programmed to an interface within the code itself.

Just because your code is used one way today doesn't mean that's the way it's always going to be used, and if you can do a little extra work to make sure that it doesn't need to be modified after you're no longer maintaining it, you're doing your job well, instead of simply doing your job.
What you say is true but largely a non-sequitur. Unless class A is accessing class B's fields directly, class A is necessarily using class B through its interface, whether the compile-time type of the instance of class B that class A accesses is a Class or Interface. In other words, every class has an interface; an Interface just allows that interface to be reused. If you don't reuse that interface, you don't need an Interface (unless you're using some crummy tool/library that requires one).
 

hanser

Ars Legatus Legionis
43,855
Subscriptor++
Implementing the feature doesn't even come close to doing things The Right Way. Good design, documentation, implementing the feature, writing unit tests, etc. These are all needed in the practice of good software development.


vherrera0079":20ez9vab said:
We have a bunch of issues, but for the first time in my life, I have a manager that is actually a better coder than me. Imagine asking technical questions to your manager! Never seen that before in my life. Anyway, he has low tolerance for crap.

We went from a crusty, poorly maintained SVN installation to agile, automated build and testing, ticketing system, code reviews, unit tests, etc. in the space of a year.

There's still a lot of old crap, but it's liberating to have superiors that care and actually mandate you to do things right.
You don't get to be a technology manager unless you're damn good. My boss is a Director, and he writes code every day, and does code reviews for people in my group several times a week. He proactively sets up group code review meetings to talk about design choices and implementation details. It's pretty fantastic; reading stories here and in the BR remind me daily of how lucky I am.

Our engineering SVP still writes code once in a while. (Not for the product, but usually to enhance our in-house reporting mechanisms to get exactly the data he's looking for.)

jxl":20ez9vab said:
Geck0":20ez9vab said:
For example some dreadful architecture or design decisions that are going to cause fire and pain later down the line don't matter because the system "works"

Technical debt is a difficult concept to wrap your head around for a number of reasons. Given that businesses are at once myopic and abulic, it's hardly surprising that it's rarely accounted for.
We have quite a lot of technical debt at my company, and a lot of it was simply because the business was growing so fast in the early days, and the technology exists to serve the business (not the other way 'round). That being said, as our growth rate has slowed, it's something that's being aggressively worked on.

So I don't view the accrual of technical debt as a sign of incompetency, though in a purist's world, it might be viewed as such.
 

ronelson

Ars Legatus Legionis
21,399
Subscriptor
Implementing the feature doesn't even come close to doing things The Right Way. Good design, documentation, implementing the feature, writing unit tests, etc. These are all needed in the practice of good software development.
Where most people fail is that "done" means "the code does what I want it to." "Done" should mean that the code is complete, the documentation is complete, the unit tests are complete (and pass!), users have been trained, and the new code has been deployed. Organizations that do not think that way are the antipattern.
 

hanser

Ars Legatus Legionis
43,855
Subscriptor++
ronelson":2bf6ucmt said:
Where most people fail is that "done" means "the code does what I want it to." "Done" should mean that the code is complete, the documentation is complete, the unit tests are complete (and pass!), users have been trained, and the new code has been deployed. Organizations that do not think that way are the antipattern.
Organizations aren't a hive mind, though. The technology people might be feeling some pressure from the business group to get X or Y done to meet certain goals. While the technology people are empowered to push back on unreasonable deadlines, people are still people, and they will feel that pressure, and some of them will cut corners.
 
aliftedlorax":1k01rluv said:
To be fair, any interface with only one implementation is not needed. A few years ago in Java enterprise circles it was all the rage to have a Customer interface and a CustomerImpl class in another package entirely, and that made me cry.

Yeah, Apache's java libs are full of that crap, or at least they used to be (I haven't looked for a couple of years).

SituationSoap":1k01rluv said:
This is somewhat outside the scope of the conversation, but I disagree completely. The whole reason that you should program to an interface and not to an implementation is so that your API remains flexible whenever it's needed. I have developed APIs where I provided a single default implementation for the interface and thus made using the API easier, but still programmed to an interface within the code itself.

That sounds like premature optimization to me.

Just because your code is used one way today doesn't mean that's the way it's always going to be used, and if you can do a little extra work to make sure that it doesn't need to be modified after you're no longer maintaining it, you're doing your job well, instead of simply doing your job.

Sorry, bud, but your code will probably need to be refactored before it's reused. That extra work you did to make it "resuable" probably didn't help and also needed to be refactored.

There's nothing wrong with refactoring. In fact, if you *AREN'T* refactoring, I'd say you're doing it wrong.
 

Tuborg

Ars Tribunus Militum
2,911
hanser":1zmndc9t said:
Implementing the feature doesn't even come close to doing things The Right Way. Good design, documentation, implementing the feature, writing unit tests, etc. These are all needed in the practice of good software development.

To continue on this note, I've worked with many people who either don't see the value in, or maybe even see themselves "above" following checklists. Part of this is human nature, part of it culturally specific to your shop. Many facets of the software development philosophies like SCRUM, agile, TDD can be boiled down to this: have a checklist, follow it, have someone enforce that checklist, automate as much of it as possible. This goes for everything on the list hanser mentioned as well as meetings, automated builds, installation, developer setup, etc.
 
hanser":3cw8n713 said:
So I don't view the accrual of technical debt as a sign of incompetency, though in a purist's world, it might be viewed as such.

I would agree with this statement. It is often the case for me that during a sprint, I incur some technical debt. I start each iteration examining and paying down technical debt if it exists, which it usually does. Being cognizant of it is key.
 

Tuborg

Ars Tribunus Militum
2,911
AnObfuscator":1f1dfnom said:
SituationSoap":1f1dfnom said:
This is somewhat outside the scope of the conversation, but I disagree completely. The whole reason that you should program to an interface and not to an implementation is so that your API remains flexible whenever it's needed. I have developed APIs where I provided a single default implementation for the interface and thus made using the API easier, but still programmed to an interface within the code itself.

That sounds like premature optimization to me.

I'd simply call it pointless. A class already has an interface, the class itself! If in the future you ever need a second implementation, it's an easy IDE button press to turn the class into an interface. Sure the second implementation may require changes, but it's not like you'll be able to predict those, anyway. If you could do that, you would have made the correct interface to begin with.
 

Blacken00100

Ars Legatus Legionis
10,130
Subscriptor
jxl":33909h6q said:
hanser":33909h6q said:
You don't get to be a technology manager unless you're damn good.

The problem with the internet is that things like sarcasm don't come across through it, and I can tell that that's the sort of statement that should be positively dripping with it.
At his company, it seems largely true. Mine's the same way--the technical managers are generally the best and brightest (two of the six managers in the product team are also release engineers, and the other four are on the actually-useful design review board).
 

hanser

Ars Legatus Legionis
43,855
Subscriptor++
jxl":3tryve8k said:
hanser":3tryve8k said:
You don't get to be a technology manager unless you're damn good.
The problem with the internet is that things like sarcasm don't come across through it, and I can tell that that's the sort of statement that should be positively dripping with it.
I meant to say "At my company [etc.]" Which is a completely non-sarcastic statement. We separate managers and technology managers.
 

hanser

Ars Legatus Legionis
43,855
Subscriptor++
dolphyjazz":3165bvk6 said:
hanser":3165bvk6 said:
So I don't view the accrual of technical debt as a sign of incompetency, though in a purist's world, it might be viewed as such.
I would agree with this statement. It is often the case for me that during a sprint, I incur some technical debt. I start each iteration examining and paying down technical debt if it exists, which it usually does. Being cognizant of it is key.
We can file tickets for technical debt. I wonder how common this is?
 

Geck0

Wise, Aged Ars Veteran
176
The point of technical debt is interesting, I think the problem I have come across is that it usually is not really recognised as debt. Usually the bare minimum is good enough and anything more would just be pointless. If you know you are in debt and plan to pay it off that is a very different situation to actually being in debt and not realising or caring.

About the interface which only has one implementation, I think the idea is to future proof your code and minimise changes required down the line. Imagine if you have some class that is used through the stack of a large system or project, yeah you can get the IDE to help refactor but you still have to test and release all that new stuff. If you've hidden behind an interface from day 1 you don't end up having to change as much later on. This is even more true if other people are using your code, they shouldn't have to refactor just because you didn't use an interface from day 1. Using interfaces also tends to makes unit testing & mocking easier (at least it did last time I wrote OO code ... )
 
hanser":2com85mi said:
You don't get to be a technology manager unless you're damn good. My boss is a Director, and he writes code every day, and does code reviews for people in my group several times a week. He proactively sets up group code review meetings to talk about design choices and implementation details. It's pretty fantastic; reading stories here and in the BR remind me daily of how lucky I am.

Certainly hasn't been the norm in most of my professional life. I got so used to "talking down" to my managers when explaining technical issues that my very first week at my current job, my boss told me, "don't treat me like an idiot". I apologized and explained to him the kind of people my previous bosses had been.

We have quite a lot of technical debt at my company, and a lot of it was simply because the business was growing so fast in the early days, and the technology exists to serve the business (not the other way 'round). That being said, as our growth rate has slowed, it's something that's being aggressively worked on.

So I don't view the accrual of technical debt as a sign of incompetency, though in a purist's world, it might be viewed as such.

Writing code in a business means tradeoffs. Technical debt is inevitable when you have business constraints, but the real difference is in how you manage it. We service our technical creditors by paying them in the form of tasks in our sprint.
 

Tuborg

Ars Tribunus Militum
2,911
Geck0":1lq9g3dl said:
Imagine if you have some class that is used through the stack of a large system or project, yeah you can get the IDE to help refactor but you still have to test and release all that new stuff.

Not to go all DrPizza... by virtue of being used everywhere, such a class most likely already has a well-defined interface (i.e. set of commonly used methods). You need to test/release/document in either case because there were non-trivial changes to the code.
 

Pont

Ars Legatus Legionis
26,160
Subscriptor
Geck0":2qdhdxnv said:
About the interface which only has one implementation, I think the idea is to future proof your code and minimise changes required down the line. Imagine if you have some class that is used through the stack of a large system or project, yeah you can get the IDE to help refactor but you still have to test and release all that new stuff. If you've hidden behind an interface from day 1 you don't end up having to change as much later on. This is even more true if other people are using your code, they shouldn't have to refactor just because you didn't use an interface from day 1. Using interfaces also tends to makes unit testing & mocking easier (at least it did last time I wrote OO code ... )
I've got news for you buddy, those bolded statements are pure fiction. It took me longer than I'd like to admit to come to that conclusion, but it's the truth.

Unless you are developing a framework, future proofing is wasted effort. Don't back yourself into a corner, but don't invent requirements either. Hiding the implementation behind an interface doesn't do anything to prevent you having to test the changes because the interface is just words and function signatures, not meaning. Excessive future-proofing also leads to designs that are overly flexible and thus overly complicated for the actual task they're supposed to do.

And if you're not supposed to be developing a framework, don't develop a framework. Good frameworks are hard to write. Bad frameworks haunt you forever.
 
dolphyjazz":34yfwxrg said:
hanser":34yfwxrg said:
So I don't view the accrual of technical debt as a sign of incompetency, though in a purist's world, it might be viewed as such.

I would agree with this statement. It is often the case for me that during a sprint, I incur some technical debt. I start each iteration examining and paying down technical debt if it exists, which it usually does. Being cognizant of it is key.

I agree too. Also, my company values testing and refactoring, so if we come across some poorly-written, poorly-tested code, we are encouraged to improve the architecture and test coverage.

Geck0":34yfwxrg said:
About the interface which only has one implementation, I think the idea is to future proof your code and minimise changes required down the line. Imagine if you have some class that is used through the stack of a large system or project, yeah you can get the IDE to help refactor but you still have to test and release all that new stuff. If you've hidden behind an interface from day 1 you don't end up having to change as much later on. This is even more true if other people are using your code, they shouldn't have to refactor just because you didn't use an interface from day 1.

IMHO, the problem is future-proofing by writing an interface for a single class "just in case" isn't really "future proof". In all likelyhood, if you *do* need to make future implementations, you'll need new methods exposed, or different methods exposed, or change the visibility of some methods, or some combination of all three. The "future proofed" code is just as likely to create more work in the future as alleviate it.

As for testing "all that new stuff", either way, you better be running regression tests for anything you add.

Using interfaces also tends to makes unit testing & mocking easier (at least it did last time I wrote OO code ... )
http://code.google.com/p/moq/
http://code.google.com/p/mockito/
 

Blacken00100

Ars Legatus Legionis
10,130
Subscriptor
AnObfuscator":to9o4afb said:
Using interfaces also tends to makes unit testing & mocking easier (at least it did last time I wrote OO code ... )
http://code.google.com/p/moq/
http://code.google.com/p/mockito/
Mocking can be useful, but it is generally intended for when some other asshole writes an effectively nonextensible class with baked-in behaviors. It doesn't mean you should be that asshole.
 

dodexahedron

Ars Praefectus
3,368
Subscriptor++
Tuborg":cx3p54vr said:
AnObfuscator":cx3p54vr said:
SituationSoap":cx3p54vr said:
This is somewhat outside the scope of the conversation, but I disagree completely. The whole reason that you should program to an interface and not to an implementation is so that your API remains flexible whenever it's needed. I have developed APIs where I provided a single default implementation for the interface and thus made using the API easier, but still programmed to an interface within the code itself.

That sounds like premature optimization to me.

I'd simply call it pointless. A class already has an interface, the class itself! If in the future you ever need a second implementation, it's an easy IDE button press to turn the class into an interface. Sure the second implementation may require changes, but it's not like you'll be able to predict those, anyway. If you could do that, you would have made the correct interface to begin with.

You clearly don't write code that has to be consumed by other teams or you wouldn't be saying this.

Sure, if you're the master of your own code and only you and your team will be using it, that's fine. But if your classes are being used by teams you don't have direct control over, you had better provide a generic and mostly non-changing interface or you're going to have lots of pain and friction each time you make a change.

Getting frantically paged at 10PM on a Sunday by some dev in another team who is scrambling to try to make his team's new release work before Monday morning because it was broken by your code change is not a pretty situation to be in... And it's demonstrably YOUR fault, for failing to either A) follow good practices in coding by delivering a reusable interface or B) informing all dependent teams of every implementation change you made.

That change you made from int[] to List<int>? Yeah - that broke their code because they were calling .Length on your class but now only .Count works since your underlying type is a List. Too bad. Should have used IEnumerable.
 
dodexahedron":3v22nt2m said:
You clearly don't write code that has to be consumed by other teams or you wouldn't be saying this.

Sure, if you're the master of your own code and only you and your team will be using it, that's fine. But if your classes are being used by teams you don't have direct control over, you had better provide a generic and mostly non-changing interface or you're going to have lots of pain and friction each time you make a change.
A class does this just as well as an interface. Changing a class's public API has the same effect as changing an interface's, and changing a class's implementation behind its API is the same as if that API is in an interface. If there's an interface and only one implementing class, the interface merely duplicates the public API of the class.

Getting frantically paged at 10PM on a Sunday by some dev in another team who is scrambling to try to make his team's new release work before Monday morning because it was broken by your code change is not a pretty situation to be in... And it's demonstrably YOUR fault, for failing to either A) follow good practices in coding by delivering a reusable interface or B) informing all dependent teams of every implementation change you made.
You'd get that same call if you make the same exact change to a class that implements an interface, because changing the class would force you to change the interface correspondingly.

That change you made from int[] to List<int>? Yeah - that broke their code because they were calling .Length on your class but now only .Count works since your underlying type is a List. Too bad. Should have used IEnumerable.
I think you're confusing things. The discussion was about whether to create a class or interface. On the other hand, in either case, the API should be as general as is conveniently possible, so for example you should operate on the most general collection type that makes sense in the context. However, that's a different discussion.
 
Status
Not open for further replies.