Creativity and Programming(producing)
Difference between creativity and productivity
How does attitude affect creativity?
People have different inspiration.
Some people might need to be sarcastic and critical to motivate their creativity. Others might need comfort, positive thoughts, sweetness and light, sunshine and angels, flowers.
Others might need to explore death, fear, panic, zombies, the 'Hieronymous Bosch' side of existence, to explore the fears of the end of life.
These forms of creativity inspire in different ways. We are all unique! They share a focus on evoking feelings and exploring them, manipulating, displaying emotions and resulting changes we can experience.
In this sense, productivity can be motivated by experience; we can express where we want to go, and combine expression with work.
We can free ourselves from being unable to act; we can be motivated.
Monday, February 8, 2016
Saturday, January 9, 2016
On working at a new job
On working at a new job, how things can end up like a turd pile.
(They often do! How do we protect ourselves from stepping in it?)
They are delivering a coherent software product. But it's extremely brittle!
Try to make any little change and it blows up. (or they blow up).
When I start working at a place, it needs to be constant examination. Constant. You are working on a complex system so how do you become effective?
Think of a child walking through an elaborate construction carefully setup by another child before-hand.
You can barge around smashing pieces as you go. Not good!
You can tiptoe around examining things as you go. Look around, then try, make a little change, here or there, maybe, -experiment- with some little alteration.
That's the rub!
How does the system respond to your little experiment? Does it BLOW UP? or does it show some possible little aberration? Something obviously off-kilter?
The trick is simple isolation of dependencies; old fashioned structured programming, object oriented design, modularity, minimize dependencies.
If you cannot add functionality without affecting a ton of external files, macros, tables, global variables, etc.... Then, you've got some problem, no?
The question is to design in a modular fashion so that pieces can be plugged in and removed. Perhaps this sounds idealistic but it's not. It's simple reality.
It seemed to me the lead engineers were protecting their turf. They delivered a product that worked enough to demonstrate but that broke frequently. They could blame changes on the breakage; on lack of 'performance' of other, new, programmers, like me.
There is some greater philosophy here. Can you bend, change, modify, add, work on, tinker? Can you make software that is 'robust' or not? You decide.
First of all, every question, concern, complaint, is a gift, not a curse. Why not keep studying something? Why not be open to discussion? What is there to 'hide'? Hiding is for private members of classes, not for examination of concepts, abstractions, thought, design.
I simply believe that design can evolve. It need not be a brittle construction.
In Software, we have this added power, this ability, to change without breaking, to add code anywhere at any time, which does not have to alter the functionality. And need not break anything. The increased flexibility is what makes software a little better than say architecture with bricks and metal, which will certainly not allow tinkering with, if a completed structure. In software even if it's deployed.
One can change a module to make it simpler, more efficient, whatever, and not break any of the other system, that might even be running in the field. That's one thing that makes software special.
Young workers are interesting. In one sense they're open to changes, differences, alternate ways. In another way, they distrust the need to analyze, take time, think carefully. It's some kind of trade-off. Interesting trade-offs between new and old.
(They often do! How do we protect ourselves from stepping in it?)
They are delivering a coherent software product. But it's extremely brittle!
Try to make any little change and it blows up. (or they blow up).
When I start working at a place, it needs to be constant examination. Constant. You are working on a complex system so how do you become effective?
Think of a child walking through an elaborate construction carefully setup by another child before-hand.
You can barge around smashing pieces as you go. Not good!
You can tiptoe around examining things as you go. Look around, then try, make a little change, here or there, maybe, -experiment- with some little alteration.
That's the rub!
How does the system respond to your little experiment? Does it BLOW UP? or does it show some possible little aberration? Something obviously off-kilter?
The trick is simple isolation of dependencies; old fashioned structured programming, object oriented design, modularity, minimize dependencies.
If you cannot add functionality without affecting a ton of external files, macros, tables, global variables, etc.... Then, you've got some problem, no?
The question is to design in a modular fashion so that pieces can be plugged in and removed. Perhaps this sounds idealistic but it's not. It's simple reality.
It seemed to me the lead engineers were protecting their turf. They delivered a product that worked enough to demonstrate but that broke frequently. They could blame changes on the breakage; on lack of 'performance' of other, new, programmers, like me.
There is some greater philosophy here. Can you bend, change, modify, add, work on, tinker? Can you make software that is 'robust' or not? You decide.
First of all, every question, concern, complaint, is a gift, not a curse. Why not keep studying something? Why not be open to discussion? What is there to 'hide'? Hiding is for private members of classes, not for examination of concepts, abstractions, thought, design.
I simply believe that design can evolve. It need not be a brittle construction.
In Software, we have this added power, this ability, to change without breaking, to add code anywhere at any time, which does not have to alter the functionality. And need not break anything. The increased flexibility is what makes software a little better than say architecture with bricks and metal, which will certainly not allow tinkering with, if a completed structure. In software even if it's deployed.
One can change a module to make it simpler, more efficient, whatever, and not break any of the other system, that might even be running in the field. That's one thing that makes software special.
Young workers are interesting. In one sense they're open to changes, differences, alternate ways. In another way, they distrust the need to analyze, take time, think carefully. It's some kind of trade-off. Interesting trade-offs between new and old.
Monday, December 14, 2015
REST
I recently learned how REST is part of good design.
Representational State Transfer means that each module can derive it's state from the messages it receives. It doesn't maintain state; state is part of the message. So the nodes on a FSM send state along the edges.
In general: a good object is self contained, it won't crash because it's state is violated by events that are unanticipated.
Representational State Transfer means that each module can derive it's state from the messages it receives. It doesn't maintain state; state is part of the message. So the nodes on a FSM send state along the edges.
In general: a good object is self contained, it won't crash because it's state is violated by events that are unanticipated.
Thursday, June 4, 2015
Tentacle design
What's not rocket science is the philosophy of the design, and good design.
But that's not the design itself. The specific design is closer to rocket science.
Philosophy:
Tentacular design:
Every subsystem has some dependencies on other systems.
Any dependencies:
Common Macros, variables, common data, common timing, methods, subroutines, events that influence,
waiting for thread loops (WFMO is wait for multiple object), results, etc.
In short, probes and sensors that cause one subsystem to malfunction based on an event in another module.
Including a bug in another module.
These are all tentacles, reaching into other systems.
Some people seem to have a mistaken belief that "integrated design" is good.
This is false. Good modular design means creating classes or any modules, that can exist independently of other modules.
That have the FEWEST tentacles as possible.
In C++ or any language.
Very very simple.
But that's not the design itself. The specific design is closer to rocket science.
Philosophy:
Tentacular design:
Every subsystem has some dependencies on other systems.
Any dependencies:
Common Macros, variables, common data, common timing, methods, subroutines, events that influence,
waiting for thread loops (WFMO is wait for multiple object), results, etc.
In short, probes and sensors that cause one subsystem to malfunction based on an event in another module.
Including a bug in another module.
These are all tentacles, reaching into other systems.
Some people seem to have a mistaken belief that "integrated design" is good.
This is false. Good modular design means creating classes or any modules, that can exist independently of other modules.
That have the FEWEST tentacles as possible.
In C++ or any language.
Very very simple.
Wednesday, April 29, 2015
Test for Good Software Design (C++ precompiled headers are an excuse)
Here is a great and simple test for good C++ design.
If you have to add a header file for a new class or structure to one module, does it cause many other unrelated C++ files to be recompiled?
You had to add the header include to another header that is included by lots of .cpp files.
Precompiled headers are used as an excuse for bad design.
If you have to add a header file for a new class or structure to one module, does it cause many other unrelated C++ files to be recompiled?
You had to add the header include to another header that is included by lots of .cpp files.
Precompiled headers are used as an excuse for bad design.
Good Software Design
1) Use standard C++ code, as few Macros and Globals as possible.
2) As few dependencies between modules as possible. Modules should be as self contained as possible. Less dependencies on the platform the better, depend on standard C++ only as much as possible.
2) As few dependencies between modules as possible. Modules should be as self contained as possible. Less dependencies on the platform the better, depend on standard C++ only as much as possible.
Wednesday, April 8, 2015
Conventions, Change, Uniformity, Potential
When I look at software I see potential for change, for improvement, (even if just mine, inside of me, my own understanding).
Stifling creativity. Uniformity makes it easier to see (transparent) but also opaque to potential to change.
Conventions create the illusion of solidity but the solidity is apparent, but not real, to it's potential for reinterpretation and redesign.
Uniformity and conventionality.
I'm not stubborn, perhaps ignorant. But the idea that (they) cannot go in and fix my code when (they) have a better idea to demonstrate what (they) feel is needed, or right, is a little odd to me, and hard to accept, and - what's the word, humiliating? hyper pedagogical? self important?
Perhaps (they) are just trying to be pedagogical and I over-react.
I can get emotional sometimes, that's another of my faults, (but even that's open to interpretation).
Stifling creativity. Uniformity makes it easier to see (transparent) but also opaque to potential to change.
Conventions create the illusion of solidity but the solidity is apparent, but not real, to it's potential for reinterpretation and redesign.
Uniformity and conventionality.
I'm not stubborn, perhaps ignorant. But the idea that (they) cannot go in and fix my code when (they) have a better idea to demonstrate what (they) feel is needed, or right, is a little odd to me, and hard to accept, and - what's the word, humiliating? hyper pedagogical? self important?
Perhaps (they) are just trying to be pedagogical and I over-react.
I can get emotional sometimes, that's another of my faults, (but even that's open to interpretation).
Friday, February 27, 2015
On Optimization
People seem to ignore the effects of age and chance.
Something might not need optimization but might need it in the future when the system is more complete, has more users, or has more applications. so in this case, it may a good idea to optimize (up front).
Secondly, there is a lot of code that is slow but not slow enough for humans to feel it positively but it causes sluggishness at the borders of perception. Optimize if possible and/or easy, and/or to add polish, to improve the customer experience, even if the improvement is not obvious.
Especially if the SW has a long life ahead of it. An obvious example would be the fidelity of music.
To assert that only the highest fidelity of audio that is necessary, is desired, is false.
Those blanket "don't optimize don't do this or that" are not universal truths.
Something might not need optimization but might need it in the future when the system is more complete, has more users, or has more applications. so in this case, it may a good idea to optimize (up front).
Secondly, there is a lot of code that is slow but not slow enough for humans to feel it positively but it causes sluggishness at the borders of perception. Optimize if possible and/or easy, and/or to add polish, to improve the customer experience, even if the improvement is not obvious.
Especially if the SW has a long life ahead of it. An obvious example would be the fidelity of music.
To assert that only the highest fidelity of audio that is necessary, is desired, is false.
Those blanket "don't optimize don't do this or that" are not universal truths.
Tuesday, February 24, 2015
Good software design and simplistic ideas about life.
Software and Life
When software, or life, has unforseen difficulties, breakage, or simply does not work in unexpected situations or events, is this a problem or an opportunity? Do you believe that a person can be designed not to experience troubles when random difficulties emerge in life? No... the way to do that, is to allow for changes, to test oddball situations. Not to try to make things perfect the first time.
Good software has been stressed and tested in real-life situations, allowed to break, analyzed, and improved.
If the user does something wrong, is it an issue, if the software crashes or breaks, because of the user's error?
Some developers think it's not. However, the best software is written to handle breakage, errors, the unexpected, and oddball cases.
Do car companies design cars to work in ideal conditions? No. They break cars to see what happens, put them under stress, and make cars that can last through problems in the environment and some abuse. The best cars can handle a lot of abuse.
In our lives, when errors occur, do we learn and survive, or simply break and die?
There are two schools in making software: simplistic, and real.
A simplistic school maintains that you design software carefully, so that when it is implemented, it works.
The problem is, no amount of planning can forsee the odd cases. It is necessary to break software, to use it incorrectly, to write code that handles problems of usage and abuse.
The philosophy that problems of usage don't matter, is wrong.
The good philosophy is that we plan to break. We anticipate changes. Software adapts intelligently, and gets better than it would be if not used incorrectly and analyzed.
Changes can break things, but breakage solves design problem that would not be seen otherwise.
Look at living things. They evolve because of those 'survival' mechanisms that are so cruel, and end up producing the most nearly perfect biological creatures you can possibly imagine.
When software, or life, has unforseen difficulties, breakage, or simply does not work in unexpected situations or events, is this a problem or an opportunity? Do you believe that a person can be designed not to experience troubles when random difficulties emerge in life? No... the way to do that, is to allow for changes, to test oddball situations. Not to try to make things perfect the first time.
Good software has been stressed and tested in real-life situations, allowed to break, analyzed, and improved.
If the user does something wrong, is it an issue, if the software crashes or breaks, because of the user's error?
Some developers think it's not. However, the best software is written to handle breakage, errors, the unexpected, and oddball cases.
Do car companies design cars to work in ideal conditions? No. They break cars to see what happens, put them under stress, and make cars that can last through problems in the environment and some abuse. The best cars can handle a lot of abuse.
In our lives, when errors occur, do we learn and survive, or simply break and die?
There are two schools in making software: simplistic, and real.
A simplistic school maintains that you design software carefully, so that when it is implemented, it works.
The problem is, no amount of planning can forsee the odd cases. It is necessary to break software, to use it incorrectly, to write code that handles problems of usage and abuse.
The philosophy that problems of usage don't matter, is wrong.
The good philosophy is that we plan to break. We anticipate changes. Software adapts intelligently, and gets better than it would be if not used incorrectly and analyzed.
Changes can break things, but breakage solves design problem that would not be seen otherwise.
Look at living things. They evolve because of those 'survival' mechanisms that are so cruel, and end up producing the most nearly perfect biological creatures you can possibly imagine.
Thursday, December 11, 2014
Most general trick of all?
Here's a great trick:
If you do a great job, even if it takes a longer time, it's done, and you ended up better off, than if you did it quickly, but have to keep coming back to it to fix thing.
Or if you did a good job and made other work that comes in the Future, easier, you've also done it.
So the ultimate judge is the indefinite future.
If you do a great job, even if it takes a longer time, it's done, and you ended up better off, than if you did it quickly, but have to keep coming back to it to fix thing.
Or if you did a good job and made other work that comes in the Future, easier, you've also done it.
So the ultimate judge is the indefinite future.
Thursday, June 19, 2014
Windows 8.0 Bugs upgrading to 8.1, for New Computer Owners!
There are a couple of issues with updating the new computer to 8.1
First is that it's faster when plugged in with an ethernet cable, (for example to a router directly connected to modem).
The Problem: windows 8.0 will not connect unless WiFi is turned OFF on the computer (maybe rebooted).
OR the setting for preference to connect is CHANGED so that the ethernet cable is preferred over WiFi.
That's a bug in 8.0.
It's always a major pain in the ass to find the ethernet/wifi network settings!
There is no start button in 8.0.
It's even VERY difficult to find a 'shut down and restart' or just shut down button!
Whoever designed the user interface in 8.0 should be fired. Microsoft you STILL suck!
(but only sometimes, problem is it's the WORST times such as for new users. You're as bad as GM with their ignition switches!)
Wednesday, January 8, 2014
The Magic Line, cross only with extreme care.
Between the current manipulation of the model, and the model's data itself, which ought to be totally independent of any manipulation of it. (needs a clean layer between them).
Simplistic Plan for converting the messy monolithic interface into the easy clean one:
1) Create a duplicate of the data, in the desired idealized format, and maintain both.
2) Write a conversion so that whenever the messy monolithic current version is presented without the idealized one, the idealized one is created from the messy monolith, thus converting old data to new data on the fly when it's encountered.
For example in my current work, my monolith is an ultrasound sector of say 300x400 which represents a radial (polar) sector of 70 degrees at 12CM depth. This is the image. The angle is represented by 36 lines of data and 2000 samples represent the distance from the origin (the ultrasound transducer).
So now we need to manipulate (measure with gui tools, enhance, etc...) a new image, 15CM, 90 degree angle, different dimensions, number of lines, samples,.... And all the code is broken! (the code that was created for the 300x400 70 degree 36 line 2000 sample images).
Simplistic Plan for converting the messy monolithic interface into the easy clean one:
1) Create a duplicate of the data, in the desired idealized format, and maintain both.
2) Write a conversion so that whenever the messy monolithic current version is presented without the idealized one, the idealized one is created from the messy monolith, thus converting old data to new data on the fly when it's encountered.
For example in my current work, my monolith is an ultrasound sector of say 300x400 which represents a radial (polar) sector of 70 degrees at 12CM depth. This is the image. The angle is represented by 36 lines of data and 2000 samples represent the distance from the origin (the ultrasound transducer).
So now we need to manipulate (measure with gui tools, enhance, etc...) a new image, 15CM, 90 degree angle, different dimensions, number of lines, samples,.... And all the code is broken! (the code that was created for the 300x400 70 degree 36 line 2000 sample images).
Tuesday, January 7, 2014
Fundamental Design Principle
A fundamental design principle, I know because I violate it frequently, is to always operate on a model of the data, not on the data itself.
In my job, I write code to manipulate an ultrasound image or sequence, with measurements, cursor positions, scaling, image processing, etc. It only gets worse and worse, the longer I interface to the data itself, rather than interfacing to a idealized model of the data, and subsequently displaying the idealized data, such that the idealized data would never have to be converted, but only re-realized onto a new platform (a new scale, new dimensions, sector angle, hardware, etc).
For example, if a measurement on the ultrasound image is at (x,y), then it needs to be converted to the polar coordinate (distance,angle) distance from origin and angle, before performing any computations, and the positions need to be saved in the model's (distance,angle). To save a position, the image (x,y) is converted FIRST.
This allows any image in (x,y) to be produced, and manipulated, and the computations only need to be done once, in (distance,angle) polar coordinates, in the original model's representation.
In my job, I write code to manipulate an ultrasound image or sequence, with measurements, cursor positions, scaling, image processing, etc. It only gets worse and worse, the longer I interface to the data itself, rather than interfacing to a idealized model of the data, and subsequently displaying the idealized data, such that the idealized data would never have to be converted, but only re-realized onto a new platform (a new scale, new dimensions, sector angle, hardware, etc).
For example, if a measurement on the ultrasound image is at (x,y), then it needs to be converted to the polar coordinate (distance,angle) distance from origin and angle, before performing any computations, and the positions need to be saved in the model's (distance,angle). To save a position, the image (x,y) is converted FIRST.
This allows any image in (x,y) to be produced, and manipulated, and the computations only need to be done once, in (distance,angle) polar coordinates, in the original model's representation.
Thursday, November 7, 2013
Tuesday, August 27, 2013
Turning stl::vector<> into an array
General concepts, things to change in the code:
- Change use of 'iterator' into 'int'. Very simple, modify 'begin() and 'end()' to reflect 0, and current last element.
- begin() is just '0'. if 'end()' is 0, then the vector is empty.
- Just add these methods to a class that contains the array, and keep a maximum size of the array. *Allocate that size on initialization*.
- It can be static or from a pool. This helps fix the memory fragmentation problems that occur when allocations and frees occur while the app executes in real time.
Saturday, August 24, 2013
Big Goal! -Plugin able code-
In short, if you implement some arbitrary functionality, can it be plugged in and removed easily?
Can you put it into a different app (executable) and demo it as a stand-alone?
Can you make a script (like Python) and run it to test it?
In large software projects I'm involved with (including games) we usually write the code to work as a big piece, get it running, so that the boss can sell it.
If we are lucky, the project does not end, and we can perfect it later. We can take pieces out and make them plug-in-able, with the goal already stated above.
Good plan?
With my project right now, implemented already, (but I'm removing the STL vector<>, see post: http://easybestcodetricks.blogspot.com/2013/08/c-code-and-stdvector-stl-remarks.html
I could extract it, and demo it maybe on a cell phone or in a nice web app.
The project specifically allows the user to draw (by mouse or touch) points whose distance is rather arbitrary, the points can become connected with lines to create a closed figure, they are ordered, have highlights, randomly or in groups, which can be deleted by the user, and when deleted the figure is re-opened (lines removed) and the user is back into editing mode, creating new points by moving the cursor or finger, again.
How's that for a description?
Can you put it into a different app (executable) and demo it as a stand-alone?
Can you make a script (like Python) and run it to test it?
In large software projects I'm involved with (including games) we usually write the code to work as a big piece, get it running, so that the boss can sell it.
If we are lucky, the project does not end, and we can perfect it later. We can take pieces out and make them plug-in-able, with the goal already stated above.
Good plan?
With my project right now, implemented already, (but I'm removing the STL vector<>, see post: http://easybestcodetricks.blogspot.com/2013/08/c-code-and-stdvector-stl-remarks.html
I could extract it, and demo it maybe on a cell phone or in a nice web app.
The project specifically allows the user to draw (by mouse or touch) points whose distance is rather arbitrary, the points can become connected with lines to create a closed figure, they are ordered, have highlights, randomly or in groups, which can be deleted by the user, and when deleted the figure is re-opened (lines removed) and the user is back into editing mode, creating new points by moving the cursor or finger, again.
How's that for a description?
C++ Code? and std::vector<> STL remarks.
SUMMARY: Better to write logical, simple run-time code that works well, than to include a ton of compile-time logic of which you know very little about what happens when the app is actually running, running for a long time, with unpredictable user (and other) input, in real time. Real-time is chaotic, and you can control the bugs easier this way.
I write my production SW in C++.
If code is well written, it can EASILY be converted ('ported') to a different language, and that's my goal. Best targets these days that I am aware of would be Python, Objective-C because Apple uses it, Java, or JavaScript.
One of my projects which is actually a lot of fun, is to REMOVE STL std::vector<> from code, and replace it with simple, easy to maintain and BUG FREE classes.
Why? It seems that with many days of debugging, headaches, very infrequent but persistent crash bugs, and memory usage problems, I conclude that the complexity of the STL code itself is a problem. It is a source of unending difficulties with young programmers. After reading the goals of the Python language, I've seen the light, and understand more. (also, I am stupid).
Run time efficiency, and simplicity, is very important. Using templates to provide much logic, might be elegant, cool, and might work well, but bugs do happen when people try to upgrade, change, modify, use pre-existing code.
So that code should be simple, obvious, transparent, not hidden in complex structures that are hard to find, follow, and trace. C++ templates, used in excess (more than a little) are kind of an exercise for geniuses, not so much for ordinary mortals. You're better off writing good run-time code classes rather than elegant compile time templates.
Done with my pulpit? Not yet. Remember Vista? Do you know where that project originated?
Vista was a programming project using some 'Loki' which was a template C++ library project (of Andrei Alexandrescu and maybe Herb Sutter) who wrote the book "Modern C++ Design" about the library.
Why was Vista such a problem? I'm not sure if they've discussed it in depth publicly, but we can make assumptions. It used too much memory because templates make it hard to manage memory effectively. It had many bugs due to excessive complexity, and programmers had to program around those bugs rather than strictly simplify their code.
Perhaps you should use BOOST, you will learn a lot, but will you produce easily maintainable, efficient, great working run-time real-time code? Maybe, but you could just write good classes and implement the patterns that you need with as much simplicity as possible, and you will control EVERYTHING.
Small discussion: http://stackoverflow.com/questions/2348112/why-is-the-loki-library-not-more-widely-used
This would be a great research project!
I write my production SW in C++.
If code is well written, it can EASILY be converted ('ported') to a different language, and that's my goal. Best targets these days that I am aware of would be Python, Objective-C because Apple uses it, Java, or JavaScript.
One of my projects which is actually a lot of fun, is to REMOVE STL std::vector<> from code, and replace it with simple, easy to maintain and BUG FREE classes.
Why? It seems that with many days of debugging, headaches, very infrequent but persistent crash bugs, and memory usage problems, I conclude that the complexity of the STL code itself is a problem. It is a source of unending difficulties with young programmers. After reading the goals of the Python language, I've seen the light, and understand more. (also, I am stupid).
Run time efficiency, and simplicity, is very important. Using templates to provide much logic, might be elegant, cool, and might work well, but bugs do happen when people try to upgrade, change, modify, use pre-existing code.
So that code should be simple, obvious, transparent, not hidden in complex structures that are hard to find, follow, and trace. C++ templates, used in excess (more than a little) are kind of an exercise for geniuses, not so much for ordinary mortals. You're better off writing good run-time code classes rather than elegant compile time templates.
Done with my pulpit? Not yet. Remember Vista? Do you know where that project originated?
Vista was a programming project using some 'Loki' which was a template C++ library project (of Andrei Alexandrescu and maybe Herb Sutter) who wrote the book "Modern C++ Design" about the library.
Why was Vista such a problem? I'm not sure if they've discussed it in depth publicly, but we can make assumptions. It used too much memory because templates make it hard to manage memory effectively. It had many bugs due to excessive complexity, and programmers had to program around those bugs rather than strictly simplify their code.
Perhaps you should use BOOST, you will learn a lot, but will you produce easily maintainable, efficient, great working run-time real-time code? Maybe, but you could just write good classes and implement the patterns that you need with as much simplicity as possible, and you will control EVERYTHING.
Small discussion: http://stackoverflow.com/questions/2348112/why-is-the-loki-library-not-more-widely-used
This would be a great research project!
First Projects: static memory buffers on initialization, removing STL vector<> from code.
The need for static memory buffers allocated on initialization, I learned by necessity, coding games for Mac Classic, and Power Macintosh computers. I've since re-implemented (in 2012) for medical devices.
REQUIREMENT:
On the old Mac OS, if your application ran out of memory, you were out of luck, it crashed. This was Motorola processor days before Apple switched to their OSX and Intel system. Those old MACs gave you a fixed size memory buffer which you had to declare when your app was installed, and if there was not enough, the app did not run. You had to figure out by hand how much to ask for and hope it was available after any other apps were loaded and running on a user's computer.
On any system, if your app runs out of memory while running in real time, it can slow down while the memory manager is working to provide memory pages, or while the app is swapping around data to allocate more and more.
SOLUTION:
When your app initializes, allocate all the memory you might need right away, and from then on, minimize system allocations while running in real time.
IMPLEMENTATION:
Static heap allocations of fixed size, code checks that allocations fit in this static heap while running, and if not, it can re-allocate a larger heap (not desirable). Code to be provided.
WHY:
As always, if YOU control the code, you can make it work. If you rely on the OS, there is more in the 'black box' of uncertainty.
REQUIREMENT:
On the old Mac OS, if your application ran out of memory, you were out of luck, it crashed. This was Motorola processor days before Apple switched to their OSX and Intel system. Those old MACs gave you a fixed size memory buffer which you had to declare when your app was installed, and if there was not enough, the app did not run. You had to figure out by hand how much to ask for and hope it was available after any other apps were loaded and running on a user's computer.
On any system, if your app runs out of memory while running in real time, it can slow down while the memory manager is working to provide memory pages, or while the app is swapping around data to allocate more and more.
SOLUTION:
When your app initializes, allocate all the memory you might need right away, and from then on, minimize system allocations while running in real time.
IMPLEMENTATION:
Static heap allocations of fixed size, code checks that allocations fit in this static heap while running, and if not, it can re-allocate a larger heap (not desirable). Code to be provided.
WHY:
As always, if YOU control the code, you can make it work. If you rely on the OS, there is more in the 'black box' of uncertainty.
Subscribe to:
Posts (Atom)