flat assembler
Message board for the users of flat assembler.

Index > Heap > K.I.S.S principle (*in term of programming)

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 8904
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
just wondering if you guys agree the more you know, the harder you follow the K.I.S.S (keep it simple stupid) principle?

and do you have any ways/advices/methods to share that could direct us back to this principle.
Post 23 Sep 2007, 23:15
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Quote:
and do you have any ways/advices/methods to share that could direct us back to this principle.

One simple method is too STOP using object oriented code Evil or Very Mad ! I've never seen more messy and sloppy coding than with object oriented "spaghetti" code Evil or Very Mad ! It's as bad as the old days of programming with goto's and gosubs:cry:. Macros are over-used in c/c++ as well as a lot of windows programming. all this stuff(crap) makes code resemble one giant maze of confusion. Shocked Shocked Shocked
Thanks! Smile for asking this question, I've been wanting to rant about this for some time now.
Post 23 Sep 2007, 23:32
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
well, KISS as long as it doesn't have some unreasonable disadvantage.

For example if some data processing algorithm is speed bottleneck of application, it is fine to use more sophisticated and faster algorithm. But there is no reason to develop something complicated for window procedure, etc.

Objects are often very useful. Sometimes OO code can be even simpler to understand than procedural code, if you already understand how object works. But I agree OOP is being overused by zealot who don't know anything else and think their way is best.

I don't agree macros are often overused in C/C++. I haven't seen lot of unreasonable using macros in most C/C++ projects I saw.
Using macros is reasonable
- if you do make same code construct many times, it saves lot of typing
- if you are using some construct often, and you sometimes need it to beheave differently for entire project (like "assert")
- inline macros can sometimes it can enhance readability by removing operations with magic numbers. This way can also reduce readability if overused, because you have to look up macro definition to learn what is actually done by macro. (good examples are "little_endian to big_endian", unicode operations on UTF16 strings)
Post 24 Sep 2007, 09:51
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
I use it for all my programming, (DexOS is based on it), but i also use "KISAS" as in "Keep It Small And Simple".
The way i do this, is to break every program down into the smallest sub functions and build up and only adding the most needed bits.
A great example of how you can use KISS in any coding project, is the podcast called
"GRC's eCommerce System" Episode #109
http://www.grc.com/securitynow.htm
Its about how "Steve Gibson" a cool ASM only coder, was un-help with the bloatware eCommerce Systems available, so he coded his own in ASM.


Last edited by Dex4u on 25 Sep 2007, 18:13; edited 1 time in total
Post 24 Sep 2007, 19:19
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I like name "GRC" Smile
It means vomit (noun, product of vomiting) in Slovak language Laughing
Post 24 Sep 2007, 20:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
Keeping things simple in FASM usually means you have less work. So you might immagine I'm whole-heartedly for it.

But it needs a little thinking now and then these days, because the operating systems we build our software are already complicated beyond belief and the path of least resistance is usually the one that everybody else uses, which may or may not actually have anything to do with "Simple".

EDIT: Point being that object orientation was essentially supposed to make things simpler... and It Does unless you use it in any modern operating system; which was, per Xerox legacy, best suited for an OO architecture, but isn't based on it because the copycat programmers were too lazy to think ahead, resulting in major headaches in implementing OOs today, requiring abstraction layers and whatnot.


Last edited by DustWolf on 24 Sep 2007, 22:28; edited 1 time in total
Post 24 Sep 2007, 22:24
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Keeping things simple in FASM usually means you have less work

doing nothing means you have EVEN LESS work!

No, sorry, useful things have to be complicated
Post 24 Sep 2007, 22:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
vid wrote:
Quote:
Keeping things simple in FASM usually means you have less work

doing nothing means you have EVEN LESS work!

No, sorry, useful things have to be complicated


Any problem can be solved in multiple ways, and at least one of them is simpler than all the others.
Post 24 Sep 2007, 22:29
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Any problem can be solved in multiple ways, and at least one of them is simpler than all the others.

And usually that way is slower and offers less possibilities, so users stick to more powerful and faster app.
Post 24 Sep 2007, 22:46
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Quote:
Objects are often very useful. Sometimes OO code can be even simpler to understand than procedural code, if you already understand how object works. But I agree OOP is being overused by zealot who don't know anything else and think their way is best.


Maybe I was a bit to harsh with OOP. Maybe It's just the way it's implemented in c++, With C# the code is somewhat readable to me. I'm trying to work with code samples in "3D game programming with DirectX 9.0" which uses c++ and they are just horrible, especially the latter examples. So bad in fact that I had to find some other examples to convert and post on my website. It could also be that I'm just a little to old school now. Smile

Quote:
I don't agree macros are often overused in C/C++. I haven't seen lot of unreasonable using macros in most C/C++ projects I saw.

Lots of times they are used just to elimintate a few parameters from a windows function call. For math equations, numerical constants, and complex low level addressing, they're very useful.

One final thought, I could see how OOP could be useful for large scale projects. For Example, If you have to write code keep track of many different aspects of a business, where the KISS principle most likely won't work. With the exception of possibly coding style.
Post 24 Sep 2007, 22:54
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Maybe It's just the way it's implemented in c++, With C# the code is somewhat readable to me.

As assembly programmer, you should like way OOP is implemented in C++. It is very lowlevel implementation, same (or sometimes better), than you would create in assembly. Of course as a result of this, it is not very simple to use this way (notice again: efficient and powerful things are not simple), so languages with complete abstraction of underlying machine were created (Java, C#).

Quote:
It could also be that I'm just a little to old school now.

I'd say you are too "newschool". C++ is trying to provide you OOP at lowest sane level possible, with very high efficiency and lot of control over things you do. Even at price that learning it properly is complicated, it can be used in wrong way, etc. etc.

Quote:
Lots of times they are used just to elimintate a few parameters from a windows function call.

Well, if that call is used like hundred times in project, or if some parameter for all the calls needs to be controlled by constant, then i could understand it. But i will still rather stick to doing this via inline functions.

Where have you seen macros used this way?
Post 24 Sep 2007, 23:20
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
DustWolf wrote:
Keeping things simple in FASM usually means you have less work. So you might immagine I'm whole-heartedly for it.

I do not agree, it may seem less work because its small etc, but thats miss leading.
Its like good design, those simple lines, but the skill is knowing which line to keep.
Its also like a expert, who is someone that makes a hard job look simple.
Then theres a good logo, the best logo's look simple, but try making a good one Wink .
Post 25 Sep 2007, 18:24
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
vid wrote:
As assembly programmer, you should like way OOP is implemented in C++. It is very lowlevel implementation, same (or sometimes better), than you would create in assembly. Of course as a result of this, it is not very simple to use this way (notice again: efficient and powerful things are not simple), so languages with complete abstraction of underlying machine were created (Java, C#).

If I want low level I can use fasmw to create an assembly DLL and use it in C#. After seeing much spaghetti code useing c++ I'd rather do it this way.

Quote:
It could also be that I'm just a little to old school now.

Quote:
I'd say you are too "newschool". C++ is trying to provide you OOP at lowest sane level possible, with very high efficiency and lot of control over things you do. Even at price that learning it properly is complicated, it can be used in wrong way, etc. etc.

newschool?

Quote:
Lots of times they are used just to elimintate a few parameters from a windows function call.

Quote:
Well, if that call is used like hundred times in project, or if some parameter for all the calls needs to be controlled by constant, then i could understand it. But i will still rather stick to doing this via inline functions.

I didn't say all macro's are bad. In many situations, they are handy. Just that when programers get lazy and macro things that shouldn't be in a macro.

Quote:
Where have you seen macros used this way?

Windows Message Crackers, I think their called.
Post 26 Sep 2007, 08:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
If I want low level I can use fasmw to create an assembly DLL and use it in C#. After seeing much spaghetti code useing c++ I'd rather do it this way.

So you say you can create object in FASM DLL, and then use that object from C# code? Also I can't help to wonder which OOP things in C++ are more "spaghetti" than in C#.

Or you meant to say "C++ is complicated and often used by people who don't understand it, C# is simpler and less often misused, that means C# is better." ?
Post 26 Sep 2007, 09:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
Dex4u wrote:

I do not agree, it may seem less work because its small etc, but thats miss leading.
Its like good design, those simple lines, but the skill is knowing which line to keep.
Its also like a expert, who is someone that makes a hard job look simple.
Then theres a good logo, the best logo's look simple, but try making a good one Wink .


In my world, thinking is easier than working. Smile
Post 26 Sep 2007, 14:15
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
vid wrote:
So you say you can create object in FASM DLL, and then use that object from C# code?


There are no "objects" in dll (unless someone has made macros that allow this.), You create a dll using fasmw and use C# unmanaged code and declarations to access (call) the functions in your x86 assembly dll. This is the ONLY way that I know of to use X86 Assembly with C#. I've posted some time ago an example that demonstrates how to do this. Hmmm, maybe I should repost again?

vid wrote:
Also I can't help to wonder which OOP things in C++ are more "spaghetti" than in C#. Or you meant to say "C++ is complicated and often used by people who don't understand it, C# is simpler and less often misused, that means C# is better." ?

C++ is just c with OOP tacked on the end, and It feels and looks like it. C# was written from ground up for OOP. "C++ is complicated and often used by people who don't understand it, C# is simpler and less often misused, that means C# is better." yeh, I can agree with that. I never really used C that much either, and because of that, when I look at C# code, OOP actually looks more organized and easier to learn, than all the scratch and "tacked on the end" stuff that c++ has. C# has the best of both worlds, use of X86 assembly when needed, and Built from the ground up for OOP. Just the way I see things now.
Post 27 Sep 2007, 14:07
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
can you be precise? which OOP things in C++ are more "spaghetti" than in C#? Name those C++ language constructs, which cause more spaghetti code code than according C# language constructs.
Post 27 Sep 2007, 15:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
I've only seen one thing i like about oop, but that can be simulated without oop. Organization.. For example, in java you have this:

System.out.print() and System.out.println().

Look at that. Organized, and it works with variables too! Though, like i said, it can easily be simulated by removing the dot or using structures instead. Though, if you really want to talk about frivelous things in compilers these days, the java compiler that my school has me install, it has built in spellcheck. It will check your comments for correct spelling.
Post 27 Sep 2007, 20:13
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
are you sure it is *compiler* that does spell checking? not code editor?
Post 27 Sep 2007, 21:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Like many other terms i use "compiler" to referance "IDE." Especially because if you look up compiler, you'll get IDEs. If you wanted to get really technical, i think the term for this is "JIT Debugger (Just In Time Debugger)," but i'm not 100% sure on that.
Post 27 Sep 2007, 21:20
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.