Quantcast
Channel: User Baldrickk - Software Engineering Stack Exchange
Browsing all 21 articles
Browse latest View live

Comment by Baldrickk on What is the difference between a static library and...

@Useless to clear up any confusion on behalf of any party, I'm interested only in what can be used as a static library when compiling/linking, and not any other type of archive

View Article



Comment by Baldrickk on How Much Logic in Getters

@zzzzBov is spot on here. Logic in a getter/setter should be no more than constraints (or maybe conversions). If there is anything else, it isn't a getter/setter.

View Article

Comment by Baldrickk on Why is the worst case for this function O(n^2)?

@JanDorniak Python has sets and dicts. In fact using dicts in python is more common and easier than using map in C++

View Article

Comment by Baldrickk on Is there a name for this programming pattern?

get_val_from_thing() is a genericalised name. It could be get_sender_from_email() or many other examples, which does describe the operation.

View Article

Comment by Baldrickk on Too much abstraction making code hard to extend

It strikes me that the example "bad" code you are giving here is similar to what I would be inclined to do in a non OO language. I wonder if they learned the wrong lessons and brought them into the OO...

View Article


Comment by Baldrickk on Use an else after exception (or not)

@CodeART and then if you're working with certain MISRA rulesets, you'll get told off for not having the elses...

View Article

Comment by Baldrickk on Is there a pattern for handling conflicting function...

@Graham I didn't react to that... I reacted to the next statement "In response to this, the API team changed the function..." - rolls up into fetal position and starts rocking - It doesn't matter where...

View Article

Comment by Baldrickk on How to treat unhandled exceptions? (Terminate the...

@Matthew with a component based application, it might be just that you have to restart a component, and can then continue. There is still a kill and go again nature of things, but it's not necessarily...

View Article


Comment by Baldrickk on How to avoid code review bottlenecks when some of the...

@BartvanIngenSchenau I think the fourth is as important in this case - as per the question, if reviewers don't see the need for reviews to take place, it'll get a lower position in their personal...

View Article


Comment by Baldrickk on Is it a bad design for a programming language to...

@tchrist not in all languages. Python uses snake case with names_like_this but is actually in the minority. The most common is camel case with namesLikeThis These are not the only two styles.

View Article

Comment by Baldrickk on How to avoid comments about one line of code for...

the tl;dr of this is that comments are good for the why, and not the how

View Article

Comment by Baldrickk on Whose responsibility is it to fix merge conflicts?

And this is also why you want to keep your features/branches small - any conflicts will likewise be kept small, and easy to manage.

View Article

Comment by Baldrickk on Is it better to merge "often" or only after...

If you're purely refactoring, lots of small (completed) changes merged back is good. When developing something, it may take longer to have good, tested, working code. In that case you want to keep it...

View Article


Answer by Baldrickk for Breaking a function into smaller ones is great......

There are two main reasons to put code into multiple functions:Abstraction/EncapsulationReusabilityReusability is of course the simplest to explain. If I have a function:int do_QWERTYalgo(int data1,...

View Article

Answer by Baldrickk for Coding style: Binary logic or multiple if()s?

The priority when writing code is maintainability / readability. There are a large number of factors that can affect this.Breaking it down by example:Example 1:Positives:named variables: by naming each...

View Article


Coding style: Binary logic or multiple if()s?

Something that often comes up in code reviews is the structure of the code, particularly related to the use of control structures, where individuals can be fairly opinionated on what is "right" and...

View Article

Answer by Baldrickk for Limits of Defensive Programming acknowledging that...

Are you expecting null data?Exceptions are intended for exceptional circumstances.The simple rule of thumb for situations like this is to handle standard cases with logic, not exceptions.If a NULL is...

View Article


Image may be NSFW.
Clik here to view.

Answer by Baldrickk for How do I extract only bold text from this image?

You haven't given an example image. so this is speculation.One simple method you could do is to erode the image.This should result in the non-bold text being removed, leaving only the bold text (now...

View Article

Answer by Baldrickk for Avoid if-else block in favor of default assignment...

This is more of a style issue than anything else, and very susceptible to personal opinion.The second example in the question more clearly shows intent, which increases the readability of the code,...

View Article

Answer by Baldrickk for Best Practice - Wrapping if around function call vs...

Wrapping an if around a function call: This is to decide if the function should be called at all, and is part of the decision making process of your program.Guard clause in function (early return):...

View Article
Browsing all 21 articles
Browse latest View live




Latest Images