Reputation
1,931
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
1 9 13
Newest
 Yearling
Impact
~136k people reached

  • 0 posts edited
  • 1 helpful flag
  • 26 votes cast
Sep
18
comment Are design patterns really essential nowadays?
@JörgWMittag It sounds like the pattern is still there, people just have an easier way to write it. For example, suppose there was a language that let you define public builder class foo {...} , where all methods are guaranteed to return this. It may be institutionalized into the language, but it's still there...
Sep
18
comment Is it ever a good idea to use the design pattern name in the implementing classes?
Personally, I'd prefer using AbstractAnimalFactory, and then keep AnimalFactory in reserve in case I need an interface. IMO developing against an interface is generally better, and if you're doing that then you want the commonly-appearing classes to be pleasing to read. (In other words, not IAnimalFactory.)
Sep
16
comment More efficient way to paginate search results
IMO this is one of those areas where no matter what happens it's got warts and eventual performance issues... If you can, step back and look at it as a user-experience problem: If someone's paging too far into the results, that's the real problem, and something needs to change so that they don't have to.
Sep
5
comment How can designing for inheritance cause extra cost?
IMO it's extremely similar to the private/protected/public debates when it comes to APIs: It strongly depends on who controls the class, who wants to inherit the class, communication between the two, and how often new versions come out.
Sep
5
comment How can designing for inheritance cause extra cost?
@Ptolemy So you're saying that un-sandboxed code can defeat a sandbox? How is that news?
Sep
5
comment How can designing for inheritance cause extra cost?
@Cawas C#'s CIL is like Java bytecode, and in both cases there are runtime sanity/verification checks as execution begins. These checks include preventing final/sealed violations. Remember, this is about a trusted base platform running untrusted/sandboxed code, not about somebody creating their own hacked platform from scratch.
Sep
4
comment How can designing for inheritance cause extra cost?
@Ptolemy I suggest you re-read my comment. If the class (e.g. String) is immutable, then by definition you can't "use a handle to the same object and make public calls to change its data", can you? All the public calls are read only. The whole point of sealing is to prevent people from changing that!
Sep
4
comment How can designing for inheritance cause extra cost?
If String was unsealed, you could make mutable String instances. If that isn't terrifying, you're not thinking hard enough about how it could be both a source of bugs and a source of security-holes. Sealing is therefore an important feature when it comes to creating the core runtime and libraries, even if it sees limited use at the application-level.
Sep
4
comment How can designing for inheritance cause extra cost?
Also security is a reason to use it! Consider a sandboxed application trying to access a file. The sandbox might test the filename-strings, but what if an attacker could send you a mutable String and then they mutate it after the security-check but before the I/O? I believe that type of scenario is why Java's String is marked final (similar to sealed) and I bet the same logic underpins some C# decisions.
Sep
4
comment How can designing for inheritance cause extra cost?
Also security is a reason to use it! Consider a sandboxed application trying to access a file. The sandbox might test the filename-strings, but what if an attacker could send you a mutable String and then they mutate it after the security-check but before the I/O? I believe that type of scenario is why Java's String is marked final (similar to sealed) and I bet the same logic underpins some C# decisions.
Aug
30
comment Avoiding boilerplate in PHP classes
If you have too many classes, then templates/macros are the answer. If you have too many arguments to a single class' constructor, then it may be time to reconsider how you are creating instances of that class instead.
Aug
30
revised Two components offering the same functionality, required by different dependencies
added 32 characters in body
Aug
30
revised Two components offering the same functionality, required by different dependencies
added 35 characters in body
Aug
30
answered Two components offering the same functionality, required by different dependencies
Jun
6
awarded  Yearling
Oct
5
revised What are some really simple rules to keep a PHP codebase organized?
added 671 characters in body
Oct
4
revised What are some really simple rules to keep a PHP codebase organized?
added 147 characters in body
Oct
4
answered What are some really simple rules to keep a PHP codebase organized?
Jun
15
awarded  Nice Answer
Jun
6
awarded  Yearling