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

Joe viết ngày 04/02/2018

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 Daynhauhoc.com. 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 5 variants written in Java.

  1. First variant: using conventional IO
    alt

  2. Second variant: using new IO (FileChannel)
    alt

  3. Third variant: as Proprietary API
    alt

  4. fourth variant: CP of 3rd Variant
    alt

  5. Fifth variant: new technique
    alt

As you see, the same task, 5 different solutions with different response times (the best is achieved by Proprietary API which is between 0.30 mSec. to 0.40 mSec.). The 5th way is out of question: too slow. The last 3 contenders (1st, 2nd and 3rd) have almost the same response time. So, now what?

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

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

alt

and the size of the 4th solution (N1d/CP-Pproprietary API) is the best, the second best is the conventional IO 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 and the 4th Proprietary API which look complicated, but they aren't. The consequence is also:

Gold: 4th solution with CP-Proprietary API (recommended only for experienced Software Developer)
Silver: 1st (Conventional IO) and 3th solution (as Proprietary API)
Bronze: 2nd solution with New-IO FileChannel and CharBuffer

Joe Feb. 3, 2018

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

White

Joe

19 bài viết.
121 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
White
26 11
Fuzzy Logic and Machine Learning Hi First of all: I apologize everyone for my writing in English. I come to this site because someone of Daynhauh...
Joe viết 11 tháng trước
26 11
White
21 8
Thu Nhat: Toi muon bien bai blog nay bang tieng Viet, nhung toi khong co du chu chu dong...Eh uh then in English. Noboby wants to be beholden as a ...
Joe viết 3 tháng trước
21 8
White
17 5
Hi Vietnamese Forum participants are somehow hot on the item "Machine Learning" and some of them even talk about ML with Big Data (example (Link) ...
Joe viết 3 tháng trước
17 5
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


White
{{userFollowed ? 'Following' : 'Follow'}}
19 bài viết.
121 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!