When one examines the problem holistically, is as if the software industry is presently at a state of development that say chemical engineering was at the time of Lavoisier circa 1790. Today, chemical engineering is probably the most mature and developed of all engineering professions.
In the IT world not a day goes by without notable hacks and other stuff-ups, good engineering finds this unacceptable and quickly does something about it. Software development is not only plagued by the lack of discipline, also its developers are so often devoid of ethics – look at the Volkswagen scam for instance. Problems such as this come about because the software industry has no way of policing itself. Bad development practices such as obfuscating code behind compiler compilation only exemplifies this, it not only allows bad coding and security faults to go unnoticed but it leads to a proliferation of disparate and non-standard practises. True engineering relies on products being out in the open for all to see and evaluate. This is a serious problem that the IT industry must resolve before it can be granted the status of true engineering.
By necessity, posts like this are short, so it's difficult to enunciate in detail why this is so except to say that much of the ill discipline within the industry comes from the way software workers actually work. I'm not alone in believing this, I'd suggest you read this article from 25 years ago: Software's Chronic Crisis, Trends in Computing, by W. Wayt Gibbs - Scientific American; September 1994: http://www.di.ufpe.br/~java/graduacao/referencias/SciAmSept1...
I can only add that improvements that would ultimately grant software development true professional engineering status have been pretty scarce since 1994, from observation of present-day problems many would say things have actually gotten worse. Perhaps like other engineering professions, the industry will need another 50 to 100 years to fully mature.