Archive for September, 2010
Checking for imported file – the hard way
Posted by alexander in Guldkorn aka WTFs on September 30, 2010
At first glance this doesn’t seem that bad. Read again! As always, the code has been modified to hide its origin.
CREATE OR REPLACE PROCEDURE insert_file(
I_FILENAME VARCHAR2,
I_CHECKSUM VARCHAR2
)
AS
CURSOR c1 IS SELECT *
FROM filename
FOR UPDATE OF checksum;
L_CHECKSUM_COUNT NUMBER := 0;
BEGIN
FOR rec IN c1 LOOP
SELECT COUNT(*) INTO L_CHECKSUM_COUNT
FROM filename
WHERE checksum = I_CHECKSUM OR filename = I_FILENAME;
IF L_CHECKSUM_COUNT > 0 THEN
raise_application_error(-20120,'File already exists '|| I_FILENAME ||'.');
END IF;
INSERT INTO filename(id, filename, checksum)
VALUES(seq_id.nextval, I_FILENAME, I_CHECKSUM);
EXIT;
END LOOP;
END;
Industry experience
Posted by alexander in Kära dagbok on September 21, 2010
The other day I got a typical recruiter question: What industries do you have experience with; telecom, gaming, or finance?
Ok. There are some differences:
- Telecom: with luck, cool real-time hardware programming. No luck: some frontend portal.
- Gaming: keeps up with technology. Cool server-side.
- Banking: legacy and main frame warning! Plenty of legislation. You don’t dare to touch anything.
Regardless of the differences, the question is quite demeaning, in my opinion. What if you’re in the software production industry? That’s an industry in itself, and its inherent practices take many years to learn and master. As a software production professional, you must learn your domain well enough to create the software for it, but you are not to drown in it. Some domains will be more interesting than others, but your main domain is still that of software. It’s hard to write good software, and software professionals should learn that first, before claiming expertise in an industry domain.
Javaforum 14/9
Three speakers this time, and all good! I’m going to keep two of the summaries short, because the last one was by far the most interesting.
Understanding adaptive runtimes
Two presenters from JRockit explained what a runtime is, and that they have written a book about JRockit. I’m most likely going to buy it soon. The book is supposed to cover not only JRockit, but some more general topics in the field of Java and runtimes.
Now, I’ve been to a couple of JRockit presentations throughout the years, so I’m sort of keeping up at high level with what they’re doing. In this presentation they didn’t talk about their deterministic GC, but about the monitoring capabilities and requirements on runtimes. Cool technology, knowledgable presenters, but not a very new topic.
Introduktion to Terrastore
Two commiters from the Terrastore project gave an overview of what Terrastore actually was. Now, running the risk of having mistunderstood something, it goes like this:
Terrastore uses Terracotta to provide clustering for a document-based database. JSON-structured documents are stored in a distributed environment and can be queried using XPath and XQuery.
Personally, I haven’t figured out what these databases are good for yet, having only experience from first normal form heavily indexed NoSQL databases, but it will come to me I’m sure.
The Professor and the Entrepreneur
This presentation was given by Mary Poppendieck! How cool is that? Having her here in Sweden. It was very informative, and again there’s the risk of mistunderstanding, but this is as I have perceived it:
In order to succeed with product development (of any kind), two types of roles are required: A Product Champion and a Competency Leader. The Product Champion is both a marketing lead and a technical lead, while the Competency leader in conjunction with small unit management skills forms the Line Manager role. At the roughest level, the Product Champion knows what to do and the Competency Leader knows how to do it. The Product Champion assembles a business team that makes sure that the product succeeds and the Competency Leader is an expert in a critical technical field. There was more to it, but the central take away was the concept of Product Champion and Line Manager.
This setup has some consequences. For example, product architecture is the domain of the Product Champion, and Mary was clear when saying that she wouldn’t bet her money on an evolving architecture, if the product were to have a long life span. Another interesting consequence was that Scrum Masters were classified as process leaders, and were not needed according to this division of labour/responsibility (in the long run). Their responsibilities already fit in the Line Manager role.
While not being a central point, I reacted to that she said that where she worked, her manager could always do her job. That’s quite an intriguing thought!
This summary doesn’t give the presentation justice, but it does include my take aways.
It’s important to comment code
Posted by alexander in Guldkorn aka WTFs on September 10, 2010
This requires no explanation:
/* Private log object */
private LogHelper logger = new LogHelper(this.getClass());
/* Text resources */
private static ResourceBundle bundle = ResourceBundle.getBundle("resources.Message");
private static String issueComment = bundle.getString("message.issue.comment");
// Default to 100
int batchSize = 100;
The designer is dead! Long live the architect!
Posted by alexander in Uncategorized on September 9, 2010
I’ve observed an interesting phenomenon lately. The death of design! I’m not sure where it started, but once upon the time there was an activity in the development cycle called design. Simply put this is where the arrangement of components in the system was made.
The distinction between design and architecture is that the outcome of the former does not affect system quality attributes, unless performed really poorly. Of course, design can affect security, maintainability, and most likely performance (to name a few), but in a well-balanced and clearly communicated architecture, this should not be the main problem.
I agree, this argument has several flaws, but the main point is that there is a border not frequently crossed by the average developer (or team). Behind this border you find questions about what to outsource and what not to, what system to build and what system to buy, what infrastructure provider to chose and so on. Again, there are exceptions, but most developers are not involved in these discussions, which are being held in the architecture domain.
I find it difficult to argue about architecture, but I want to make a distinction between choosing between Struts 2 and Spring MVC and deciding what brand the payroll system will have, and what kind of impact its introduction will have on other systems used in the company.
Anyway, this lengthy discussion leads to my observation: In the world of agile methods, self-organizing teams and two-week heartbeats, the design activity is performed continuously and by every developers. Hence, it has lost its meaning. This carries the implication that senior developers, whose decisions affect the design of the system suddenly become architects! After all, calling yourself senior is kind of weak. There has to be a cooler job description.
In the jungle of different definitions of architecture, this just adds to the confusion.
On programming and the thinking process
Posted by alexander in Mjukvarukvalitet on September 9, 2010
Once in a while you hear that programmers/developers have strong logical skills, which is why they are drawn to the profession. After years of browsing code I’m not sure if I’d bet my life on it. After all, programming has three elements: sequence, selection and iteration. That’s it.
The ability to combine these into better or worse structures is what distinguishes good software developers from bad ones. Yes, it may be an over simplification, but the fact remains: Sometimes you see programs written in a way that would make you want to switch profession immediately and become a psychiatrist.
You’d like to place the developer in a comfortable couch and ask: What went on in your head when producing this? Do you really need ten levels of nesting to perform a trivial operation on a collection? Is the best way of attacking a sequence of operations by creating a monster method? Are these random names helpful to you in any way? Does commenting the obvious make you feel better? Please explain.
Now to the thinking process. The scary thing is this: If the developer visualizes the solution to standard programming problems using overly complicated and seemingly random code structures, how does the same person view everyday problems like getting out of bed or crossing the street?
Nu blir bloggen konstig…
Posted by alexander in Uncategorized on September 9, 2010
Går ifrån att köra inlägg på svenska till att köra dem på engelska. Då kan man bli flamad av flera
. Det kanske dyker upp någonting på svenska i fortsättningen också, men ambitionen är engelska och en tydlig språkseparering i framtiden.