Competitive Programming (CP) or Software Design (SD) or Test Driven Development (TDD)?

  • Long ago I wrote an article "Software Design or Competitive Programming? on the Forum The question is still up-to-date: Is it Software Design or Competitive Programming or just a resurrected iteration of Testing-Enhancement called Test Driven Development? Whatever it is, Software Development is an artwork. The more people "rush" into Software development work, the more software Development becomes obtuse and confusing.

    Software development is nowadays so abused that anyone who could run an app on a computer is entitled as a Software Developer. What an irony. However, like in the artistic world one should distinguish different kinds of Software development. The two most common forms are Application Development and Software Development (or System Development).

    Application Development requires a global knowledge that bases mostly on knowing of existing software components or available APIs (Application Programming Interfaces). Meaning: Application developers accomplish their application by assembling it with some APIs. C# or Java or Python application developers are fully dependent on available API-Packages (standard or proprietary). On the other hand, Software (or System) Development usually starts from scratch. C# or Java or Python Software developers are more creative than Application developers because they have to devise something new, something that only exists in functional specifications.

    A software -regardless of its origin as Application or System- is only useful if it is neat, (almost) bugfree and fast. The ole grub "Don't touch the running system" is the deadliest belief that bases on the fear that any enhancement or modification could cause some irreparable havoc. And the result of such a belief is usually a bad-ugly and obese software that runs sluggish, reacts with an eternity time, and sometimes it could monopolize the entire system by hogging the whole available memory. To avoid such stupid belief Software needs to be neatly designed (and redesigned), checked (and recheched) for alternatives and thoroughly tested (and retested). Also: Software Design followed by Competitive Programming which might be improved by Test-Driven Development. And that is the complete software development process: SD-CP-TDD. A chain is bad at the weakest link. A software is bad if one of the SD-CP-TDD links is flawed.

    The following example shows you how a SD-CP-TDD process works. Given task: create a text file and write an increasing number between 0 to 1000000 in sequence and separated by a blank (or space or hex 20). The example can be written either in C# or Java or Python or C/C++. I demonstrate here 4 variants written in Java.

    1. First variant: using conventional IO

    2. Second variant: using new IO (FileChannel)

    3. Third variant: as Proprietary API

    4. Fourt variant: new technique

    As you see, the same task, 4 different solutions with different response times (the best is achieved by Proprietary API which is between 0.110 mSec. to 0.126 mSec.). The 4th way is out of question: too slow. The last 3 contenders have almost the same response time. So, now what?

    • Software Design produces 4 solutions
    • Competitive Programming gives 3 solutions
    • Test Driven Development?

    Let's check their physical size in bytes. Why? Less memory = less loading time = better performance.


    and the size of the 1st solution (Conventional IO) is the best, the second best is the Proprietary API solution. Mikhail Kalashnikov said

    Things that are complex are not useful. Things that are useful are simple.

    And the 1st solution is the simplest, the 2nd solution with New-IO is structurally more complex than the 3rd Proprietary API which looks complicated, but it isn't. The sequence is also:

    Gold: 1st solution with conventional IO
    Silver: 3rd soluiton with Proprietary API (recommended only for experienced Software Developer)
    Bronze: 2nd solution with New-IO FileChannel and CharBuffer

    Joe Feb. 3, 2018

    Nguồn: Kipalog

Hãy đăng nhập để trả lời

Có vẻ như bạn đã mất kết nối tới LaptrinhX, vui lòng đợi một lúc để chúng tôi thử kết nối lại.