Does anyone make it differently

My programming runs along these steps
1) try to understand (if in doubt write some code to tests)
2) make it work
3) restructure it
4) make it prettier

I try to get a handle to the problem. What do I have, what do I know, what do I have to learn to understand. After that I try to make something work which solves at least some kind of problem with the project. I’m not doing TDD in general. So sometimes I write a text beforehand and sometimes a test after the implementation. So I’m not writing test to fail always.
What I always do (but in the rare cases). I run the code a) through the compiler (if available) and b) run it in the debugger to check.

Most times I use object-oriented languages and object-based languages (in my case WLanguage and VBA) But I also have Java, C# installed and yes, I download libraries which I often find there to test things. Currently, it’s Xrechnung/Zugferd and for that, you can find:

https://www.mustangproject.org/?lang=de, https://www.e-rechnung-bund.de/standard-xrechnung-3-0-1/
What I think I have learned, going to the Java/C# track means loading tons of libraries. And I guess it is good working, but it’s terrible much and getting it needs time and if you believe it or not, there are better solutions for part of it in WLanguage e.g check XML handling: Just take a look here: https://doc.windev.com/en-US/?3081018

I don’t know if there is Software which works similar in Java or C#. But of course I may be wrong, just let me know if you know better.

Then to 2) the first implementation usually means hardly much structurung just writ it down. Yes, I’m using some Objects for it and of course I use methods/functions/procedures, Data Structures and Classes/objects. But it migh look like in a test like this:

obj is dynamic CUBL_Invoice
obj = new CUBL_Invoice(101268)




ds is Data Source = QRY_Verkauf
// obj.addInvoiceCommonDataHeader()


inv is dynamic xmlNode <description="UBL-Invoice-2_1.Invoice"> = obj.xmlDoc.Invoice


TestCheckEqual(inv.IssueDate, "20241014")
TestCheckEqual(inv.InvoiceTypeCode, 380)
TestCheckEqual(inv.DocumentCurrencyCode, "EUR")

obj.addSupplierInformation()
obj.addCustomerInformation()
obj.addPaymentMeans()
actQuery is Data Source = QRY_Verkauf
actQuery.paramSearchFor = 101268
HExecuteQuery(QRY_Verkauf)
HReadFirst(QRY_Verkauf)
IF HFound(actQuery) THEN

TestCheckEqual(obj.xmlDoc.Invoice.AccountingCustomerParty.Party.PostalAddress.Country.IdentificationCode, "DE")
END
HClose(actQuery)


obj.addTaxTotal()
obj.addMonetaryTotal()
obj.addInvoiceLines(GCS_CB_VERKAUF)

XMLSave(obj.xmlDoc, fParentDir(fCurrentDir()) + "\out\after_assign_InvoiceCommonHeader.xml", XMLFormatting+xvNoValidation)

So yes that does what it should do and is not well structures.
Then the 3) comes into play. I’m nearly always using Polymorphism and template methods. So I try to figure out some kind of a root class with the stuff which is needed in it and implement that. So I don’t have to care about that down the inheritance line.
There will always be some kind of methods to be overwritten /extended

Currently, it is this one: PROCEDURE addPart()

I’m building a XML document out of parts, and the parts are subclasses of the top class.
I try to improve on the naming, and for that, I’m grateful if there is at least some support for in the language I have to use. And there is but one tool which is always there in WLanguage and Access, you can run a compiler and fix the problems along the compilation errors. I can assure you it works, and it really helps.

I like the wording from tsoding daily about this „Compiler supported refactoring)
See this channel: https://www.youtube.com/@TsodingDaily

I really like this channel and the way he does things. I guess I’m not alone with that.

Any programmer among the few readers here, who like to share what they do/think?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert