Quantcast
Channel: User GordonM - Software Engineering Stack Exchange
Browsing latest articles
Browse All 41 View Live

Comment by GordonM on Lesser of two evils regarding return types

It's more a question of building a library for managing computations with things like money whilst avoiding floating point calculations.

View Article



Comment by GordonM on SQL: empty string vs NULL value

Your example is flawed because a) a good designer avoids long forms like the plague on the grounds that the length of a form is inversely proportional to how many people actually complete it, and b)...

View Article

Comment by GordonM on When comparing a string variable to a string literal...

In languages that use = and/or == for assignments/comparisons it's normally best practice to put the thing that can't change on the left so that you can't do an accidental assignment when you meant to...

View Article

Comment by GordonM on How to find all occurrences of a variable within a...

grep -i "variable_name"

View Article

Comment by GordonM on Why have private fields, isn't protected enough?

Shouldn't it be "Private by community"? :)

View Article


Comment by GordonM on Why isn't there a primitive "complex number" type in Java?

It's not a proper programming language if it doesn't support imaginary numbers!

View Article

Comment by GordonM on Exception Handling: When and Why?

My personal opinion regarding exceptions is that the clue is in the name. They should be used for dealing with exceptional circumstances, such as a network going down part-way through a data transfer,...

View Article

Comment by GordonM on Why is Global State so Evil?

@CraigBrett I'd disagree for 2 reasons: 1, explicit dependencies are always better than implicit ones, and 2, if you need to pass one object through a lot of others to get it where it needs to be then...

View Article


Comment by GordonM on My boss decided to add a "person to blame" field to...

I'm curious, what was the outcome with this? Did your manager go ahead with the finger pointing exercise or did you manage to talk him out of it? If the former, what was the effect of it?

View Article


Comment by GordonM on Unit Testing: Method per test versus data provider

@DavidArno yes, like I said, it's a contrived example :)

View Article

Comment by GordonM on Are there guidelines on how many parameters a function...

@alpha123 Presumably the zero argument method is intended to be used in the context of a class instance, in which case it gets its state from the class properties. Assuming you write small classes with...

View Article

Comment by GordonM on Liskov Substitution Principle in Clean Architecture

I think you might be slightly misunderstanding what "behaviour" means in this context. Here behaviour means "Executing a given action will return a result in a particular format", not "Executing a...

View Article

Comment by GordonM on How to avoid the need to Unit test private methods

A thorough unit test should implicitly cover all private members of a given class, because while you can't call them directly, their behaviour will still have an effect on the output. If they don't...

View Article


Comment by GordonM on Multiprocessing vs multithreading

There isn't a right answer, it depends on circumstances which is the better choice. I suspect that the answer they were looking for is "It depends on the circumstances". I also think they were looking...

View Article

Answer by GordonM for Should we ever delete data in a database?

There have already been plenty of good answers to this that pretty much boil down to "Depends on the circumstance", and I can't add anything to those. One thing that hasn't been mentioned, however,...

View Article


Answer by GordonM for MIT License Question (download somebody else's code and...

MIT license is pretty permissive, most things you want to do with the code should be acceptable (IANAL, though). It would definitely be considered good form to maintain attribution to the original...

View Article

Answer by GordonM for Should you use Fields or just Properties in C#?

Something else to consider: Actual properties are an implementation detail. One of the goals of OOP is to try and minimize the exposure of implementation details where practical. The reason for this is...

View Article


Answer by GordonM for Why is using System.out.println() so bad?

Building an entire testing strategy around echoing out the content of internal state isn't the smartest move but for quick and dirty tests of code in development the odd println here and there won't...

View Article

Answer by GordonM for Caching's Effect on Program Performance

Caching is a simple trade off. You save the time needed to compute a result at the expense of having to allocate memory for a lookup table that holds all the results you're likely to need. Whether or...

View Article

Answer by GordonM for Should I continue to perform freelance work for...

What does 'complete' mean? Does it mean 'All the tasks in the contract are done'? If it does then your client is clearly in breach of contract and you should consider getting a lawyer to write him a...

View Article

Answer by GordonM for Do good project managers need a programming background?

Technical skills don't make a good manager, good management skills do. It can be helpful if a manager has done their time in the "trenches" as they can have an appreciation of the process that laymen...

View Article


Answer by GordonM for Should I pass an object into a constructor, or...

Your first example is an example of the Dependency Injection pattern. A class with an external dependency is handed the dependency by constructor, setter, etc. This approach results in loosely-coupled...

View Article


Answer by GordonM for Learning Zend Framework 1 or 2?

You should learn both, but I'd personally put more emphasis on ZF2. ZF2 is the package that will have the longest lifespan ahead of it, whilst ZF1 is probably going to go into maintained mode once ZF2...

View Article

Answer by GordonM for How can a non-technical person learn to write a spec...

Sorry to be the one to break this to you, but it's not a non-technical person's job to learn how to write formal specifications. It's the developer's job to interview the non-technical person, try to...

View Article

Answer by GordonM for Is it a common practice to minimize JavaScript usage...

Having a site that can be used without JavaScript means that it is available to the widest possible audience. While it's true that the majority of browsers support JavaScript and the majority of users...

View Article


Answer by GordonM for should I extend or create instance of the class

Without knowing the names and purposes of the real classes it's hard to say. The decision hinges on whether class B is really a type of class A or whether class B just needs some service class A...

View Article

Answer by GordonM for Is there a way to develop desktop software using PHP?

When all you have is a hammer...In theory, yes. In practice I wouldn't. There is a PHP-GTK extension that allows you to build GUI applications on top of PHP (though I've never used it). However, PHP is...

View Article

Answer by GordonM for How can I deal with a team member who dislikes making...

Maybe this guy needs to be given an appreciation of good coding discipline, and why it's important for other people to be able to understand code he's written. I've worked on some truly awful codebases...

View Article

Answer by GordonM for Re-gaining confidence of senior programmer

One thing you need to find out right off the bat is whether he's disheartened because you couldn't give a comprehensive defence of your choice of framework, or if it's because you used a framework. In...

View Article



Answer by GordonM for Why does automated testing keep failing in my company?

One thing about automated testing is that it requires you to write code to be testable. This is not a bad thing in and of itself (in fact it's good because it discourages a lot of practices that as a...

View Article

When to use DI and when to create yourself in Java

I've a decent amount of OOP with various languages but am pretty new to Java. I'm reading through a lot of tutorials where large numbers of objects are created within the code of a class, and I'm...

View Article

Answer by GordonM for How important is it to reduce the number of lines in code?

There's a lot of answers here that address the technical pros and cons of keeping LOC down and whether or not it's a meaningful quality software metric. That's not what this question is about. What...

View Article

Open Source license compatibility checker

Is there a tool available for checking if various combinations of open source licenses are compatible with each other? I'm planning on building various tools that use an Apache license for distribution...

View Article


Answer by GordonM for How much freedom should a programmer have in choosing a...

I'm going to assume that you were honest up front during your interview about your lack of C# knowledge, because if you weren't then you might be in a very precarious position from a legal standpoint....

View Article

What to do when you inherit an unmaintainable codebase? [duplicate]

Possible Duplicate:Techniques to re-factor garbage and maintain sanity?I've inherited 200K lines of spaghetti code — what now?I'm currently working at a company with 2 other PHP developers aside from...

View Article

Image may be NSFW.
Clik here to view.

Determining a class structure

I'm currently in the early stages of designing an e-commerce application. I'm working out some designs for my classes which have so far been fairly straightforward, but I've run into something of a...

View Article


Answer by GordonM for How does a developer code in anticipation of change?

There are plenty of methodologies given for making your code more adaptable and maintainable, but most of them have the following points at their core: Keep methods small: Your methods should only do...

View Article


Answer by GordonM for Lesser of two evils regarding return types

In the end I decided on option 4. Have the interface specify that getAmount() can throw an exception, and have the BigAmount implementation throw one should it not be possible to express its value as...

View Article

Answer by GordonM for Does setTimeout() really execute in parallel?

No, it doesn't. "Execution context" doesn't mean "thread", and until recently Javascript had no support for anything resembling threads. What actually happens is that an event is pushed onto the event...

View Article

Answer by GordonM for How to test the tests?

Tests shouldn't be "smart" enough to harbour bugs. The code you're writing implements a set of specifications. (If X then Y, unless Z in which case Q, etc etc). All the test should be attempting to...

View Article

Using a single table for identity and metadata

I'm in the early design phase of a project to provide an e-commerce platform that will require several entities to be modelled, products, customers, orders, CMS pages, etc. They will all have a few...

View Article

Browsing latest articles
Browse All 41 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>