Jump to content




Recent Status Updates

View All Updates

Binpress - Cut your development time and costs in half
Photo
- - - - -

Open source my OIOIC, a completely new object-oriented mechanism for the C.


  • Please log in to reply
46 replies to this topic

#1 pervise.zhao

pervise.zhao

    CC Regular

  • Just Joined
  • PipPipPip
  • 29 posts

Posted 11 March 2009 - 09:22 PM

OIOIC is a completely new object-oriented mechanism for the C programming language.
Please download the "OIOIC-Primer-2nd-Edition-English.tar.gz". (the English version of << OIOIC Primer >> )
Downloads - oioic - Google Code

Welcome your advice!

Using OIOIC, you can describe the flower, birds, grass, insects, trees, houses ...
Using OIOIC, you can describe the elements, atoms, protons, electrons ...
Using OIOIC, you can describe the earth, the sun, the Milky Way galaxy, collapsar ...
Using OIOIC, you can describe ...

1. OIOIC perfectly supplies the gap of object-oriented technology for the C programming language;
2. OIOIC perfectly solved the multiple inheritance problem in the Software World;
3. OIOIC perfectly objectivizes multithreading access control of object;
4. OIOIC unifies the norm of components in the Software World;
5. OIOIC unifies the structure of code tree in the Software World;
6. OIOIC unifies the thinking of object-oriented programming in the Software World;
7. OIOIC unifies all advanced programming languages in the Software World, to make the C programming language as the preferred.
  • 0

#2 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,915 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 12 March 2009 - 08:07 AM

Aside from the fact that this is a VERY spammy post (and a double post at that), why wouldn't I just switch to C++ and use the Boost library to get threading?
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3 pervise.zhao

pervise.zhao

    CC Regular

  • Just Joined
  • PipPipPip
  • 29 posts

Posted 15 March 2009 - 07:20 PM

Aside from the fact that this is a VERY spammy post (and a double post at that), why wouldn't I just switch to C++ and use the Boost library to get threading?


STATEMENT: THIS IS NOT A SPAMMY POST!

OIOIC is a thinking of completely new object-oriented programming for the C, totally different from the C++ ! In my opinion, OIOIC is FAR STRONGER than the C++ in object-oriented programming!So I open it. I hope OIOIC can help the development of software。
  • 0

#4 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,915 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 16 March 2009 - 08:30 AM

You made several extremely broad claims that were extremely short on details.

1. OIOIC perfectly supplies the gap of object-oriented technology for the C programming language;
2. OIOIC perfectly solved the multiple inheritance problem in the Software World;
3. OIOIC perfectly objectivizes multithreading access control of object;
4. OIOIC unifies the norm of components in the Software World;
5. OIOIC unifies the structure of code tree in the Software World;
6. OIOIC unifies the thinking of object-oriented programming in the Software World;
7. OIOIC unifies all advanced programming languages in the Software World, to make the C programming language as the preferred.


These claims don't really tell me anything. Here are some immediate questions that come to mind:
1) Which OO paradigms are supported?
2) Are you saying that allowing multiple inheritance is a problem, or that implementing it is a problem? Java disallows it while C++ implements it efficiently.
3) Can you clarify on this item?
4) I have no idea what you mean by this.
5) I have no idea what you mean by this.
6) The thinking about object-oriented programming is splintered. Adding another OO mechanism will not change that.
7) No. Just no. C will probably never be the preferred web programming language, for example.

In addition to the comments questions above, what is this "Software World" you speak of?

I downloaded your tutorial. It betrays several things:
1) OIOIC appears to be a preprocessor of some sort.
2) You seem to be limited primarily to using Visual C++.
3) In my opinion, the code it is producing is hideous compared to C++.
4) It seems like you're trying to recreate something similar to C++ while preserving all the ugliness of C.

Perhaps if you did a code comparison between a complete (simple) program in OIOIC vs the comparable C++ program. As an example, here is a sequence of tutorials I did using C++:
http://forum.codecal...zy-boolean.html
http://forum.codecal...-fuzzy-set.html
http://forum.codecal...-fuzzy-set.html
Viewing the resulting code, I think it is clean, clear, and concise. What would these look like in OIOIC?

Please don't misunderstand, I believe you are very excited about this project. That said, excitement doesn't make it a good replacement for other technologies. Also, I am well aware that it is possible to do OOP in C. It is not clear to me how OIOIC facilitates this.
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5 pervise.zhao

pervise.zhao

    CC Regular

  • Just Joined
  • PipPipPip
  • 29 posts

Posted 17 March 2009 - 01:35 AM

1) Which OO paradigms are supported?

Unlike C++, OIOIC has no "class", replaced by "node". A node, witch provides the four features commonly present in OO languages: abstraction, packaging, inheritance and polymorphism, is a highly abstract to an entity.

2) Are you saying that allowing multiple inheritance is a problem, or that implementing it is a problem? Java disallows it while C++ implements it efficiently.

As far as I know, before OIOIC, no one language can support well the multiple inheritance. On the contrary, often heard that all languages are avoiding or suggesting programmers not to use multiple inheritance, for instance the Java mentioned by you. The relation of multiple inheritance is naturally existent, so we should not shy away from multiple inheritance, but try to achieve it.

7) No. Just no. C will probably never be the preferred web programming language, for example.

I think, the text data by an Markup Language just is a format of data stream for an OIOIC object, the Object absorb and analyses these data streams and implements.

In addition to the comments questions above, what is this "Software World" you speak of?

In fact, we are describing this real world in sofrware, so I have introduced the "Software World".

I downloaded your tutorial. It betrays several things:
1) OIOIC appears to be a preprocessor of some sort.

Yes, and the oicc is a main utility for the preprocessor.

2) You seem to be limited primarily to using Visual C++.

DO NOT think that OIOIC is only for the Visual C++. The reason of assuming Visual C++ in examples is: 1. the user of Visual C++ is more; 2. the C programming language is independent of any development environments.

3) In my opinion, the code it is producing is hideous compared to C++.

I do not think so. I think that the OO encapsulation of OIOIC is better. In my opinion, to determine one thing should be assign to the programmer or to the compiler, the C is the most fair referee.

4) It seems like you're trying to recreate something similar to C++ while preserving all the ugliness of C.

No, I think C is the best, rather than C++.

Please don't misunderstand, I believe you are very excited about this project. That said, excitement doesn't make it a good replacement for other technologies. Also, I am well aware that it is possible to do OOP in C. It is not clear to me how OIOIC facilitates this.

I consider that OIOIC is great, so I open it. I expect everyone to join in the discussion and look forward to everyone's views.
  • 0

#6 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,915 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 17 March 2009 - 08:25 AM

So far, what you are saying is that OIOIC doesn't offer any features not already present in C++.

I look forward to seeing how you would implement the three tutorials I referenced using it. There's nothing like comparing code between languages to highlight advantages and disadvantages.
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7 pervise.zhao

pervise.zhao

    CC Regular

  • Just Joined
  • PipPipPip
  • 29 posts

Posted 17 March 2009 - 10:50 PM

So far, what you are saying is that OIOIC doesn't offer any features not already present in C++.

I look forward to seeing how you would implement the three tutorials I referenced using it. There's nothing like comparing code between languages to highlight advantages and disadvantages.


OIOIC is designed for the C programming language. In my opinion, compared with the C, apart from OO, C++ has no other advantages to speak of. The C is simple and flexible, but C++ is tanglesome and fussy. More alarming is that the C++, as its name, has be growing fat yet. For programmers, a programming language is only a tool, the programmers are only the users of this tool. As a programming language, its functions should be the more powerful the better, and its usage should be more simple and easy the better. Programmers should be allowed to put more energy into the specific design and exchange of ideas, and should not waste too much energy in the study of the language. This, in all programming languages, only the C did. Formerly, except there is no object-oriented features, and no one dare say that there is other disadvantages in the C, but now, the C has the powerful OIOIC already. In addition, C++ did not implement well multiple inheritance, for example, the constructor of base class is called repeatedly.

Besides providing four features in OO languages and objectivizing multithreading access control of object, OIOIC creatively makes the following four great "unifies" become possible:
1. Unifies the norm of components.
2. Unifies the structure of code tree.
3. Unifies the thinking of object-oriented programming.
4. Unifies all advanced programming languages into the C.

The significance of these four "unifies" is self-evident.

Edited by pervise.zhao, 17 March 2009 - 11:41 PM.

  • 0

#8 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,915 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 18 March 2009 - 05:11 AM

OIOIC is designed for the C programming language. In my opinion, compared with the C, apart from OO, C++ has no other advantages to speak of. The C is simple and flexible, but C++ is tanglesome and fussy. More alarming is that the C++, as its name, has be growing fat yet. For programmers, a programming language is only a tool, the programmers are only the users of this tool. As a programming language, its functions should be the more powerful the better, and its usage should be more simple and easy the better. Programmers should be allowed to put more energy into the specific design and exchange of ideas, and should not waste too much energy in the study of the language. This, in all programming languages, only the C did. Formerly, except there is no object-oriented features, and no one dare say that there is other disadvantages in the C, but now, the C has the powerful OIOIC already. In addition, C++ did not implement well multiple inheritance, for example, the constructor of base class is called repeatedly.

Having read The Design and Evolution of C++, I have to disagree with your comparison of C and C++. C++ did a lot more than simply add OO methods. Examples:
1) greatly reducing the need for macros, which can cause subtle bugs that are hard to isolate. This is accomplished through the use of const variables and templates.
2) increasing the strength of the type system, which forces the programmer to be explicit when performing unsafe conversions. While annoying, this forces the programmer to be more conscientious of unsafe casts.
3) By using a gradual evolution, C++ was able to keep its size modest, the compiler efficient, and allow programmers to slowly add features that C++ offers to their code without penalizing them for unused features.
4) Operator overloading allows C++ to create classes behave like built-in data types. A matrix class can be built that has meaningful + and * operators and will also warn you at compiler time if you attempt a nonsensical operation, like adding a matrix to an integer.

There are numerous other changes that C++ introduces. For me, the ultimate change that impacts me on a regular basis is the difference between
cout<<myint;
and
printf("%d",myint);
cout uses operator overloading to correctly output an integer every time. With printf, if I make a mistake and use the wrong specifier for my data type (like %d with a double instead of an int), the compiler won't complain and I'll get REALLY strange bugs. The same applies to cin vs scanf.

Besides providing four features in OO languages and objectivizing multithreading access control of object, OIOIC creatively makes the following four great "unifies" become possible:
1. Unifies the norm of components.
2. Unifies the structure of code tree.
3. Unifies the thinking of object-oriented programming.
4. Unifies all advanced programming languages into the C.

The significance of these four "unifies" is self-evident.

1) I'm not sure what you mean by this.
2) what if I disagree with the structure you impose on me?
3) thinking about OOP is inherently not unified (See Java vs C++ for many examples). OIOIC will not change that.
4) C and C++ code can be linked together, as can Fortran code. I suspect you don't see how different languages serve different purposes. My take on it is that you are re-inventing the wheel.
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#9 pervise.zhao

pervise.zhao

    CC Regular

  • Just Joined
  • PipPipPip
  • 29 posts

Posted 18 March 2009 - 11:16 PM

Having read "The Design and Evolution of C++", I have to disagree with your comparison of C and C++. C++ did a lot more than simply add OO methods. Examples:
1) greatly reducing the need for macros, which can cause subtle bugs that are hard to isolate. This is accomplished through the use of const variables and templates.
2) increasing the strength of the type system, which forces the programmer to be explicit when performing unsafe conversions. While annoying, this forces the programmer to be more conscientious of unsafe casts.
3) By using a gradual evolution, C++ was able to keep its size modest, the compiler efficient, and allow programmers to slowly add features that C++ offers to their code without penalizing them for unused features.
4) Operator overloading allows C++ to create classes behave like built-in data types. A matrix class can be built that has meaningful + and * operators and will also warn you at compiler time if you attempt a nonsensical operation, like adding a matrix to an integer.

There are numerous other changes that C++ introduces. For me, the ultimate change that impacts me on a regular basis is the difference between

cout<<myint;
and
printf("%d",myint);
cout uses operator overloading to correctly output an integer every time. With printf, if I make a mistake and use the wrong specifier for my data type (like %d with a double instead of an int), the compiler won't complain and I'll get REALLY strange bugs. The same applies to cin vs scanf.


1) I'm not sure what you mean by this.
2) what if I disagree with the structure you impose on me?
3) thinking about OOP is inherently not unified (See Java vs C++ for many examples). OIOIC will not change that.
4) C and C++ code can be linked together, as can Fortran code. I suspect you don't see how different languages serve different purposes. My take on it is that you are re-inventing the wheel.



Macro is reasonable, I like macro.
Operator overloading is unreasonable, I do not agree with Operator overloading.
“cout<<myint;” and “printf("%d",myint);”, I prefer the latter.
C++ is more and more fat ...

Attention,please! OIOIC starts from philosophy (the Philosophy of Dialectical Materialism), not language, and is designed all through on the high level of the philosophy, not merely on the level of language.

This is NOT re-inventing the wheel.

Edited by pervise.zhao, 19 March 2009 - 01:19 AM.

  • 0

#10 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,915 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 19 March 2009 - 07:55 AM

Looking at Chapter 3: Single Inheritance of your tutorial (English), all of your code is presented as snapshots. Since I have not downloaded OIOIC to follow the directions, perhaps you could post the code necessary for that example to compile (I use GCC).

Based on that, I'll be happy to write the corresponding C++ code for comparison. I already noticed that you appear to have a LOT of custom datatypes that don't all appear to be defined in the code you posted.

EDIT: Never mind the first part, I saw the download link for the source code. I find it somewhat odd that the source code for such a simple application spans 20 files. I find it stranger that you are creating aliases for built-in data types. Why should float be refered to as SR32, for example?

I am working on the corresponding C++ code now.

EDIT2: First issue: I wasn't able to get your code for example 3 to compile using gcc. If you can provide directions, that would be nice. There may have been changes required to get it to compiler under Linux, but the code is extremely cryptic. By contrast, the line to compile mine is "g++ Factory.cpp car.cpp vehicle.cpp -o Factory". All my files are in one directory.

Second issue: you are typedef happy. Your typedefs obscure what is going on. I ended up doing cross-file search/replace to get back to core data types so I could interpret the code.

Third issue: the matching C++ (see below) is 50 lines. As near as I can tell, it uses the same logic as your code. By a rough approximation, yours uses over 3000 lines of code.

Final issue: The logic for car is scattered across multiple files in multiple non-nested folders. In particular, having to trace through oioic/oioic.c to find code for so/go/car/car.c was annoying at best. My sense is that there is no true encapsulation of data, with functionality and definitions scattered across a wide variety of different files.

If anyone's reading, the example code can be downloaded as part of the tutorial at: http://oioic.googlec...-English.tar.gz

vehicle.h:
#ifndef __VEHICLE_H__
#define __VEHICLE_H__

class Vehicle
{
public:
  float weight;
  Vehicle();
};

#endif
car.h:
#ifndef __CAR_H__
#define __CAR_H__
#include "vehicle.h"

class Car : public Vehicle
{
public:
  float  max_load; 
  float  max_velocity; 
  Car();
};

#endif
vehicle.cpp:
#include "vehicle.h"

Vehicle::Vehicle()
{
  weight = 1.01f;
}
car.cpp:
#include "car.h"

Car::Car()
{
  max_load = 1.53f;
  max_velocity = 186.5f;
  Vehicle::Vehicle();
}
Factory.cpp:
#include <iostream>
#include "car.h"
using std::cout;

int main()
{
  Car             g_pCar;
  cout<<"car's weight is "<<g_pCar.weight<<" ton.\n";
  cout<<"car's max-load is "<<g_pCar.max_load<<" ton.\n";
  cout<<"car's max-velocity is "<<g_pCar.max_velocity<<" km/h.\n";
  return 0;
}

Edited by WingedPanther, 19 March 2009 - 06:11 PM.
Created C++ code

  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#11 pervise.zhao

pervise.zhao

    CC Regular

  • Just Joined
  • PipPipPip
  • 29 posts

Posted 19 March 2009 - 07:22 PM

Looking at Chapter 3: Single Inheritance of your tutorial (English), all of your code is presented as snapshots. Since I have not downloaded OIOIC to follow the directions, perhaps you could post the code necessary for that example to compile (I use GCC).

Based on that, I'll be happy to write the corresponding C++ code for comparison. I already noticed that you appear to have a LOT of custom datatypes that don't all appear to be defined in the code you posted.

EDIT: Never mind the first part, I saw the download link for the source code. I find it somewhat odd that the source code for such a simple application spans 20 files. I find it stranger that you are creating aliases for built-in data types. Why should float be refered to as SR32, for example?

I am working on the corresponding C++ code now.

[/CODE]


Even though all examples are assumed the Visual C++, but a minor modification will make them to adapt to GCC in Linux/Unix. Perhaps the necessary changes are:

1. In the “oioic.h” file, postfix “LL” for the following each macro, as follows:
#define MSKOS 0xFFFF000000000000LL
#define MSKHO 0x0000FFFFFFFF0000LL
#define MSKSO 0x000000000000FFFFLL

#define OID_OICOS 0x0001000000000000LL
#define OID_UNIX 0x0002000000000000LL
#define OID_LINUX 0x0003000000000000LL
#define OID_WINDOWS 0x0004000000000000LL

2. In the “oioic.h” file, define OID_OS as OID_LINUX, as follows:
#define OID_OS OID_LINUX

3. In the “ho.h” file, postfix “LL” for the “0x0000xxxxxxxx0000” in commentary, as follows:
/* #define OID_HO (0x0000xxxxxxxx0000LL | OID_OS) /-* HO’s OID.*-/ */


This is a good thing to to write the corresponding C++ code for comparison. Look forward to your results of the comparison

SR32 is the data type of 32 bits signed real number.
UR32 is the data type of 32 bits unsigned real number.
  • 0

#12 Phoenixz

Phoenixz

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 222 posts

Posted 20 March 2009 - 12:09 AM

I'm still reading. I find it quite interesting, but I do think pervise.zhao is fighting a losing battle and I don't know C++ so well, but C++ haas a lot of things different, and I kinda like code that is neat, but 3000 lines to do a 40 line job? kinda way OTT.
  • 0
Posted Image




Powered by binpress