Tagged: boost Toggle Comment Threads | Keyboard Shortcuts

  • CG 10:43 am on July 18, 2008 Permalink | Reply
    Tags: boost, metaprogramming,   

    Metaprogramming, is it a solution? 

    Why Metaprogramming?

    Benefits:

    • We could do the computation at runtime instead of compile time. By doing as much work as possible before the resulting program starts, we get faster programs. The result of the computation can interact more deeply with the target language. This is possible because the actions are processed during grammar compilation and passed to the target C/C++ compiler.
    • Once the metaprogram is written, its benefits of convenience can be spread across a community of other programmers. (For a metaprogram that will only be used once, different alternatives might be more efficient)
    • Regardless of how many times it’s used, a metaprogram enables its user to write more expressive code, because the result can be specified in a form that corresponds to programmer’s mental model.
    • The resulting program is more likely to be correct and maintanable.

    Why C++ Metaprogramming?

    • User can enter the domain language directly, without learning a foreign syntax or interrupting the flow of the code
    • Interfacing metaprograms with other code, especially other metaprograms, becomes much smoother
    • No additional build step is required
    • Metaprogramming moves the computation required for expressivity and correctness from runtime to compile time

    When Metaprogramming?

    • The code needs to be expressed in terms of the abstractions of the problem domain
    • When it is needed to write a great deal of boilerplate implementation code
    • When it is needed to take the advantage of valuable properties of generic programming in C++ such as static type checking and behaviour customization, without loss of effiency
    • The code needs to be written in C++ language, without an external tool or custom source code generator

    [summarized from this book]

    Conclusion:

    • For my case, I don’t have to understand about metaprogramming to utilize the templates (which is good 😉 )
    • This writing about metaprogramming really helps me to move on without worrying about less prior tasks. Thx buddy 😉
    Advertisements
     
  • CG 1:05 pm on July 17, 2008 Permalink | Reply
    Tags: boost, , ,   

    Boosting my coding with Boost Library 

    Reading books about how to use Boost Library. Will take some time but certainly will save more time than developing all the modules from the scratch.

    Got the feeling that once I advance metaprogramming then it will come in handy when I need it.

     
    • tetangga sebelah 8:22 pm on July 17, 2008 Permalink | Reply

      hehe…ada saya punya kabar buruk dan kabar baik tentang metaprogramming,
      Kabar buruk: saya adalah orang yang sempet frustasi belajar metaprogramming, ceritanya begini, tahun 1999 dulu saya pernah diminta membuat sebuah aplikasi yang bisa menerjemahkan data dari berbagai sentral telepon, data sentral telepon tersebut selain banyak (5000 data/menit) juga sangat banyak variannya, tiap seri sentral punya format masing2, supaya saya lebih pusing user juga minta aplikasi yang saya buat bisa dikembangkan untuk mengenali jenis data baru tanpa harus diubah pada level coding…….dari sini akhirnya saya menyimpulkan harus membuat parser… usaha membuat parser ini membuat saya bertemu dengan binatang bernama metaprogramming, dan gurunya compiler (Mr. Joe of Bandung Polytechnic). menghabiskan waktu hampir 6 bulan saya berusaha belajar metaprogramming termasuk dari buku yg dipinjem dari mr. joe, dan saya gagal……saya tidak bisa menyelesaikan membuat parser dan waktu proyek sudah mempet. akhirnya saya ambil jalan singkat, saya gunakan pattern2 yang ada di buku http://www.amazon.com/Framework-Based-Software-Development-Programming-Methodologies/dp/0135333652/ref=sr_1_5?ie=UTF8&s=books&qid=1216299600&sr=8-5 dan saya gagal memahami metaprogramming.

      Kabar Baik: berdasarkan pengalaman kita bisa menggunakan boost dengan produktif tanpa harus memahami metaprogramming, cukup tahu make template semuanya lancar. template metaprogramming. kalau kita pingin mengembangkan boost baru kita sebaiknya ngerti metaprogramming karena dengan teknik metaprogramming code kita lebih bercita rasa (singkat tapi bikin lieur).

      beberapa tahun setelah kegagalan belajar metaprogramming di th 1999 saya membutuhkan lagi skill metaprogramming, belajar dari kesalahan sebelumnya ternyat saya menyimpulkan sebagai berikut:
      1. memahami code dgn teknik metaprogramming tidak akan berarti kita bisa mengembangkan/membuat code dengan teknik metaprogramming.
      2. Untuk bisa mengembangkan kode dengan teknik metaprogramming harus tahu bagaimana cara compiler bekerja dengan source code, karena metaprogramming itu adalah merayu (memanfaatkan) compiler supaya membuat code untuk kita. untuk memahami compiler C++ saya sangat dibantu oleh buku http://www.amazon.com/Annotated-C-Reference-Manual/dp/0201514591/ref=pd_bbs_sr_7?ie=UTF8&s=books&qid=1216298585&sr=8-7
      dan buku http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp/0201834545/ref=sr_11_1?ie=UTF8&qid=1216299107&sr=11-1

      3. wilujeung lieur………..

    • chikaradirghsa 9:41 am on July 18, 2008 Permalink | Reply

      hyalah, nuhun pisan tipsnya! gue baru aja mau posting ttg metaprogramming.

      i will post it anyway, but now i know that i don’t have to understand metaprogramming to use boost templates, which is good!

    • yaniwid 10:05 am on July 18, 2008 Permalink | Reply

      Happy coding… Kalau sudah mulai biasanya lupa berhenti lho…

    • chikaradirghsa 12:34 pm on July 18, 2008 Permalink | Reply

      @yaniwid: ya bagus kalau lupa berhenti. biar cepet selesai codingnya 😉

  • CG 6:13 pm on July 15, 2008 Permalink | Reply
    Tags: boost, , ,   

    Graph Library – A First Trial 

    Have explored a bit through the graph library. Have read some documentation here, and here. The example worked fine.

    The library is using template. Need to learn more about it. Maybe from this book. Now reading this and this.

    Next task: developing a representation of simple grid-map in graph.

     
    • tetangga sebelah 12:36 pm on July 16, 2008 Permalink | Reply

      wah buku yang itu egak banyak jelasin Template bu, karena template itu illegal citizen of C++.

  • CG 5:16 am on July 15, 2008 Permalink | Reply
    Tags: boost, , libraries,   

    C++ library we’re going to use 

    After some discussion on the previous posting, we decided to use Boost C++ Libraries. We have downloaded the source here, and were very pleased that the library is having all the important stuff we need!

    What we’re going to do is building the framework and start to implement the algorithm we’ve discussed and agreed.

    Every minor progress will be reported here 😉

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel