Science topic

Object-Oriented Programming - Science topic

Explore the latest questions and answers in Object-Oriented Programming, and find Object-Oriented Programming experts.
Questions related to Object-Oriented Programming
  • asked a question related to Object-Oriented Programming
Question
6 answers
Dear all;
I am trying to simulate non-Newtonian fluid flow in porous media with the help of Palabos software. Palabos is a C+++ open-source library that solves flow problems with the lattice Boltzmann method. I am not familiar with object-oriented programming and I want to extract a value from a template that is used in every iteration. To be more precise; I want to print Omega (which is an (Nx-1)*(Ny-1) dimensional matrix) in every 250 iterations in the form of gif or data to validate my result. I added pcout to print variable in this function and it works but it is repeated every iteration which generates too much data ( imagine 200*200 lattice and 10000 iterations!).
I will be really glad if you could help me through this. the code is provided below. also, I uploaded
.h and .hh file to this message
Many thanks;
Elahe;
template<typename T, template<typename U> class Descriptor,int N>
T CarreauDynamics<T,Descriptor,N>::
getOmegaFromPiAndRhoBar(Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T rhoBar) const
{
T nu0_nuInfoverCs2 = (global::CarreauParameters().getNu0()-global::CarreauParameters().getNuInf())*Descriptor<T>::invCs2;
T nuInfoverCs2 = global::CarreauParameters().getNuInf()*Descriptor<T>::invCs2;
T nMinusOneOverTwo = (global::CarreauParameters().getExponent() - (T)1)/(T)2;
T lambdaOverCs2sqr = global::CarreauParameters().getLambda()*Descriptor<T>::invCs2;
lambdaOverCs2sqr *= lambdaOverCs2sqr;
T piNeqNormSqr = SymmetricTensor<T,Descriptor>::tensorNormSqr(PiNeq);
T alpha = lambdaOverCs2sqr * piNeqNormSqr *(T)0.5
*Descriptor<T>::invRho(rhoBar)*Descriptor<T>::invRho(rhoBar);
T omega = carreauDynamicsTemplates<T,N>::fromPiAndRhoToOmega(alpha, nu0_nuInfoverCs2, nuInfoverCs2, nMinusOneOverTwo, this->getOmega());
T tau=(T)1/ omega;
T visco=((T)2 * tau - (T)1)/(T)6;
pcout << "" << visco << std::endl;
return omega;
}
Relevant answer
Answer
Dear all;
I searched among some examples and I figured out that an output image for omega could be easily generated by adding these few lines to the writeGifs function in the CPP file.
imageWriter.writeScaledGif(createFileName("omega", iter, 6),*computeOmega(lattice , Box2D(0,nx-1, 0,ny-1)),
imSize, imSize );
Thank you for your contributions and precious answers.
Regards;
Elahe
  • asked a question related to Object-Oriented Programming
Question
49 answers
I want to learn OOP but i don't know what is adventages of it. Let me know about it. Thank you for your answer
Relevant answer
Answer
Dear respected researchers:
Since I have a similar related case, I want to add the following about the the promised black-box:
"There is a clear and distinguishable variance between both theorizing that is largely based on the theoretical-academic world and the implementation that is conducted upon real-world cases"
The above sentence is from a similar discussion that I have mentioned it on page 39 (i.e. page 10) of the following paper:
Nidhal Kamel Taha El-Omari , “Sea Lion Optimization Algorithm for Solving the Maximum Flow Problem”, International Journal of Computer Science and Network Security (IJCSNS), e-ISSN: 1738-7906, DOI: 10.22937/IJCSNS.2020.20.08.5, 20(8):30-68, 2020.
You can also see the same paper at the researchgate at the following link:
  • asked a question related to Object-Oriented Programming
Question
6 answers
Hi,
I am porting the CommServer software family to GitHub and publishing the products as the open-source. Visit the following page to get more:
From the community reaction, I know that people are going to reuse this software also for research Machine To Machine interoperability. Let me ask you if you have any idea about the priority I shall apply to my road map. The list of products I am going to publish you can find here: CommServer products
OPC UA Address Space Model Designer and OPC UA Viewer are done.
Thanks for any advice.
Relevant answer
Answer
Thank you for your answer. However, let me stress that we are talking about what is going on the wire but not about managing computer resources and instantiate a program. More you can get from:
I know that the Operating System community (actually disjoined communities) has own rules and there is a never-ending discussion about what is better without the definition of the engineering measurement rules to properly define the condition and finally get the black and white picture.
You proposed to add free in front of open-source software. It means that we must talk about money. It narrows the problem. My point is that we should talk about motivation and try to find answers to the questions:
  • how to motivate an end-user to check out the proposal
  • how to motivate the developer to continue improvement
  • how to motivate maintainer to keep the software up-to-date
  • how to motivate teachers to educate new users
  • how to motivate visioners to disseminate the workout
  • how to motivate distributors to convert the solution into products and guarantee quality
The money is not enough to motivate. As far as I know, most of my students expect stability at first. It seems that it will be especially important in the COVID-19 threat context. Usually, money is just must have option.
BTW the software in concern is covered by the MIT license - I don't know a more permissive license. I am not a lawyer so let me know if I am wrong.
Anyway, thank you for feedback.
Mariusz
  • asked a question related to Object-Oriented Programming
Question
7 answers
Dear all,
I have some questions in C++ which I could not get clear answers through internet. It would be very helpful if you could help with it.
1. How to instantiate a non-pure abstract class ( only one of the data members is made pure virtual) in the main(). In internet it is mentioned that, it is possible to create my own constructor to initialize the property members and to use the non-virtual methods. is it possible?. or should the non-pure virtual members can be made static?
2. Some say, that it is even possible to create a non-pure abstract class just my making the destructor as pure virtual, it is possible?
3. What is the actual useof pure virtual destructor in the program actually?
4. Is it possible to use the auto type as return value in case of abstract function? Is it possible to know the type of data carried by auto variable?
5. why sometimes the constructor is made protected, is it liberately done to prevent direct instantiation? what are all the use cases of such practice?
6.If I call a virtual function in the derived class, it takes the default value of that function from base class always, how to override it? why it happens?
7. In multiple inheritance, why I make a class virtual to avoid multiple copies of a same base class, it does not work?
8. Interestingly, if I call the grandchildren class (in multiple inheritance)
class A(contains virtual members) : class B ( non virtual members)
class B : class C ( non virtual members)
class C: class D ( non virtual members)
9. If there is a non-pure abstract class( only one of the members is pure virutal), can I again define it as pure virtual if there is no body/definition literally available in one of the derived class, instead of defining it just for the sake of abstract class instantiation?
if I access the class D object, using the class B/C type pointer, provided that the base class A member function made virtual, the members of the class D is accessed instead of class B. Can I understand that any base class member irrespective of what you use becomes virtual even if one of the base class instance of that member is made virtual?
Hope my questions were clear. Would be glad to provide an example code if required.
Thank you and I look forward to hearing from you.
Relevant answer
Answer
I recommend to ask this Q at: https://stackoverflow.com/
  • asked a question related to Object-Oriented Programming
Question
4 answers
Hi,
Can anyone suggest me a textbook on object-oriented programming of finite volume method?
The programming language does not matter.
Thanks
Relevant answer
Answer
Hi,
The mathematics and the implementation of CC-FVM ( written by MATLAB ) are available in the following link;
Very recommended, the best for beginners. I should say the code is for the structured meshes. I have to say, the way coefficient calculated is not general. It means you pretty much limited to a rectangular geometry.
Good luck with your research, :-)
  • asked a question related to Object-Oriented Programming
Question
7 answers
object oriented programming
Relevant answer
Answer
highly cohesive and loosely coupled
  • asked a question related to Object-Oriented Programming
Question
7 answers
Is there exist an Agent Oriented Language likewise Object Orientation : Object Oriented Language?
Relevant answer
Answer
I recommend using Jadex , which is a platform that use java and XML, with other multiple features.
  • asked a question related to Object-Oriented Programming
Question
5 answers
Data hiding and encapsulation both are the important concept of object oriented programming.
Relevant answer
Answer
Data Mining means extracting useful information from the data warehouse.
Data Hiding means protect the object integrity from unintended or intended changes.
  • asked a question related to Object-Oriented Programming
Question
4 answers
Data hiding and encapsulation both are the important concept of object oriented programming.
Relevant answer
Answer
No relation. Data mining is just a fancy term for searching in a database. For example, finding running sneakers on Amazon is a sort of data mining. And, it seems like you already know what data hiding is.
  • asked a question related to Object-Oriented Programming
Question
4 answers
models and framework related to object oriented regression testing
Relevant answer
Answer
One additional reference of interest, more OO-testing oriented:
Regression testing is close to functional testing in terms of modeling and implementation.
  • asked a question related to Object-Oriented Programming
Question
6 answers
Hi
I want to develop a CFD code which I will be able use it for industrial application.
One of the most important question is, "Have I develop it as an object oriented program?"
Personally, I think, it is not necessary. Because it is developing for a unique application such as wind turbine. However, commercial software like FLUENT, applies on varies of engineering area, so OOP helps them to develop their software faster.
I think it is better for every application develop a unique code. for example for rotor simulation a unique code and for another application, another unique code. because we can use those algorithms which better for this application but in another application, may be their not efficient. so, if we develop a unique code we can save run time and cost eventually.
In my experience, I ran a pitching airfoil by FLUENT and in the same time by a in-house code which used specific algorithms. finally I got 2 hours run time with my code and almost 6 hours by FLUENT.
This was a point that I think by myself that commercial software such as FLUENT are not efficient for industrial application. subsequently, if I develop a code for unique application, so I think I do not need take a time for OOP.
It is my pleasure that I know your comments.
Best Regards. 
Relevant answer
Answer
Own-made code are often the target in academic environment. It is a really different aim from what you want to do with a commercial and very general (generality is enemy of efficiency) code as Fluent. For example, I work in LES and Fluent has very poorly accurate discretization schemes and just few SGS model. Therefore, I code my program if I want to study a flow case with higher accuracy and test different SGS model. In industrial applications there is no room for such studies and Fluent is of course the most used tool.
So, giving a response to you depends on your work environment, flow problem, time for the project to debug and validate your code and many other things.
  • asked a question related to Object-Oriented Programming
Question
1 answer
When implementing 62304 -2015 standard for Medical Software Product. there is a chapter about Legacy Software and a gap analysis is needed to be done to encounter deliverables  and activities of SDLC. Do you have a method to do the gap analysis , Do you have a flow of the process for binding a risk level according to the finding of deliverable ?.
Relevant answer
Answer
Sorry, not for me
  • asked a question related to Object-Oriented Programming
Question
3 answers
in the link of github sha transform has two arguments ctx and byte data[], what is data[] meant for and in the next line wat is i and j and why shifts are done of 24,16,8 and why j added with 3
next step what states mean here and according to what i know that first 16 rounds would be copying the m[16] and next 48 that computations of sigma and all would be done but in this program why direct 64 rounds that are done  and iteration starting from 0 to 64
what are bitlen and bitdata referring too...whybilen added with 512 in if part
and atlast final is completely a  grrek for me i could understand is somewhere padding is done but why if and else part are done with 56 and 64 i donno
and why memset has been used . at last step appending to padding tha message in bits and transform and last steps are completely out of my head now....sorry to ask the question mant times but need some guidance to understand and to work on because im not so strong in c
Relevant answer
Answer
24, 16, 8 these are used to represent the number of bits used in Hash function. Data[] is used for initialized the string used for encryption.
Data[] is used for initialized the string used for encryption.
ctx is a pointer used for naming conversion.
  • asked a question related to Object-Oriented Programming
Question
1 answer
Hi, 
I am currently trying to download a lot of data from the NASA MERRA2 project. 
They are providing daily files of a set of variables in the nc4 format. According to Link 1 it is (was?) possible to directly access single variables inside of the file with ascii format at MERRA. 
A am wondering if it is still possible with Merra2, if yes: 
How do I access this data? I prefer to work with wget to bulkdownload the files via matlab.
I have found some Merra2-Files via OPENDAP, but unfortunately not the ones that I need (M2T1NX...)
Can anyone please help me with this issue? downloading 20TB of data for variables with are in total 1TB seems to much for me.
Relevant answer
Answer
Hi Peter
I expect you should be able to do exactly the same thing with MERRA2 as you have done with MERRA, providing you know the data fields you are looking for. I have added a file with the data specifications for Merra2, from which you should be able to construct your argument for data download.
Hope that helps.
Regards
Bob
enc
  • asked a question related to Object-Oriented Programming
Question
2 answers
The main concept is to load the list of customers in the webpage, in the backend lakhs of customers list is there in the webpage(frontend) when i click the button "list of customers" it will load the first 100 customers list and when i will click the "load more" button it will show the list of next 100 customers list. anyone know the concept how to do it.
advance thanks.
regrads,
Saran
Relevant answer
Answer
thanks for ur answer Mr.Krishnan Umachandran. 
  • asked a question related to Object-Oriented Programming
Question
4 answers
Need the Dataset of bug reports in CSV format. I have read many research papers, they mentioned that, they had taken bug report dataset from bugzilla but i am not able to generate reports. From where I get the dataset??
Relevant answer
Answer
Dear Nishi Madaan,
You may use software bugs data of software Terapromise repository for your analysis. Here you can find different software log file in .csv format. 
  • asked a question related to Object-Oriented Programming
Question
3 answers
I using easyRDF library to communicate with fuseki server in codeigniter. I want to execute CRUC operation, but 
I used below code to select data and to fetch query result:
$this->load->library('rdf');
EasyRdf_Namespace::set('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns');
EasyRdf_Namespace::set('srt', 'http://persuratan-semweb.dev/ontologies/surat.owl');
$sparql = new EasyRdf_Sparql_Client('http://localhost:3030/surat_single/sparql');
$query = "SELECT * WHERE { "
. "?surat rdf:type srt:Surat . "
. "?surat srt:sifat_surat ?sifat_surat . "
. "?surat srt:nomor_surat ?nomor_surat . }";
$result = $sparql->query($query);
echo "jumlah data: " . $result->numRows() . "<br>";
echo "<br>";
foreach ($result as $row) {
echo $row->sifat_surat . " " .$row->sifat_surat . " " . $row->nomor_surat ."<br>";
}
print_r($result);
But, The output I got are (zero row):
jumlah data: 0
EasyRdf_Sparql_Result Object (
[type:EasyRdf_Sparql_Result:private] => bindings
[boolean:EasyRdf_Sparql_Result:private] =>
[ordered:EasyRdf_Sparql_Result:private] =>
[distinct:EasyRdf_Sparql_Result:private] =>
[fields:EasyRdf_Sparql_Result:private] => Array (
[0] => surat
[1] => sifat_surat
[2] => nomor_surat
)
[storage:ArrayIterator:private] => Array ( )
)
Where as if I tried my query in Fuseki endpoint, I got such as in file I attached. I'm completely beginner in semantic web. Does anyone know how to select data and fetch it in PHP, insert, delete, and update data as well?
  • asked a question related to Object-Oriented Programming
Question
4 answers
"Insert" and "Add" are often used like synonyms, but, in your opinion, from a semantic point of view, when it is more correct to call a function prefixed with "insert" and when with "add?"
Relevant answer
Answer
If the choice is between add and insert, I would prefer add when two things are to be mixed together to produce a seaprate result, such as adding two containers-two sets to produce a new one, and insert when a new member is to go into a container. The semantics of add and insert may vary further based on the container data type(s) on which the operation is being performed.
  • asked a question related to Object-Oriented Programming
Question
5 answers
Two way to design OO application:
1. Assign responsibities(logic) to and domain classes by information expert pattern
2. Let domain classes as entity class only contain get/set methods (could have add/delete for multiple references), entity manager does the job to maintain the instances of class. Buiness logic is seperated from entity class as controller class.
What is the way in the real world for OO software engineering? Pros or Cons?
I saw lots of persistence layer frameworks such as JPA/Hibernates/ibatis/EMF as the second way. a little bit confusion
Thanks!
Relevant answer
Answer
You have started your question as object oriented in real world. I dont want to give a text book explanation here. hence I would explain how I would rather see objects and object orientedness. 
State and behavior are the two main aspects of the object. Class defines it as a meta model and instance of the class as an object modifies the state using the behavior attached to that model . 
it has become a common practice "in the name of separation of concern" to define class with just getters and setters for variables. Please view those as state modifiers. There is nothing stopping us to add additional behaviors to either setters or instance methods. say for example, validating through annotation to establish boundary conditions or allowed values or even to modify other state variables within the domain object can all be done within that behaviour of that domain when it doesnt impact the other domains. 
Creation of these objects can be done through several design patterns (according to layered architecture principle one such is entity manager utilized to optimize resources)
If any events has to modify the state of the object, then it could only be through the state modifiers / accessors which takes care of the behavioral aspects before changing the state. 
When we term business logic, it is normally one of those which impacts more than one domain. so in puristic terms it shouldnt be a behaviour attached to one single domain object when it is cross domain in nature and hence it was always recommended to be a separate layer. 
Any software architecture can be abstracted to following layers.
1) Information Presentment
2) Information Processing 
3) Information Persistence
These three layers can be applied to the lowest level of software architecture. 
in your query, you have referred to persistence framework. considering actual DB layer as information persistence through SQL / ORM mapping through framework, entities defines the list of states to be modified and annotation indirectly states the behaviour it has to do (which is modify the DB) and the overall CRUD operations (or findbys and inserts of framework) refers the information presentment for the consumer.  
All these frameworks helps you to abstract certain boiler plate code to handle resources and (some cases behavior) which otherwise will be left to programmers to hand code. 
.. 
Drop me a word if you feel the above makes sense. 
  • asked a question related to Object-Oriented Programming
Question
21 answers
what is the characteristic features of object-oriented programming?
Relevant answer
Answer
Zhiming Liu — what you describe is "class-oriented programming," which is a weak evolution from object-oriented programming and, while somewhat related and often confused with OO, it is not the same.
Experts in reusability (such as Will Tracz) note that reuse is not a design desideratum but can be a consequence of good design. The most reused artefacts to this day are probably still the primitives in the C library. Many OO artefacts designed to be reused are in fact rarely used, and to be reused, they must first be used. (My corporate reuse repository contained code that didn't even compile, but the people who put it there were rewarded for contributing reusable code.)
  • asked a question related to Object-Oriented Programming
Question
2 answers
Radial polarized beam is tightly focused by an high NA objective (OBJ). A reflection mirror located in the focal region of the OBJ is employed to reflect the focusing spot. The image is enlarged by the OBJ and a tube lens (f = 200 mm), then imaged onto a digital camera. In the ideal case, I should obtain a solid focus spot. Why do I obtain an annular beam? 
Relevant answer
Answer
Here is an article desribing the problems in focusing a radially polarized light beam.
  • asked a question related to Object-Oriented Programming
Question
5 answers
I have designed a testing approach to test integration fault of embedded system. I have already created the test criteria. But now i need to go for experimentation but i do have any sample code. I need some real C code which i can execute with test cases. I tried to search in many sites but did not get suitable code.
What should i do now? Because without execution i cannot collect the test result. Please share your idea.
Thank you.
Relevant answer
Answer
Hi Muhammad, 
  You can have a look at open source C projects in gitHub. 
  • asked a question related to Object-Oriented Programming
Question
22 answers
please help me, I wanna learn OOP
Relevant answer
Answer
In addition to the previous answer, we can say also that OOP is a well-adopted programming style that uses interacting objects to model and solve complex programming tasks. However, there are two examples of popular OO programming languages are Java and C++. Some other well-known object-oriented programming languages include Objective-C, Perl, Python, Javascript, Simula, Modula, Ada, Smalltalk, and the Common Lisp Object Standard.
Basically, some other OOP advantages include:
1- Improved software development productivity: OO programming is modular, as it provides separation of duties in object-based program development. It is also extensible, as objects can be extended to include new attributes and behaviors. Objects can also be reused within an across applications. Because of these three factors; extensibility, modularity, and reusability.
2- Faster development: Reuse enables faster development. Object-oriented programming languages come with rich libraries of objects, and code developed during projects is also reusable in future projects.
3- Lower cost of development: The reuse of software also lowers the cost of development. Typically, more effort is put into the OO analysis and design, which lowers the overall cost of development.
4- Higher-quality software: Faster development of software and lower cost of development allows more time and resources to be used in the verification of the software. Although quality is dependent upon the experience of the teams, OO programming tends to result in higher-quality software
Other OOP disadvantages are:
1- Steep learning curve: The thought process involved in OO programming may not be natural for some people, and it will take the time to get used to it. 
2- The complexity of creating programs: it is very complex to create programs based on the interaction of objects. Some of the key programming techniques, such as inheritance and polymorphism, can be a big challenging to comprehend initially.
  • asked a question related to Object-Oriented Programming
Question
3 answers
Hi, I'm beginner in learning of Object Oriented Programming, especially on Java. I'm still confuse to determine which are true of OOP's Properties examples.
I know that my question is not a research question. I should better to find the detailed answers through Google, but I would like to know the correct answer, so that I can understand OOP well. Please kindly help me to answer this if you don't mind. I thank you for your attention and your help.
Relevant answer
Answer
  • Classes –  Class Definition (Generic class for the unspecified data. They are flexible and reusable and Class Library for specified data)
  • Inheritance of the class – the class is reused on many functions on the system
  • Encapsulation – Capture and keep data save from outside interference
  • Abstraction- The ability to represent data at a very conceptual level without any details.
  • Polymorphism- This is the ability to exist in various forms. For example an operator can be overloaded so as to add two integer numbers and two floats.
This video might be helpful in understanding OOP:
  • asked a question related to Object-Oriented Programming
Question
3 answers
Respected Sir/Madam,
Can you suggest me :--How to do interlink two diffrent things and correlate to each other?
  1. Firstly ,We examined 22 different UML Class Diagram and Find out Maintainability through these Size metrics and Structure Complexity Metrics .Size metrics contains Response for a class ,Number of Method, Total Number of methods, Weight methods per class. Structure Complexity metrics contains Number of Children, Number of classes ,Number of Relation ,NGen, MaxDIT, NAggH, NGenH.
  2. Secondly ,Maintainability Index (MI) is a composite metric that incorporates a number of traditional source codes metrics into a single number that indicates the relative maintainability. This Second is that , assess the Maintainability Index, Cyclomatic Complexity, Lines of Code (LOC), Depth of Inheritance,Class coupling and result found the enhance maintainability through Visual Studio C Sharp 2013 and analyze the Code Metrics of different diffetrent small program.
Can you guide me how to interlink these two things to correlate each other because program of Visual studio c# and UML Class diagrams are diffterent to each other . They are no simililarty criteria and coordination to each other ,only both are same object oriented programming and their characteristics are OOPs nature.
So,What I should do?How to conclude these things.
Relevant answer
Answer
please helf me
  • asked a question related to Object-Oriented Programming
Question
8 answers
Require working principle.
Relevant answer
Answer
please help me
  • asked a question related to Object-Oriented Programming
Question
4 answers
One of the barriers to rebuilding tables in Oracle's relational database is that on a table with multiple indexes, the system has to rebuild each index with a separate full table scan. It seems that a "full table scan" should have all of the columns (for all of the indexes) in one pass, but I haven't found any way to do this. Some database systems lock operations during the building of indexes, so this problem becomes even more significant.
Thank you in advance.
Relevant answer
Answer
Dear Bruce,
Thank you for this information, this is very helpful. This website and the keywords are a very good idea.
Regards,
Kevin.
  • asked a question related to Object-Oriented Programming
Question
3 answers
A multi-threaded application should have atomicity, deadlock avoidance, race condition detection. Are there any other which are necessary to be considered?
Relevant answer
Answer
So you have also to avoid resource thrashing and thread life-cycle overhead. This comes when you have too many threads and it starts taking up all your resources. Usually the introduction of thread pools help with the resource thrashing as it spreads the load of thread creation and you get to re-use already created threads to avoid the creation overhead altogether.
There are 3 main threading approaches
1. Thread per task: Small number of long running tasks
2. Single background thread: Low priority background tasks processed in a queue
3. Thread pooling: Large number of short running tasks
There is probably others but I guess those are the ones that come to my mind off the bat.
  • asked a question related to Object-Oriented Programming
Question
7 answers
I am testing class cohesion metric
Relevant answer
Answer
I am working on my thesis now in the data collection stage and needed opinions to prevent as you have said long run problems with my conclusions.I will look into the suggested tools, thank you for your responses.
  • asked a question related to Object-Oriented Programming
  • asked a question related to Object-Oriented Programming
Question
3 answers
I am trying to analyze java classes to a stereotypes such as control, entity, test, exception, interface and model. How can I classify the classes to multivalued stereotypes such as control-test or others.
Relevant answer
Answer
Do you want to do this in some specified way? E.g. with annotations or something like that? Otherwise, you could use bitmasks I guess.
  • asked a question related to Object-Oriented Programming
Question
8 answers
I came across the GOF (Gang of Four) Advice "Favor Aggregation over Inheritance".
Can you provide a concrete example where both - inheritance and aggregation - would be design options but I should use aggregation instead of inheritance? If possible please attach a UML diagram.
Relevant answer
Answer
I believe characteristic of good design is design by composition whereby your classes are composed of other classes such as properties of a particular type. This allows for inversion of control and the ability to make software that is extensible without modification or tight coupling. Inheritance has its purpose but I too think it because difficult to maintain when you continue to extend sub classes. Eventually you get to the point where you need to start going back up the chain to add in abstract methods to support further operations. Design by composition is essentially what GOF is referring too.
For example consider you have a duck as a base class. You could create a mallard type which inherits from the duck class. But lets say that you have a method called make_sound(). If you implemented this in the base class you would define it as "Quack" and the mallard type would be able to use it.  Now you are to add a new duck of type : Rubber_Duck. The issue here is that a rubber duck does not go "quack" but may go "squeak". Now you need to override your original make_sound() method. Now you learn you need to make a variety of sounds so you need to back into the base class and rethink the entire design.
If you use an interface you could have simply defined the method of make_sound() and created many sounds that share this behavior. Then you apply the make sound type as a property into your duck class. Now you can simply assign the right type of sound at run-time to the derived type without altering your design. 
  • asked a question related to Object-Oriented Programming
Question
6 answers
It would be good if the tool could show each and every information in the source code (abstract, interface, template classes) and there relations among them.
Relevant answer
Answer
The ObjectAid UML Explorer for Eclipse: The ObjectAid UML Explorer is an agile and lightweight code visualization tool for the Eclipse IDE. It shows your Java source code and libraries in live UML class and sequence diagrams that automatically update as your code changes. The image below is a class diagram of actual source code; click on it to see the editor in the Eclipse Java Perspective.You can use that link for free download from http://www.objectaid.com/installation
And other software:  Code 2 UML is a tool for constructing UML class diagrams from java .class and .jar files. Requirements: JRE 1.6 Download link http://sourceforge.net/projects/code2uml/
I hope it will be useful for you.
  • asked a question related to Object-Oriented Programming
Question
5 answers
I am working on building a course for entry-level students in Object-Oriented Programming. The topics covered are classes, objects, attributes, methods, inheritance, encapsulation, polymorphism, aggregation, composition and exception handling. I have seen a number of papers and books that explain these concepts. But I am looking for a method to design OOP programs. They have to have pretty discrete steps for students to follow. Does anyone know of any good literature that describes a methodology for designing an OOP application using these basic concepts?
Relevant answer
Answer
There are a lot of books. I think that a mandatory reading to all OO developers is the book Object Oriented Software Construction by Bertrand Meyer (Prentice Hall). I strong recommend it
  • asked a question related to Object-Oriented Programming
Question
2 answers
At a high level - fail-fast is a property of a system or software with respect to its response to failures. A fail-fast system is designed to immediately report any failure or condition that is likely to lead to failure. Fail-fast systems are usually designed to stop normal operation rather than attempt to continue a possibly-flawed process. When a problem occurs, a fail-fast system fails immediately and visibly. Failing fast is a non-intuitive technique: "failing immediately and visibly" sounds like it would make your software more fragile, but it actually makes it more robust. Bugs are easier to find and fix, so fewer go into production. In Java, Fail-fast term can be related to context of iterators. If an iterator has been created on a collection object and some other thread tries to modify the collection object "structurally", a concurrent modification exception will be thrown. It is possible for other threads though to invoke "set" method since it doesn't modify the collection "structurally". However, if prior to calling "set", the collection has been modified structurally, "IllegalArgumentException" will be thrown.
Relevant answer
Answer
Rdjdjdjfjduvueifhfjnfjckfkckfkffjdicjrdjsjejcjsjdjdj
  • asked a question related to Object-Oriented Programming
Question
6 answers
Suppose you are working as a software developer in a company. You have been given a task to develop a software system design for some real world scenario. One of the basic activities of any software system design is to establish relationships between classes. Suppose at the stage of creating relationships for some classes, you have to choose either inheritance or composition as these are two fundamental ways to relate classes by achieving feature of code re-usability. Being a developer, for what reasons, would you prefer one technique to the other keeping in mind the reusability factor? Support your answer with solid reasons
Relevant answer
Answer
Thanks Peter,
I'll have to keep this issue in mind.
Perhaps, anybody who notices such a question should point it out!
  • asked a question related to Object-Oriented Programming
Question
10 answers
An analysis of widely used introductory programming textbooks shows that: (1) their size is inordinate; (2) their structure lacks conceptual foundations; (3) their content is a decorated reference manual; (4) their supplementary material (slides and others provided by the publisher) is dictating what we teach and how we teach; (5) they present material that is irrelevant to programming foundations.
And yet, we keep on requiring them in our introductory courses. Have we abdicated our responsibilities?
Relevant answer
Answer
@Eric Nunes:
To get to know the syntax id the main task for the introductory textbooks of programming language, but not for programming “an sich”. Students, which start learning programming through learning syntax of some programming language, have later problems design more complicated programs. When they should solve a complex problem, they start with thinking, how to code it and not how to design it. We should first teach them how to design programs (and let some code generator to code these programs) and when they will have basic architectonic principles under the skin, we can show them, how the designed programs were coded and teach them, how to code programs, which are behind the abilities of the nowadays code generators.
  • asked a question related to Object-Oriented Programming
Question
27 answers
I've been using Eclipse rather than netbeans, but with so many development for desktop programming some of my friend prefer to use netbeans.
Based on your experience what software do you use to teach java and what is the great thing about it?
Relevant answer
Answer
As with everything it depends on your teaching style and the level and experience of your students. With that cavetate in mind http://www.bluej.org is worth a look.
  • asked a question related to Object-Oriented Programming
Question
3 answers
1. Does a highly available IT hardware Infrastructure with sound disaster recovery plans and redundancy, guarantee high availability on the software?
2. Is there a model for designing Highly available Enterprise Software end to end solutions?
Relevant answer
Answer
Yes, there are models for that but you need to realize that there are different threats and failure modes you might want to protect against. Things can get quite complex very quickly when you mix HA and FT.
In the simplest form, FT H/W can mitigate faults that are bounded to a single machine. RAID storage arrays can mitigate faults bound to physical media. Then HA clusters can address faults bounded to a comprehensive FT machine or a network.
Then you can get into hybrid models, using HA clusters of FT nodes. Ideally, you would want to do so with a heterogeneous OS, to avoid the case where running code hits a driver error causing a crash of Node A. If the same OS/App load is then restored on Node B it is possible for Node B to crash after executing the same instruction set.
If you would like to go one step further you can also add HA Geo units, which are geographically distributed to avoid data center failure. The complexity and investment are unbounded, so it really comes down to what s the cost of downtime and how much of an investment makes sense to prevent that service outage.
Hope that gives you a sense of the possibilities out there.
  • asked a question related to Object-Oriented Programming
Question
4 answers
I've just read that aspect oriented programming (AOP) is fixing problems on object oriented programming (OOP) although its not as fast as OOP.
How do you decide between using AOP or OOP based on your experience?
Relevant answer
Answer
I would agree that AOP is best for cross-cutting concerns: functionality that touches multiple layers and/or multiple modules within those layers. Logging, of course, but also caching, authentication, exception handling, transaction management, etc. Are there any specific cases where you aren't sure where you'd want to use AOP or not?
@Arturo: Which AOP tool(s) are you using that are *pre*compilers? I've found that tools like PostSharp, Castle DynamicProxy, etc do their work as *post*compilers. By necessity, those tools combine concerns together, which fits a loose definition of "spaghetti", but it's not been so bad that it's unreadable (not that I have to read it that often, since it's post-compile).
  • asked a question related to Object-Oriented Programming
Question
30 answers
I have been using NetBeans. But I do want a change.
Relevant answer
Answer
Netbeans (free, recommended by Oracle itself);
Eclipse (free, recommended by Android);
Jdeveloper (free, recommended for Oracle DB);
BlueJ (free, recommended for UML design);
IntelliJ IDEA (not sure whether it is free or not, Android studio Beta version is based on it).
Regards..
  • asked a question related to Object-Oriented Programming
Question
8 answers
I am facing some issues with memory usage and programming flow using goto statements. How can I avoid them and be more efficient. (I am using QT Creator) for programming.
Relevant answer
Answer
not making any assumption about your programming, skill or experience at all:
- why is GOTO not "efficient " in what way ? in what terms ??
this below is from my lecture about GOTO statements - taken directly from my notes, as is, -
Using the goto Statement
The goto is C++’s unconditional jump statement.
Label:
Statements;
goto label;
the label can be any valid C++ identifier and can be anywhere in the same function block as the goto.
listing 34
x = 1;
loop1:
x++;
if(x < 100) goto loop1;
A for loop can be written using a label and a goto.
Using more than one or two goto’s can easily circumvent the benefits of structured programming and OOP.
Too many Jumps and labels criss-crossing each other can make a program into a confusing mess and impossible to debug. The goto can easily be misused to create quick and dirty code that usually degenerates into chaos very quickly.
Therefore the goto fell out of favour with professional programmers because it encouraged the use of “spaghetti code”, code that was virtually unreadable.
Unfortunately the allure of goto is particularly strong for beginning programmers to whom using goto’s may see like a convenient and simple solution. Professionals will rarely if ever use it.
C++ could very well exist without the goto, in other words there is no situation in which a goto is absolutely essential.
Despite the above disclaimers there are situations where a goto is the most elegant and simplest solution.
The goto can clarify program execution if used wisely.
One such case is to use the goto to exit from a deeply nested routine.
The example below illustrates this:
listing 35 // using goto to exit from deeply nested loops
for(...) {
for(...) {
while(...) {
if(...) goto stop;
.
.
.
}
}
}
stop:
cout << "Error in program.\n";
Could a break have been used in place of the goto ?
Without the goto a number of additional tests and extra variables would be required.
NOTE: a goto cannot be used to jump from one function block to another, it is only valid within the block in which its label exists.
  • asked a question related to Object-Oriented Programming
Question
13 answers
It seems that static polymorphism is not really polymorphism, because the interface looks different: It is like calling a function with different types or number of parameters.
Relevant answer
Answer
Calling a function with different types or number of parameters is another kind of polymorphism: Ad-hoc Polymorphism or Overloading.
When we say static polymorphism, it usually refers to parametric polymorphism.
Here is a good explanation about polymorphism.
  • asked a question related to Object-Oriented Programming
Question
13 answers
For designing a complex nature embedded system one group of thought says that object oriented modeling should be used and another group of thought says that structured oriented modeling should be used. which approach is suitable and why? .
Relevant answer
Answer
Malika, Joachim makes some excellent points - especially in regards to memory and garbage collection (GC). When I worked on embedded programs many years ago, there was a limit to the amount of memory that could be installed on a device, so use of dynamic memory allocation was limited. Much will also depend on whether the environment supports virtual memory - or if you are limited to only what is actually available. Since OO often implies dynamic memory allocation, understanding your target device and environment will be critical to success/failure of the method you choose.
Many years ago when I worked in the US Defense Industry, several of us had a discussion about software used to track/intercept incoming targets. The question raised was how often does GC run and when, because if we were limited to N objects for tracking (due to memory constraints), what happened when target N+1 was acquired. Assuming GC ran after N objects were allocated (cleaning up those that were no longer necessary), then would it run fast enough to be able to reallocated when that N+1 target was encountered.
I know that GC has improved significantly since those days, but when you are doing embedded, real-time programming, external factors and your target environment have an impact on your design methodology.
  • asked a question related to Object-Oriented Programming
Question
1 answer
For verification of code (in Java) I want to use JML and as JML itself is tedious to create for the developer I want to generate it from other artifacts, like UML models.
Do you have any idea about that work? I mean if you have any personal experience of the possibility of generating useful specifications from those models or any alternative way to generate them.
I appreciate in advance.
Relevant answer
Answer
I've seen an article before. It was about "Generating JML specifications from UML state diagrams" for verification purpose. They proposed a tool "AutoJML".
  • asked a question related to Object-Oriented Programming
Question
5 answers
I am looking for a research topic in Specification and Verification using JML. It is for my M.Sc thesis.
Any idea is appreciated.
Relevant answer
Answer
Dear Reza,
The easiest way to find a research topic for the application of JML is to explore some related work that you can find in publishing websites such as: Springer, Elsevier, IEEE and so on.
Anyway, here's a research paper that might be helpful:
  • asked a question related to Object-Oriented Programming
Question
3 answers
I am looking for ideas to implement some algorithms +code available.
Relevant answer
Answer
Not sure if this is related to what you are looking for but I use for teaching TDD CodeBlocks and UnitTest++. The latter has an MIT license (so it is open source).
  • asked a question related to Object-Oriented Programming
Question
2 answers
Please let me know
Relevant answer
Answer
Thank you very much for your prompt response
  • asked a question related to Object-Oriented Programming
Question
13 answers
Formula for the above MI caluclation is as follows:
V = Halstead Volume
G = Cyclomatic Complexity
LOC = count of source Lines Of Code (SLOC)
CM = percent of lines of Comment (optional)
From these measurements the MI can be calculated:
The original formula:
MI = 171 - 5.2 * ln(V) - 0.23 * (G) - 16.2 * ln(LOC)
Relevant answer
Answer
You can use the maintainability index (MI) for OO systems, but you shouldn't. Neither for other systems. For a critique of the MI, see: http://dx.doi.org/10.1109/QUATIC.2007.7
In particular, MI aggregates values of underlying metrics (such as LOC and McCabe complexity numbers) by averaging, which fails to do justice to the skewness of their statistical distributions.
In the words of Kent Beck: "Characterizing power law distributed data with mean and std deviation is like summarizing moby dick by listing the weights of characters" (https://twitter.com/KentBeck/status/331444443569856513)
For an alternative to MI and additional sources, see:
  • asked a question related to Object-Oriented Programming
Question
3 answers
Are there any tools which can be used to access the testability of object oriented software?
Relevant answer
Answer
I think you search for a method wich is applicabale to oop source code.
Therefore we have to examine a Programm. A progamm consists of a set of objects. Each object contains of a set of methods. A method is testable if you can access the method. Public and protected methods can be accessed. Public in general and protected if you inherit the method or you are in the same scope (package). You don't need bother if a method is private if they will be accessed by a public or protected method. In the described cases objects are testable.
In case of a of private methods. If you can't access the method there are different reasons. First you can't reach the method. Most compilers show a warning if you can't reach code because of programming logic error. Hard to find are the cases where you can't create test cases to access the methods.
An easy to use approach is to calculate the cyclomatic complexity (cc) for each method. This metric gives you a hint, how much effort you need to test the method code. Because cc caclulates the independed pathes through the code. Depending on the required coverage (C0 ... C3) you have to generate the required number of test cases. To control the coverage of your test cases you can use coverage frameworks. There exists severel for different for OO-Languages. Don't hesitate to send me a message.
Kind Regards,
Axel
  • asked a question related to Object-Oriented Programming
Question
18 answers
In our world some regions say complex systems are a bad thing , I noticed that some other world regions recommend complex systems as good thing.
Relevant answer
Answer
Salaheddin, I don't think you can think of a complex system as simply an aggregate of subsystems, that would be a complicated system like a car. Complex systems require both characteristics of emergent behaviours and self organisation. This CSIRO Ste provides good resources http://www.csiro.au/Organisation-Structure/Divisions/Marine--Atmospheric-Research/Complex-systems-science-2/About-Complex-Systems.aspx including re agent based modelling, etc.
Complex systems are very good because they allow resilience and evolution as on Earth. But they are difficult to predict and control eg in healthcare which is resilient to the improvement interventions we try, because the systems can then result in unpredictable unintended consequences distant in time and place that may be worse overall or require separate forms of control....
  • asked a question related to Object-Oriented Programming
Question
15 answers
Looking for a set of specific Problems to work on for my doctoral work
Relevant answer
Answer
Event-B is a rigorous formal method for system specification. Rodin is an Eclipse-based IDE that provides tool support for Event-B. One Rodin plug-in is UML-B which, as its name suggests, combines UML and B. You may want to google Colin Snook (EECS/Univ Southampton), which is the main designer and maintainer of UML-B, I believe. He has also authored several papers on this approach.
  • asked a question related to Object-Oriented Programming
Question
5 answers
The aim of the question is to get an insight of the cost estimation models used in approximating cost of web applications.
What are the cost estimation models used to approximate cost for web applications or andriod applications?
Relevant answer
Answer
I strongly recommend taking a look at the research by prof. Emília Mendes from the Blekinge Institute of Technology in Sweden. She has several papers (probably more than 50) and two books on this topic ("Web Engineering" and "Cost Estimation Techniques for Web Projects"). I think that her best results were obtained using Bayesian Models built with within-company domain experts, she had a paper at last years ICSE on this, entitled "Using knowledge elicitation to improve Web effort estimation: Lessons from six industrial case studies". By the way, she is in ResearchGate, so you can check her publications and follow her updates. Hope that this helps and good luck!
  • asked a question related to Object-Oriented Programming
Question
4 answers
Deductive Reasoning is part of smart logic such as the following :
Given below are a few examples that will help you understand this concept better:
All oranges are fruits
All fruits grow on trees
Therefore, all oranges grow on trees
Johnny is a bachelor,
All bachelors are single,
Hence, Johnny is single
The above examples are valid and sound. Here are a few valid, but unsound examples;
All flight attendants know how to swim
Ralph knows how to swim
Hence, Ralph is a flight attendant.
Relevant answer
Answer
What about reasoning logic ?
  • asked a question related to Object-Oriented Programming
Question
3 answers
Check my papers, see ARL theory, this is what I'm proposing what do you think ?
Relevant answer
Answer
I´ve had the same feeling just by doing some preliminary analysis of trends in scientific databases (Scopus, WoK), were one is going down, the other is coming up both in publication rate and in citations. However, I am not so sure about industry yet.
  • asked a question related to Object-Oriented Programming
Question
3 answers
We used aggregation now we want use composition.
Relevant answer
Answer
composition and aggregation are totally different relationships between objects , we set the relation between objects based on real world relation so the question needs to be rephrased may be , as I understood the real-life system has been changed and accordingly you need to change the objects relation from aggregation to composition . if that's the case you need to revisit design phase and application (coding phase) and change attributes and methods ( and constructors) of objects( classes ) , by having main class that has the common attributed and sub classes that have their own special attributes.