(via Dave Winer) – I used Fortran as my first professional programming, interesting to see that there are still so many users…
Software Development
There are 96 posts filed in Software Development (this is page 9 of 10).
I am helping Ron Chester with setting up a river of news on Bob Dylan, but some of the sites of interest do not have RSS feeds. This looks like a straight-forward example that could be used for those sites, I will try it out!
Working with callbacks in Javascript
I am playing with the sample code for Dave Winer’s feedRead Github repo, and wanted to refactor one of the examples. I have seen multiple examples of a callback function source code included in a call to another function, but I wanted to have it be a separate function. Here is the example code:
[cc lang=”javascript”]
feedRead.parseUrl (urlTestFeed, timeOutSecs, function (err, theFeed) {
if (err) {
console.log (err.message);
}
else {
console.log (“It took ” + utils.secondsSince (whenstart) + ” seconds to read and parse the feed.”);
console.log (“theFeed.head == ” + utils.jsonStringify (theFeed.head));
console.log (“theFeed.items [0] == ” + utils.jsonStringify (theFeed.items [0]));
for (var i = 0; i < theFeed.items.length; i++) {
console.log (“Item #” + utils.padWithZeros (i, 2) + “: ” + theFeed.items [i].title + “.”);
}
}
});
[/cc]
After some experimenting, I figured out that all I needed in the feedRead.parseUrl call was the function name (with no parameters, even though it had parameters), and then the function could be factored out:
[cc lang=”javascript”]
feedRead.parseUrl (urlTestFeed, timeOutSecs, myparser);
function myparser (err, theFeed) {
if (err) {
console.log (err.message);
}
else {
console.log (“It took ” + utils.secondsSince (whenstart) + ” seconds to read and parse the feed.”);
console.log (“theFeed.head == ” + utils.jsonStringify (theFeed.head));
console.log (“theFeed.items [0] == ” + utils.jsonStringify (theFeed.items [0]));
for (var i = 0; i < theFeed.items.length; i++) {
console.log (“Item #” + utils.padWithZeros (i, 2) + “: ” + theFeed.items [i].title + “.”);
}
}
}
[/cc]
Note that the function does not have a semicolon at the end, but the call to feedRead.parseUrl does…
References:
https://codeburst.io/javascript-what-the-heck-is-a-callback-aba4da2deced
https://javascriptissexy.com/understand-javascript-callback-functions-and-use-them/
How embedded software projects run into trouble
Jack Ganssle has written articles for his top ten list of how embedded software projects run into trouble. Most of this could apply to any software project! Here are the links:
- Unrealistic schedules
- Quality gets lip service
- Poor resource planning
- Writing optimistic code
- Weak managers or team leads
- Crummy analog/digital interfacing
- Bad science
- The undisciplined use of C and C++
- Jumping into coding too quickly
- Not enough resources allocated to a project
When I read this, I decided to start working on the asset that is my weblog. I will strive to post something daily, even if it is only a link….
The debt metaphor in software development
In a new post, Ward Cunningham shares his thoughts on the “debt metaphor” in software development. One of the points he brings out is that programming can be thought of as making decisions now on the functionality of the program and deferring others to a later time (debt), with the understanding that as the program matures, refactoring can occur to make the program more efficient/better (paying back the debt).
In my experience in avionics software development, the creation of software is driven by approved requirements. As requirements change or are refined, the software is updated to be consistent with those requirements. One type of “debt” I see is when functionality is not completed on time, and gets deferred to a later software release (cost increase). Another type is when a problem is found (requirements, source code, tests, documents), but addressing the problem is deferred to a future time (the problem does not impact the functionality of the requirements, source code, or tests, or is deemed not a safety issue). This type of debt (typically called “open problem reports” (OPRs) is getting more scrutiny by aircraft certification agencies and OEMs (Bombardier, Boeing, etc.), since they see increasing numbers of OPRs as an indicator that the overall “health” of the software may not be as good as it should be, and that there should be as few OPRs as possible (in other words, fix your problems as you find them).
For myself, I prefer to fix problems when they come up. However, when you work as a member of a team, sometimes business decisions dictate otherwise….
Itty-Bitty: This app (link to Github) encodes a web page in the URL. I have not figured out how this works yet, but would like to….
Test-Driven Development with Python: Book on using TDD for Django development (there is a link to read online for free!), Selenium is used for browser testing.
Trevord Miller:Â Staying up-to-date as a software developer with a daily learning routine – Learn new things (uses a feed reader), solidify through practice, remember through spaced repetition.