Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is soft coding? (Anti-pattern)

I found the Wikipedia entry on the soft coding anti-pattern terse and confusing. So what is soft coding? In what settings is it a bad practice (anti-pattern)? Also, when could it be considered beneficial, and if so, how should it be implemented?

like image 959
Ola Eldøy Avatar asked May 05 '09 06:05

Ola Eldøy


People also ask

Is softcoding an anti-pattern?

The term is generally used where softcoding becomes an anti-pattern. Abstracting too many values and features can introduce more complexity and maintenance issues than would be experienced with changing the code when required. Softcoding, in this sense, was featured in an article on The Daily WTF.

What are anti-patterns in software?

In software, anti-pattern is a term that describes how NOT to solve recurring problems in your code. Anti-patterns are considered bad software design, and are usually ineffective or obscure fixes.

What is softcoding?

Softcoding is a computer coding term that refers to obtaining a value or function from some external resource, such as text files, INI files, preprocessor macros, external constants, configuration files, command-line arguments, databases, user input, HTTP server responses.

What is the difference between soft coding and hard coding?

Soft-coding: it is process of inserting values from external source into computer program. like insert values through keyboard, command line interface. Soft-coding considered as good programming practice because developers can easily modify programs. Hard-coding.


1 Answers

Short answer: Going to extremes to avoid Hard Coding and ending up with some monster convoluted abstraction layer to maintain that is worse than if the hard coded values had been there from the start. i.e. over engineering.

Like:

SpecialFileClass file = new SpecialFileClass( 200 ); // hard coded

SpecialFileClass file = new SpecialFileClass( DBConfig.Start().GetConnection().LookupValue("MaxBufferSizeOfSpecialFile").GetValue());
like image 118
Chad Grant Avatar answered Jan 27 '23 07:01

Chad Grant